The integration flow
- Create a PromptJuggler API key in Settings
- Publish the prompt or workflow you want to call – only published versions are available via the API
- Trigger a run with a POST request, passing your inputs
- Store the run ID from the response
- Wait for the webhook telling you the run finished
- Fetch the result with a GET request using the run ID
Authentication
Every API request requires a Bearer token in theAuthorization header:
Triggering runs
Runs are triggered by POST to either:/api/v1/prompts/{slug}/{version}/runs– for prompt runs/api/v1/workflows/{slug}/{version}/runs– for workflow runs
version parameter accepts a version number (3), a tag (production), or __latest__ for the most recently published version. See Naming & Versioning for details.
The request body includes:
The response returns a run ID and a thread ID. Store both – the run ID to fetch results, the thread ID if you want to continue the conversation in a follow-up call.
Runs are queued, so the response means accepted, not created: fetching the run ID straight away can briefly return
404. Wait for the webhook, as in the flow above.
Priority
Runs triggered from the UI automatically getonsite priority. API runs default to normal. Use low for batch jobs or background processing where latency doesn’t matter. Higher-priority runs are processed first when the system is under load.
Webhooks
Instead of polling for completion, configure webhooks in Settings to receive a POST when a run finishes. Four webhook events are available:
Webhooks are signed with HMAC-SHA256 using your webhook secret. The signature arrives in the
PromptJuggler-Signature header in the format t={timestamp},v1={signature}. To verify: recompute the HMAC over {timestamp}.{raw_request_body} and compare. Reject requests with timestamps outside your tolerance window to prevent replay attacks.
Environment matching
Both webhooks and environment variables use the same glob pattern matching. Tag a webhook URL with a pattern likeprod* or staging, and it will only fire for runs whose environment field matches. A webhook with no environment tag fires for all runs.
Environment variables
Environment variables are injected into prompt and workflow runs automatically. Configure them in Settings. Two sources, applied in order:- Global variables (set in Settings) – matched against the run’s
environmentfield using glob patterns. A variable taggedprod*matches runs with environmentproductionorprod-eu - Per-request overrides – passed directly in the create-run API call. These take precedence over global variables with the same key
Knowledge Base management
The API supports managing knowledge base documents programmatically – handy when your users upload content through your product and you want their documents searchable by your AI behind the scenes.- Upload documents – POST files to
/api/v1/knowledge-bases/{slug}/documents - Get a knowledge base – GET
/api/v1/knowledge-bases/{slug}for status and document list - Get a document – GET
/api/v1/knowledge-documents/{id}for processing status - Delete a document – DELETE
/api/v1/knowledge-documents/{id}
knowledgedocument.finished and knowledgebase.finished webhooks to know when uploaded documents are ready for search.