Run with API

Invoke an agent with the public API using your workspace API key, an agent ID, and a message

Use the public agent invoke endpoint when you want to send a message to an agent from your own app or service. In Fetch Hive, you can copy the request shape from More -> Get Code in the agents sidebar or from Code Snippet in the agent editor.

Authentication

Authorization: Bearer YOUR_API_KEY

See API Keys for how to create and manage keys.

Endpoint

POST https://api.fetchhive.com/v1/agent/invoke

If you want Fetch Hive to generate the cURL example for you, open Agents, then use More -> Get Code. If you are already in the editor for a specific agent, click Code Snippet instead.

Request

Use this request shape:

Field
Type
Required
Description

agent

string

Yes

The agent ID

message

string

Yes

The message you want to send to the agent

streaming

boolean

No

Whether the response should stream back as events

The in-app snippet shows the same body shape:

{
  "agent": "AGENT_UUID",
  "message": "Your message here",
  "streaming": true
}

Basic example

This matches the cURL snippet shown in the product. The invoke dialog currently shows cURL, while Python and TypeScript still show Coming Soon.

Response

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

Streaming response

The stream can include reasoning chunks, response chunks, tool events, and a final usage event.

Reasoning event:

Response event:

Tool event:

Final usage event:

Non-streaming response

If streaming is false, the route returns one JSON response with the generated output, usage data, and the request ID you can use to inspect the run in Logs.

The exact output field can vary by provider, but the response includes the run metadata you need. For example:

If the agent uses tools, the non-streaming response can also include tool execution details.

Next steps

Last updated