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"
}
StatusCommon codeAction
401INVALID_API_KEYCheck the key type and Bearer header.
403API_ACCESS_NOT_AVAILABLE, API_CHANNEL_INACTIVECheck the plan; query also requires an active channel.
404AGENT_NOT_FOUND, CONVERSATION_NOT_FOUNDCheck the ID and organization/channel scope. A foreign agent is not disclosed.
409API_MESSAGE_CONFLICT, API_CONVERSATION_BUSYFor query, check the retry body or wait for the current reply to finish.
422VALIDATION_ERROR, API_CURSOR_INVALIDCorrect the fields, date range or cursor. Validation responses include errors.
429RATE_LIMIT_EXCEEDED, MESSAGE_RATE_LIMIT_EXCEEDEDBack off. Export provides Retry-After seconds.
503SERVICE_UNAVAILABLE, API_GENERATION_FAILEDRespect 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.

MuChat documentation