Run with API

Invoke a prompt deployment with the public API using your API key, deployment name, and variant

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

Authorization: Bearer YOUR_API_KEY

See API Keys for how to create and manage keys.

Endpoint

POST https://api.fetchhive.com/v1/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:

Field
Type
Required
Description

deployment

string

Yes

The prompt deployment name you created for the prompt

variant

string

Yes

The prompt deployment variant you want to run

inputs

object

No

Key-value pairs for any prompt variables used by the prompt

streaming

boolean

No

Whether the response should be streamed

Basic example

Replace YOUR_API_KEY, YOUR_DEPLOYMENT_NAME, YOUR_VARIANT_NAME, and the inputs object with your real values.

Response

If streaming is true, the API returns a stream of data: events rather than one final JSON object.

Streaming response

You can receive different event types during the stream. For example:

Reasoning or thinking event:

Response event:

Final usage event:

Non-streaming response

If streaming is false, the API returns a single JSON response. For example:

Next steps

Last updated