Error Handling
HTTP status codes, error response format, and retry strategies for the Aurion API.
Error Handling
The Aurion API uses standard HTTP status codes and returns structured JSON error responses.
HTTP Status Codes
| Code | Meaning | When |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource created successfully |
204 | No Content | Resource deleted successfully |
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Valid key but insufficient scope |
404 | Not Found | Resource does not exist |
409 | Conflict | Idempotency-Key reused with a different request body, or a request with the same key is still in progress |
422 | Unprocessable Entity | Validation error on request body |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Unexpected server error |
503 | Service Unavailable | Temporary outage or maintenance |
Error Response Format
Error responses carry a machine-readable code plus a human-readable message:
{
"code": "ticket_not_found",
"error": "ticket_not_found",
"message": "Ticket not found",
"details": {},
"detail": "Ticket not found",
"request_id": "5c1e0d7a-2f4b-4c8e-9a61-0b7d3e2f9a10"
}Branch on code (and the HTTP status), not on the message/detail text — the text can
change and may be translated. Quote request_id (also returned in the X-Request-ID response
header) when you contact support.
A few responses are produced before this formatting step and do not use this envelope: an invalid API
key (401 {"detail": "Invalid API key"}), an unknown URL (404 {"detail": "Not Found"}),
the rate-limit 429s, and malformed tenant headers (only detail, sometimes with
code). Handle a body without code as well.
| Field | Type | Description |
|---|---|---|
code | string | Stable machine-readable error code, e.g. ticket_not_found, api_key_scope_missing. Branch on this. |
error | string | Same value as code (kept for compatibility). |
message | string | Human-readable description. |
details | object | Extra data, e.g. scope for a missing scope; for 422, the validation errors in details.errors. {} when there is none. |
detail | string, array or object | Kept for backward compatibility: the message, or for 422 the array of validation errors. Some endpoints send an object that repeats code/message with extra keys (the extra keys are also in details). |
request_id | string | Id of this request; also in the X-Request-ID header. |
Codes by status
| Status | code | message |
|---|---|---|
400 | ticket_create_rejected | subject and description are required |
401 (missing credentials) | auth_credentials_missing | Missing authentication credentials |
401 (invalid key) | — (body is only {"detail": "Invalid API key"}, plus WWW-Authenticate: Bearer) | |
403 (missing scope) | api_key_scope_missing | API key missing required scope: tickets:write |
403 (denied endpoint) | api_key_endpoint_forbidden | API keys are not permitted for this endpoint |
404 | ticket_not_found | Ticket not found |
404 (unknown URL) | — (body is only {"detail": "Not Found"}) | |
409 | idempotency_key_reused | Idempotency key reused with a different payload |
409 (still in progress) | idempotency_request_in_progress | A request with this Idempotency-Key is still in progress; retry after it completes. |
422 | validation_error | Validation failed |
500 | internal_error | Unexpected error |
An error raised without a specific code gets a generic one for its status, such as bad_request,
not_found or conflict.
Validation errors (422)
For request validation, the API returns 422 with code: "validation_error". The list of problems
is in details.errors (and, for backward compatibility, also in detail). Each item has
loc / msg / type:
{
"code": "validation_error",
"error": "validation_error",
"message": "Validation failed",
"details": {
"errors": [
{
"type": "literal_error",
"loc": ["body", "priority"],
"msg": "Input should be 'low', 'medium', 'high' or 'urgent'"
}
]
},
"detail": [
{
"type": "literal_error",
"loc": ["body", "priority"],
"msg": "Input should be 'low', 'medium', 'high' or 'urgent'"
}
],
"request_id": "5c1e0d7a-2f4b-4c8e-9a61-0b7d3e2f9a10"
}Some endpoints surface business-rule validation as a 400 instead. For example, the public tickets
endpoint returns 400 with code: "ticket_create_rejected" when ticket creation fails a business
rule, rather than a structured 422.
Rate Limiting
Every API-key request passes two limits, and both count per API key.
Plan limit. It depends on your tenant's subscription plan and on the kind of endpoint. Each tier has a per-minute limit and a burst limit over 10 seconds; a request must fit both.
| Plan | General endpoints | Search | Export |
|---|---|---|---|
| Free, Starter | 100/min, burst 40 per 10 s | 20/min, burst 10 per 10 s | 5/min, burst 2 per 10 s |
| Pro, Enterprise | 300/min, burst 120 per 10 s | 60/min, burst 30 per 10 s | 15/min, burst 6 per 10 s |
Any other plan, and a tenant without an active subscription, gets the Free limits. Export applies
to endpoints whose path contains export (except GET on an …/exports list); Search applies to
/api/v1/conversations with a search or query parameter; everything else is General.
Responses that pass the plan limiter carry its headers for the tier the request used:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per minute |
X-RateLimit-Remaining | Requests left in the current minute |
X-RateLimit-Reset | Unix time one full minute window after this request |
X-RateLimit-Burst-Limit | Requests allowed per 10-second burst window |
X-RateLimit-Burst-Remaining | Requests left in the burst window |
X-RateLimit-Burst-Reset | Unix time one full burst window after this request |
When either window is exhausted, the API returns a 429 with those headers plus Retry-After:
HTTP/1.1 429 Too Many Requests
Retry-After: 59
X-RateLimit-Limit: 100
X-RateLimit-Burst-Limit: 40
X-RateLimit-Burst-Remaining: 0{
"error": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 59 seconds.",
"retry_after": 59,
"tier": "general",
"plan": "bundle_free"
}Per-key ceiling. On every plan, one API key may also make at most 300 requests per minute.
This check runs first; when it is exceeded the 429 carries Retry-After, X-RateLimit-Limit
and X-RateLimit-Remaining, and a detail body:
{
"detail": "API key rate limit exceeded",
"limit": 300
}A few specialized endpoints (for example, Knowledge Base ingestion) add stricter per-endpoint
limits, listed on their own pages. Most of those return {"error": "Rate limit exceeded: …"} and may omit
Retry-After; back off for the window shown on the endpoint's page.
Branch on the 429 status and honour Retry-After when it is present rather than parsing the body.
Retry Strategy
For transient errors (429, 500, 503), use exponential backoff with jitter:
import time
import random
import requests
def request_with_retry(method, url, max_retries=3, **kwargs):
for attempt in range(max_retries + 1):
response = requests.request(method, url, **kwargs)
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 5))
time.sleep(retry_after)
continue
if response.status_code in (500, 503) and attempt < max_retries:
delay = (2 ** attempt) + random.uniform(0, 1)
time.sleep(delay)
continue
return response
return responseasync function requestWithRetry(
url: string,
options: RequestInit,
maxRetries = 3
): Promise<Response> {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = parseInt(
response.headers.get("Retry-After") ?? "5"
);
await new Promise((r) => setTimeout(r, retryAfter * 1000));
continue;
}
if ([500, 503].includes(response.status) && attempt < maxRetries) {
const delay = 2 ** attempt + Math.random();
await new Promise((r) => setTimeout(r, delay * 1000));
continue;
}
return response;
}
throw new Error("Max retries exceeded");
}Best Practices
- Branch on
codeand the HTTP status code — Don't match themessage/detailtext; it can change - Log the full response — Include
codeandrequest_idfor debugging - Watch
X-RateLimit-RemainingandX-RateLimit-Burst-Remaining— Pace your requests to stay under both the per-minute and the 10-second burst limit - Respect
Retry-After— On a429, don't retry faster than the header suggests - Don't retry
4xx— Client errors (except429) indicate a problem with your request