Skip to main content
Use the public invoke endpoint when you want to call a prompt from your own app or service. First create a prompt deployment and variant in the dashboard, then invoke the deployment with your workspace API key.

Authentication

See API Keys for how to create and manage keys.

Endpoint

POST https://api.fetchhive.com/v1/prompt/invoke Before you call this endpoint, create or update a prompt deployment from the prompt editor. See Publishing and Versioning for the UI flow.

Request

Use this request shape: metadata must be flat and scalar-only: strings, numbers, booleans, or null. Nested objects and arrays return a validation error before the run starts. This endpoint 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, invoke an agent with POST /v1/agent/invoke.

Basic example

Replace YOUR_API_KEY, YOUR_DEPLOYMENT_NAME, YOUR_VARIANT_NAME, and the inputs object with your real values. Use metadata for audit fields you want to see or filter in logs, such as customer IDs, plan names, regions, or experiment names. Do not put prompt variables there; prompt variables belong in inputs. See Invoke metadata for examples and log filtering details.

Response

If streaming is true, the API returns a stream of data: events rather than one final JSON object. If the provider fails after the stream has opened, the API sends a final error event before closing the stream.

Streaming response

You can receive different event types during the stream. For example: Reasoning or thinking event:
Response event:
Final usage event:
Error event:

Non-streaming response

If streaming is false, the API returns a single JSON response. Provider execution failures return 502 Bad Gateway with an error message. For example:

Next steps