Getting Started
Error handling
Interpret structured errors, validation failures, and safe retry behavior.
Query and export return errors with Content-Type: application/problem+json:
{
"type": "about:blank",
"title": "Invalid Cursor",
"status": 422,
"detail": "The pagination or stream cursor is invalid.",
"instance": "/v2/agents/{agent_id}/conversations/export",
"code": "API_CURSOR_INVALID",
"trace_id": "example-request-id"
}| Status | Common code | Action |
|---|---|---|
401 | INVALID_API_KEY | Check the key type and Bearer header. |
403 | API_ACCESS_NOT_AVAILABLE, API_CHANNEL_INACTIVE | Check the plan; query also requires an active channel. |
404 | AGENT_NOT_FOUND, CONVERSATION_NOT_FOUND | Check the ID and organization/channel scope. A foreign agent is not disclosed. |
409 | API_MESSAGE_CONFLICT, API_CONVERSATION_BUSY | For query, check the retry body or wait for the current reply to finish. |
422 | VALIDATION_ERROR, API_CURSOR_INVALID | Correct the fields, date range or cursor. Validation responses include errors. |
429 | RATE_LIMIT_EXCEEDED, MESSAGE_RATE_LIMIT_EXCEEDED | Back off. Export provides Retry-After seconds. |
503 | SERVICE_UNAVAILABLE, API_GENERATION_FAILED | Respect Retry-After when present and inspect the returned result. |
Include X-Request-ID or trace_id when contacting support. Never log your API key.
Export GET requests can be retried with the same cursor; merge results by IDs. For query retries, reuse the original body and external_message_id to avoid sending a second message. A stored failed generation is returned again on replay. To deliberately send a new message, use a new external ID.
Errors after an SSE response starts are stream events, so check RUN_ERROR and the final result as described in Streaming.