/agents/:id/chatSend a text message to an agent and get its reply, a voice call without the audio.
Chat with Agent
Runs one text turn against the agent. The agent's own configuration (role, language, guardrails, knowledge base, and dynamic variables) shapes the reply, just like a voice call without the audio. You send only a single message; the system prompt and conversation history stay server-side, so there is no way to inject a system role. Pass conversation_id to continue a session (the id is returned so you can reuse it); omit it to start a new one. Set stream: true for a Server-Sent-Events stream of the reply. Usage is billed per token.
Path & Query
1idstringrequiredUUID of the agent to chat with.
Request body
4messagestringrequiredThe user's message: 1 to 8000 characters and at most 8000 bytes when UTF-8 encoded, so an emoji- or CJK-heavy message can hit the limit well below 8000 characters. Control characters other than tab, newline, and carriage return are rejected.
conversation_idstringoptionalContinue an existing chat session by id; omit to start a new one.
streambooleanoptionalWhen true, the reply streams as
text/event-streamServer-Sent Events instead of a single JSON body. The status is committed to 200 as soon as the stream opens, so a provider failure or an empty completion arrives as a terminal SSEerrorevent rather than an error status. Handle that event shape, not just the HTTP code. The terminaldoneevent carriespersisted. When it isfalsethe reply reached you but its turns could not be saved: that turn is not billed, and it is absent from the conversation history the next turn replays. Treat theconversation_idas usable but that exchange as lost, or start a new session.dynamic_variablesobjectoptionalPer-request
{{variable}}overrides merged over the agent's stored defaults.
Errors
8Missing or invalid API key.
Add X-API-Key: YOUR_KEY to your request headers.
Chat runs a billed generation and appends to the conversation, so it requires the write scope: a key with only agents:read is rejected. Continuing an existing session additionally requires conversations:read, because its stored history is replayed to the model.
Issue a key with the agents:write scope, plus conversations:read if you pass conversation_id.
No such agent under this tenant, or the conversation_id does not exist, belongs to a different agent, or was opened on a different channel (a voice call's transcript cannot be resumed over text). All of these return the same 404 on purpose, so probing cannot distinguish "exists but not yours" from "does not exist".
Check the agent id, and omit conversation_id to start a fresh session if the id came from another agent or channel.
The tenant's billing is hard-blocked (out of credits).
Add credits or resolve the billing issue, then retry.
The agent is still provisioning or failed to provision, so it has no usable configuration to shape a reply yet.
Wait for the agent to finish provisioning (poll GET /agents/{id} until its status is ready), then retry.
The message is blank, exceeds 8000 characters or 8000 UTF-8 bytes, contains control characters, the agent's prompt references a dynamic variable with no value, or the assembled prompt exceeds the model context window.
Shorten the message, supply the missing dynamic_variables, or lower the agent's max_tokens.
Too many requests are in flight, so the service is momentarily at capacity and throttled this one.
Retry after the delay in the Retry-After response header, with exponential backoff.
The model is temporarily unavailable (provider down or circuit breaker open).
Retry after a short delay.
