Test the agent in a chat
POST/v1/agents/:agentId/test-chat
x-scope: "conversations:write"
x-rate-limit-per-minute: 10
Sends a message to the agent as a customer would write it and returns the agent's answer
in the same response, so you can check how it answers after changing its instructions,
knowledge or attachments. Leave conversation_id out to start a new test chat; send the
conversation_id of an earlier answer to continue it, so the agent sees the whole chat.
Only test chats can be continued: a customer's conversation is 404 not_found.
The AI answers exactly as it does for customers, with its knowledge, tools, attachments
and lead capture. Its tools run for real: a test can book a calendar slot, capture a
lead or call your company's own API. Each answer counts against your plan's message limit,
like any AI reply; over the limit, nothing is saved and the answer is
402 message_limit_exceeded. A test chat is saved like one from the dashboard's test chat,
under a customer named after the key or the AI assistant.
The request waits up to 30 seconds for the answer. status says how it went:
replied with the agent's messages in replies; pending when no answer came in time
(read it later with listConversationMessages and after set to message_id); or
no_reply when the AI is switched off or paused in that chat. One message at a time per
test chat: sending another while one waits is 409 test_chat_busy.
Request
Responses
- 200
- 401
- 402
- 403
- 404
- 409
- 413
- 422
- 429
- 500
- 503
The message as saved, and the agent's answer when it came in time.
Response Headers
Correlation id for this request — paste into support tickets.
Authentication failed. Single code (invalid_api_key) covers every
sub-case: missing header, wrong scheme, malformed, unknown, revoked or
expired key. The message field disambiguates for humans debugging.
One exception: when the key could not be checked because of a server-side
fault, the status is still 401 but type is internal_error and code
is internal_server_error; retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.
message_limit_exceeded: your company has used its plan's messages for this period, so
the agent wouldn't answer. Nothing was saved. limit and used carry the numbers.
Response Headers
Correlation id for this request — paste into support tickets.
Authenticated, but not allowed: insufficient_scope (the key lacks the scope in this
operation's x-scope) or agent_not_authorized (the key is limited to other agents).
Response Headers
Correlation id for this request — paste into support tickets.
not_found when conversation_id isn't one of this agent's test chats (a customer's
conversation never is); agent_not_found when the agent is not one of your company's
agents. endpoint_not_found when the agent id in the path isn't a UUID.
Response Headers
Correlation id for this request — paste into support tickets.
test_chat_busy: the last message in this test chat is still waiting for its answer.
Nothing was saved. Read the answer with listConversationMessages, then send the next
message.
Response Headers
Correlation id for this request — paste into support tickets.
The request body is larger than 1 MB.
Response Headers
Correlation id for this request — paste into support tickets.
invalid_request_body when the body isn't valid JSON, a field has the wrong type or format, or a field breaks a limit in its schema; param names the field. A query parameter that doesn't parse is invalid_request_body too.
invalid_request for a rule beyond the format, such as a note that is only spaces or a
cursor this list didn't give out.
Response Headers
Correlation id for this request — paste into support tickets.
Per-key rate limit hit. Default is 60/min/key; an endpoint with an
x-rate-limit-per-minute of its own counts in a budget of its own
(today the WhatsApp template endpoints, sendBroadcast, retryBroadcast, inviteMember,
resendInvitation, uploadAttachmentMedia, importAttachmentMedia, createUpload and
importSavedReplyMedia, which share one that allows 10/min/key,
sendConversationMessage, which allows 20/min/key; putUploadContent takes no key and
allows the default 60/min per IP address), and its 429
reports that limit in X-RateLimit-Limit. Retry-After tells you when to retry;
X-RateLimit-Reset is the Unix timestamp of the next window.
Per-success-response
X-RateLimit-*headers are a known gap; on 2xx responses these headers are NOT currently emitted. Customers should rely on 429 +Retry-Afterfor backoff signals.
Response Headers
Correlation id for this request — paste into support tickets.
Seconds to wait before retrying.
The per-minute request limit of the endpoint called. Every key has the same limits today.
Remaining requests in the current window. 0 on rejection.
Unix timestamp at which the current window resets.
Unexpected server-side failure. Retry with exponential backoff. If
the failure persists, send us the correlation_id.
Response Headers
Correlation id for this request — paste into support tickets.
Mojeeb couldn't check access because of a temporary fault: the key's,
or on assignLead and assignConversation the teammate's. Nothing was
changed. Retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.