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:
| Field | Required | Description |
|---|---|---|
inputs | Yes | Key-value pairs matching your prompt’s placeholders or workflow’s input nodes |
thread | No | Thread ID to continue a conversation. Omit to start fresh |
priority | No | onsite (highest), normal (default), or low |
environment | No | Environment identifier (e.g. production, staging) for variable and webhook matching |
metadata | No | Arbitrary key-value data attached to the run for your own tracking |
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:| Event | Fires when |
|---|---|
promptrun.finished | A prompt run completes or fails |
workflowrun.finished | A workflow run completes or fails |
knowledgedocument.finished | A document finishes processing (chunking and embedding) |
knowledgebase.finished | All documents in a knowledge base are processed |
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.