Skip to main content
Chataigne uses conventional HTTP status codes to signal the outcome of a request, and returns a consistent, machine-readable JSON envelope on every error. Read the HTTP status to decide how to react (retry, fix input, escalate), and read the error.type and error.code fields to decide what went wrong.
Errors are identical in shape across both API surfaces — the public Chataigne API (/v1) and the Admin API (/admin/v1). The base URL for all requests is https://server.chataigne.ai.

The error envelope

Every error response — regardless of status code or surface — has the same top-level shape: a single error object.
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_invalid",
    "message": "currency must be one of CHF, EUR, GBP, BRL, USD, MXN.",
    "param": "currency",
    "request_id": "req_8sQx2pL0aZ",
    "details": {
      "allowed_values": ["CHF", "EUR", "GBP", "BRL", "USD", "MXN"]
    }
  }
}
error
object
required
The error envelope. Present on every non-2xx response.
Only type, code, request_id, and the overall envelope shape are part of the API contract. The message text and the contents of details may evolve — never branch on message, and treat details as best-effort.

Error types

The type field maps one-to-one to an HTTP status code. This is the most reliable signal for deciding your retry and recovery strategy.
typeHTTP statusMeaningSafe to retry?
invalid_request_error400The request was malformed, missing a required parameter, or a value failed validation.No — fix the request first.
authentication_error401No API key was provided, or the key is invalid or revoked.No — fix credentials.
authorization_error403The key is valid but not permitted for this surface or resource.No — use a key with the right scope.
not_found_error404The requested resource does not exist or is not visible to your key.No.
conflict_error409The request conflicts with the current state (for example a concurrent in-flight duplicate).Yes, after a short backoff.
idempotency_error409An Idempotency-Key was reused with a different request body.No — use a fresh key or the original body.
rate_limit_error429Too many requests for this key on this surface.Yes — honor Retry-After.
api_error500An unexpected error occurred on Chataigne’s side.Yes, with exponential backoff.
As a rule of thumb: 4xx errors (except 409 and 429) indicate a problem with your request that you must fix before retrying. 409, 429, and 5xx are transient and safe to retry with backoff.

Error codes

code narrows down type to a specific, stable cause. New codes may be added over time, so always provide a fallback path keyed off type.

invalid_request_error (400)

codeWhen it happens
parameter_missingA required parameter was omitted. param names the field.
parameter_invalidA parameter was present but failed validation (wrong type, format, or unsupported value). param names the field.
parameter_unknownAn unexpected parameter was sent. param names the field.
parameters_exclusiveTwo mutually exclusive parameters were sent together (for example starting_after and ending_before).
idempotency_key_missingA resource-creating POST was sent without the required Idempotency-Key header.

authentication_error (401)

codeWhen it happens
api_key_missingNo x-api-key header was provided.
api_key_invalidThe provided key is malformed, unknown, or revoked.

authorization_error (403)

codeWhen it happens
api_key_wrong_surfaceAn admin key (ch_admin_…) was used on /v1, or an org key (ch_org_…) was used on /admin/v1.
session_not_allowedA dashboard session was used against the /v1 or /admin/v1 API.
permission_deniedThe key is valid for the surface but not authorized for the target resource.

not_found_error (404)

codeWhen it happens
resource_not_foundThe resource does not exist, or your key cannot see it.
route_not_foundThe HTTP method and path do not match any known endpoint.

conflict_error (409)

codeWhen it happens
request_in_flightA concurrent request with the same Idempotency-Key is still being processed. Retry after a brief delay.
resource_conflictThe request conflicts with the current state of the resource.

idempotency_error (409)

codeWhen it happens
idempotency_key_reusedThe Idempotency-Key was previously used with a different request body. details.original_request_id references the first request.

rate_limit_error (429)

codeWhen it happens
rate_limit_exceededYou exceeded the request quota for this key on this surface. Honor the Retry-After header.

api_error (500)

codeWhen it happens
internal_errorAn unexpected error occurred on our side. Retry with exponential backoff; if it persists, contact support with the request_id.

The param field

For invalid_request_error responses caused by a single field, the envelope includes param — the exact path to the offending parameter. This lets you map the error straight to a form field or request property without parsing message. Nested fields use dot notation, mirroring the request body:
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_missing",
    "message": "name is required.",
    "param": "name",
    "request_id": "req_J3kP9vTq1m"
  }
}
param is only present on invalid_request_error. Errors that are not tied to a specific field (authentication, not found, rate limits, server errors) omit it.

Request IDs

Every response — successful or not — carries an X-Request-Id header. On errors, the same value is mirrored into error.request_id. Log it for every request: it is the fastest way for Chataigne support to locate what happened.
curl -i https://server.chataigne.ai/v1/locations/loc_does_not_exist \
  -H "x-api-key: ch_org_..."
HTTP/1.1 404 Not Found
X-Request-Id: req_8sQx2pL0aZ
Content-Type: application/json

{
  "error": {
    "type": "not_found_error",
    "code": "resource_not_found",
    "message": "No location found with id loc_does_not_exist.",
    "request_id": "req_8sQx2pL0aZ"
  }
}
You can supply your own correlation value via the x-request-id request header and we will echo it back, which makes it easy to trace a request across your systems and ours.
See Request IDs for the full lifecycle.

Errors specific to other features

A few behaviors surface as errors but are governed by dedicated features:

Idempotency

Reusing an Idempotency-Key with a different body returns idempotency_error (409). A concurrent duplicate returns conflict_error (409). Keys are retained for 24 hours.

Rate limits

Limits are per-key, per-surface. 429 responses add a Retry-After header alongside the X-RateLimit-* headers.

Authentication

Missing keys return 401. Using a key on the wrong surface — or a dashboard session on the API — returns 403.

Pagination

Sending starting_after and ending_before together returns invalid_request_error with code parameters_exclusive.

Handling errors

A robust client should:
  1. Branch on error.type (via the HTTP status) to choose a strategy: fix the request, refresh credentials, or retry.
  2. Use error.code for fine-grained handling and to map to user-facing messaging.
  3. Surface error.param to point users at the exact field to correct.
  4. Retry only transient errors409, 429, and 5xx — with exponential backoff, and honor Retry-After on 429.
  5. Always log error.request_id so failures are traceable.
# Inspect both the status code and the body. -f is intentionally NOT used so
# the error envelope is printed instead of being swallowed by curl.
curl -sS -w "\nHTTP %{http_code}\n" \
  https://server.chataigne.ai/v1/organizations/org_8sQx2pL0aZ/locations \
  -H "x-api-key: ch_org_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "name": "Pizzeria Bellini", "currency": "ZZZ" }'

# => HTTP 400
# {
#   "error": {
#     "type": "invalid_request_error",
#     "code": "parameter_invalid",
#     "message": "currency must be one of CHF, EUR, GBP, BRL, USD, MXN.",
#     "param": "currency",
#     "request_id": "req_8sQx2pL0aZ"
#   }
# }
Retrying a POST is only safe when you reuse the same Idempotency-Key across attempts. Generating a new key per attempt can create duplicate resources. Generate the key once per logical operation, before the first attempt.