Skip to content

Integration API & Prompt Execution

The Power Prompt public REST API allows organisations to seamlessly integrate enterprise prompt templates into external business systems, including ERPs, CRMs, custom scripts, and backend automations.

All API communications require HTTPS, and payload exchanges follow standard JSON conventions.


1. Authentication & Security

Access to the public API is governed through a Team API Key generated by a team manager or administrator via the dashboard (Team Management > Integrations & API Keys).

Mandatory Header

Every request to the API must include your key in the following HTTP request header:

X-API-Key: pp_live_your_secure_api_key_here

[!IMPORTANT] API Key Security Guidelines:

  • Never expose API keys in client-side code, public browser scripts, or mobile client binaries.
  • Store keys strictly in server-side secret managers or environment vaults.
  • Each key is scoped exclusively to the workspaces and prompt catalogues assigned to its governing team.

2. Executing a Prompt Template

This endpoint executes an approved prompt template, dynamically substituting variables before dispatching the payload to the configured AI model.

Request

  • Method: POST
  • Path: /api/v1/prompts/execute
  • Headers:
    • Content-Type: application/json
    • X-API-Key: pp_live_...

Request Body (JSON)

{
"prompt_id": "pr_8f4d92a1-3b7c-4e8a-9f12-0a1b2c3d4e5f",
"variables": {
"client_name": "Acme Corporation",
"document_type": "Service Level Agreement",
"notes": "Annual renewal with indexed cost adjustment."
},
"options": {
"temperature": 0.2
}
}

Parameters

FieldTypeRequiredDescription
prompt_idString (UUID)YesUnique identifier of the target prompt to execute.
variablesKey/Value ObjectYesValues for dynamic placeholders ({{variable_name}}) defined in the prompt.
options.temperatureNumber (0.0 to 1.0)NoSampling temperature (optional; defaults to the prompt template’s configured setting).

Response

Success (200 OK)

{
"success": true,
"execution_id": "exec_5a6b7c8d-9e0f-1a2b-3c4d-5e6f7a8b9c0d",
"prompt_id": "pr_8f4d92a1-3b7c-4e8a-9f12-0a1b2c3d4e5f",
"version": 3,
"result": "Final generated text output returned from the AI model...",
"usage": {
"total_tokens": 420
},
"created_at": "2026-09-27T10:30:00Z"
}

3. Error Handling (RFC 7807 Standard)

When a request cannot be fulfilled, the API returns an appropriate HTTP status code along with a standardised error payload adhering to the RFC 7807 (Problem Details for HTTP APIs) specification.

{
"type": "https://doc.powerprompt.eu/errors/missing-variable",
"title": "Missing Required Variable",
"status": 400,
"detail": "Required variable {{client_name}} was not provided in the request payload.",
"instance": "/api/v1/prompts/execute"
}

Common HTTP Error Codes

Status CodeMeaningCommon Cause
400 Bad RequestMalformed RequestInvalid JSON structure or missing mandatory prompt variables.
401 UnauthorizedAuthentication FailedMissing or invalid X-API-Key header.
403 ForbiddenAccess DeniedThe API key lacks permissions to execute this prompt or access the parent workspace.
404 Not FoundResource Not FoundSpecified prompt_id does not exist or has been archived.
429 Too Many RequestsRate Limit ExceededExceeded allowed requests per minute for this API key.
502 / 504 Gateway ErrorAI Provider ErrorUpstream AI provider timeout or service degradation.

4. Rate Limiting & Integration Best Practices

  • Default Call Quotas: Standard API keys have a default ceiling of 60 requests per minute. For high-volume enterprise ingestion, contact your organisation administrator.
  • Retry Mechanism: When receiving transient errors (429 or 503), implement exponential backoff with random jitter.
  • Pre-Flight Validation: Verify that all required template variables are populated within your application before dispatching requests to the API.