Errors
Every error response from the API — an ingest rejection, a validation failure, a missing object, a plan-limit refusal, an unavailable upstream — uses one envelope:
{
"error": {
"code": "invalid",
"message": "This field may not be blank.",
"field": "name",
"fields": {"name": ["This field may not be blank."]}
}
}
field is always present and is null when no single field is at fault, so clients never have to branch on key presence. fields is always present too: it is {} unless code is invalid, in which case it lists every validation message under the request field's dotted path (query.trail, targets.0.id), or under non_field_errors for a message about the request as a whole; field and message are its first entry. message is human-readable and may change; branch on code.
Reserved codes
| Code | HTTP status | Meaning |
|---|---|---|
invalid_envelope | 400 | A structural failure: malformed JSON, a root value that is not an object, missing event or trail, a created_at that is not RFC 3339 with an offset, a value of the wrong type, or an Idempotency-Key longer than 255 characters. |
unknown_field | 400 | The envelope carries a top-level key Santati does not recognise; field names it. |
invalid_actor_type | 400 | actor.type is not user, system, agent or anonymous. |
metadata_limit_exceeded | 400 | A metadata map breaks the published limits. |
too_many_targets | 400 | The event names more than 10 targets. |
unknown_action | 400 | The team has event definitions and this action is not one of them. |
schema_validation_failed | 400 | Metadata fails the action's JSON Schema, a target uses a type the action's definition does not allow, or a schema_version pin is not usable. |
unknown_organization | 400 | organization_id is blank or names an organization this team does not own and auto-create is off. |
quota_exceeded | 429 or 400 | 429 with Retry-After on ingest when the team's daily event limit is spent; 400 when a plan limit refuses a stream create or a destination type. |
rate_limited | 429 | The per-minute request or event ceiling was exceeded; the response carries Retry-After. |
trail_not_allowed | 403 | The key is restricted to other trails. Every endpoint that takes a trail answers this, not only ingest. In a batch this appears as a per-item result instead. |
payload_too_large | 413 or 400 | 413 when the request body exceeds 1 MiB or a batch carries more than 500 events; 400 when a chain verification range is too large, with field set to range. |
invalid | 400 | The request failed validation. fields holds every message. |
parse_error | 400 | The body is not valid JSON. |
not_authenticated | 401 or 403 | A session-authenticated endpoint was called without a signed-in session. |
authentication_failed | 401 or 403 | The credentials presented were refused. |
permission_denied | 403 | The API key is missing, invalid, expired or under-scoped for the operation, or the caller may not do this. |
not_found | 404 | The named object does not exist or belongs to another team, or a pagination cursor is not one this endpoint issued. |
method_not_allowed | 405 | The route does not accept this HTTP method. |
not_acceptable | 406 | The Accept header names no representation the endpoint serves. |
unsupported_media_type | 415 | The Content-Type is not one the endpoint parses. |
throttled | 429 | A request throttle refused the call; the response carries Retry-After. |
conflict | 409 | The write is valid but the current state refuses it, such as changing a published schema version. |
precondition_failed | 412 | If-Match no longer matches: the draft changed since you read it. |
trail_conflict | 409 | A trail with that name already exists. |
trail_unavailable | 503 | The trail service is unreachable, misconfigured, or the region is not configured on this deployment. |
export_not_ready | 409 | An export cannot be started yet, or its file does not exist yet. |
export_expired | 410 | An export's file is gone, so its download link can never work again. |
delivery_unavailable | 503 | The log stream delivery service is unreachable or refused a stream change; the write rolls back. |
In a batch, a rejection is reported per item inside a 207 body rather than as the response status, and each item's error carries only code, message and field. unknown_field applies to a single envelope — a batch request with an unrecognised top-level key is rejected as invalid_envelope with field naming the key.
Batch results
A batch POST answers 202 when every item was accepted and 207 when any was rejected, so the status alone never hides a partial failure:
{
"accepted": 2,
"rejected": 1,
"results": [
{"index": 0, "status": "accepted", "id": "01J9Z6K3M4QX8RT2VN5B7HCWDA"},
{"index": 1, "status": "duplicate", "id": "01J9Z6K3M4QX8RT2VN5B7HCWDA"},
{"index": 2, "status": "rejected", "error": {"code": "unknown_action", "message": "…", "field": "event"}}
]
}
Each result is addressed by its index in the submitted array, so results stay in order even when some items are accepted and others are not.
Other statuses
| Status | When |
|---|---|
404 | The named trail, stream or export does not exist. |
409 | A trail with that name already exists, or an export is not ready to be started. |
410 | An export's file is gone, so its download link can never work again. |
503 | The trail service is unavailable, including a region that is not configured on this deployment. Or the log stream delivery service is unavailable or refused a stream change (create, edit, delete, rotate a signing secret): the write rolls back, so no partial change is left behind. |
Handling errors
Retry 429 responses after sleeping for the number of whole seconds in the Retry-After header; rate_limited resets on the next minute, quota_exceeded at 00:00 UTC. A 503 is also worth retrying with backoff, since it reflects a temporary upstream failure.
Never retry invalid_envelope, unknown_field or invalid unchanged — the body will fail identically every time. Other 400 codes are worth a second attempt only once the cause changes: unknown_organization succeeds after the organization exists, and unknown_action after the action is defined. A retry carrying the same idempotency key — the Idempotency-Key header, or the envelope's idempotency_key field — answers 200 with the event already stored, for 24 hours, instead of writing a second copy.