The API channel and the Agent Management API both let you invoke an agent over HTTP, but they are different surfaces. The API channel is a single per-agent URL with a dedicated key — ideal for embedding one agent in an external system. The Agent Management API is a full MCP server for managing agents (create, update, list, invoke) with your account API key. If you only need to send messages to one agent, use the API channel.
Enable the channel
- Open the agent and go to the Channels tab.
- Toggle API on.
- Two values appear:
- Endpoint URL — the per-agent URL you POST to, e.g.
https://triggers.app.pinkfish.ai/ext/triggers/{triggerId}. - API key — passed in the
X-API-Keyheader. Use Rotate key to mint a new one; the old key stops working immediately.
- Endpoint URL — the per-agent URL you POST to, e.g.
- Optionally set the Output format (Text, Markdown, or JSON — see below).
Copy the Endpoint URL directly from the Channels tab rather than constructing it by hand — the host is environment-specific and the path segment after
/ext/triggers/ is the agent’s channel trigger ID, not the agent ID.Send a message
POST the endpoint URL with your API key and a JSON body:
Request body
The body must beapplication/json. Unknown fields are rejected.
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | The user message to send to the agent. |
chatId | string | No | The chat to continue. Omit on the first call; pass it on every follow-up to keep context. See Maintaining conversation context. |
metadata | object | No | Arbitrary caller-supplied key/values, forwarded to the agent as sourceMetadata. |
Response
The agent runs synchronously and the reply comes back in the response body. The shape depends on the configured Output format:- Text (default) —
Content-Type: text/plain, body is the agent’s reply text. - Markdown —
Content-Type: text/markdown, body is the agent’s reply as Markdown. - JSON —
Content-Type: application/json. If the agent has a structured output schema, the body is that structured output verbatim. Otherwise the body is a default envelope:
Maintaining conversation context
The API channel is stateful, but you hold the conversation handle. To keep context across turns:First call — omit chatId
Send just
{ "message": "..." }. The agent creates a fresh chat and returns its ID in the X-Pf-Chat-Id response header (and in the chatId field of the JSON envelope, if you use JSON output).Capture the chat ID
Read
X-Pf-Chat-Id from the response headers (or chatId from the JSON body) and store it for this conversation.chatId belongs to the channel that created it. If you pass a chatId that this agent’s API channel does not own, the call is rejected with 403 and reason unowned_chat_id — and your chatId is deliberately not echoed back. Always reuse a chatId that came from a previous response of this same channel.
Output format
Set the format on the Channels tab; it is stored per channel.| Format | Content-Type | Body |
|---|---|---|
text | text/plain | Raw assistant text (default). |
markdown | text/markdown | Raw assistant text as Markdown. |
json | application/json | The agent’s structured output (if it has an output schema), otherwise { "chatId", "output" }. |
chatId in the body instead of reading it from a header, or when the agent produces structured output.
Rotating the key
Use Rotate key on the Channels tab to mint a freshX-API-Key. Rotation is atomic: the new key takes effect immediately and the previous key stops working, so update your callers before (or right after) rotating.
Errors
| HTTP status | Meaning |
|---|---|
401 / 403 | Missing or invalid X-API-Key, the channel was disabled, or a chatId you don’t own (unowned_chat_id). |
415 | Body was not application/json (or used multipart/file upload, which the API channel does not accept). |
400 | Malformed body or unknown fields. |
200 | Success — the agent’s reply is in the body. |
Related
- A2A protocol — expose the agent to external agent-to-agent clients.
- Agent Management API — create, update, list, and invoke agents with your account API key.
- Channels tab — enabling channels from the agent builder UI.

