POST /v1/prompt/invoke
Run a prompt deployment from your own app or service.
Authentication
Send your workspace API key in theAuthorization header.
Request body
Open Prompts, then Deployments, open the deployment variant you want to run, and click Code Snippet to see this request shape in Fetch Hive.| Field | Type | Required | Description |
|---|---|---|---|
deployment | string | Yes | The prompt deployment name |
variant | string | Yes | The deployment variant name |
inputs | object | No | Key-value pairs for the prompt variables |
streaming | boolean | No | Stream response events instead of waiting for one final JSON response |
metadata | object | No | Flat caller-defined metadata for audit and log filtering. This is not used as prompt input. |
metadata must be a flat object. Keys must be non-empty strings, and values must be strings, numbers, booleans, or null. Arrays and nested objects are rejected before the run starts.
POST /v1/prompt/invoke does not accept top-level image_urls or document
attachments. If a deployed prompt uses an image URL message part, configure
that image URL in the prompt editor or bind it through an inputs variable in
the prompt content. For runtime image/document attachments, use
POST /v1/agent/invoke.
Valid:
Response
Ifstreaming is true, Fetch Hive returns a stream of events. If the provider fails after the stream has opened, Fetch Hive sends a final error event before closing the stream.
Example reasoning event:
streaming is false, Fetch Hive returns one JSON response. Provider execution failures return 502 Bad Gateway with an error message.
Example
Webhook trigger
POST /v1/prompt/webhooks/{prompt_endpoint_id}/variants/{variant_id}
Use a prompt webhook trigger when an external service should start a deployed prompt variant without a workspace API key. The request must include the prompt endpoint webhook secret in X-Fetch-Hive-Webhook-Secret. If a third-party tool cannot set custom headers, use ?secret=YOUR_WEBHOOK_SECRET as a fallback.
Webhook prompt triggers always use callback delivery. Include async.callback_url; Fetch Hive returns 202 with request_id and run_status: "running", then delivers either prompt.completed or prompt.failed to the callback URL.
inputs must be an object. Every variable declared on the selected deployed prompt version must be present, but values may be empty strings or null when you intentionally want a blank render. Extra input keys are allowed. metadata follows the same flat scalar-only rule as normal prompt invokes and appears in log filtering.
Fetch Hive signs the outbound callback with the same webhook secret used for inbound trigger authentication.
Callback data contains response on prompt.completed and error on prompt.failed; use the top-level event_type and request_id for terminal state and correlation.
Related
- See Authentication for API key setup
- See Prompts for prompt editor and deployment context
- See Run with API for a prompt-focused guide

