COSS

Errors

The error envelope and what each error type means.

Errors use conventional HTTP status codes and always share one envelope:

{
  "error": {
    "type": "invalid_request_error",
    "code": "validation_error",
    "message": "Invalid request body: `subject`: Too small: expected string to have >=1 characters",
    "param": "subject",
    "issues": [{ "path": "subject", "message": "Too small: expected string to have >=1 characters" }],
    "request_id": "req_01k7c8m4q2f3e9v6t5r1n0p8yz"
  }
}
FieldDescription
typeThe category of error (below). Branch on this.
codeA machine-readable reason, such as invalid_api_key.
messageA human-readable explanation. It may change; don't parse it.
paramThe request field or header the error relates to, if any.
issuesEvery validation problem, for validation_error.
request_idSame as the X-Request-Id header.

Error types

typeStatusMeaning
invalid_request_error400 / 413 / 415 / 422Malformed JSON, body too large, wrong content type, or failed validation
authentication_error401The API key is missing, invalid, revoked or expired
permission_error403The key lacks the permission, or sending is paused for the organization
not_found_error404No such resource in the key's environment, or no such endpoint
idempotency_error409 / 422A request with the key is in progress, or the key was reused with another body
rate_limit_error429Too many requests
billing_error402The plan or billing stands in the way: past the monthly allowance (usage_limit_exceeded), sending paused for an overdue invoice or the spend limit (billing_hold), or a plan limit (plan_limit_reached, plan_feature_unavailable). Don't retry; see Plans and billing
api_error5xxSomething went wrong on our side; retry with backoff

Each endpoint page lists the codes it can return.

On this page