Pular para o conteúdo

Errors

Este conteúdo não está disponível em sua língua ainda.

Every error an endpoint of /v1 returns has the same JSON shape. The API reference shows it as the Error schema, on the default, 401 and 403 responses of every operation.

One exception: a path that is not an endpoint, or an endpoint called with a method it does not take (for example PUT /v1/posts), answers 404 with an empty body, before any API key check.

{
"code": "post_version_mismatch",
"message": "The post was modified by someone else. Reload and try again.",
"retryable": false,
"correlation_id": "9b1f0c7e2d4a4e8f8a61c3b2d5e0f7a4",
"errors": {
"Messages": ["The post was modified by someone else. Reload and try again."],
"Codes": ["Post.Version.Mismatch"]
}
}
Property Meaning
code Stable, snake_case identifier of the first problem. Branch on it.
message Human-readable text in the language of Accept-Language. A convenience for logs and people: it can change, so never parse it.
target The request property the problem is about (for example targets[0]); absent when the problem is not about one property.
retryable true when the same request can succeed later without any change (see Retrying).
current_status The resource’s current status when the problem is a state conflict (for example a post that can no longer be cancelled); absent otherwise.
correlation_id The id of this request. Quote it when you contact support.
action Present only when a person must act before the request can succeed (see The action object).
retry_after Seconds to wait, on a 429 that knows when to come back, on a 409 idempotency_in_progress and on a 503 that carries Retry-After. The Retry-After header carries the same value.
errors.Messages, errors.Codes Every problem found, in order: the localized messages and their dotted keys (Post.Version.Mismatch). code is the first key in snake_case.

Properties without a value are left out of the answer (never sent as null), so read every property but code, message, retryable and errors as optional.

Write your handling against code, never against the status code alone or the message. Several codes share a status (a 409 can be idempotency_conflict or a post that is not in the right state), and the message follows the reader’s language. The codes each endpoint can answer are listed in its guide, for example Posts and Webhooks.

Status When
400 The request is malformed or fails validation (a missing property, a value out of range, a missing Idempotency-Key).
401 The API key is missing, wrong, expired or revoked. The answer carries WWW-Authenticate: Bearer.
403 The key lacks the scope the endpoint needs (common_forbidden), or the workspace refuses the call: writes on an archived or plan-blocked organization, any call on an organization pending deletion, or a publication that needs a person’s approval first.
404 The resource does not exist or the key cannot reach it (an error body whose code ends in _not_found), or the path and method name no endpoint (an empty body).
409 The request conflicts with the resource’s current state, an Idempotency-Key was reused with a different request (idempotency_conflict), or a request with the same Idempotency-Key is still running (idempotency_in_progress, retryable, with Retry-After).
410 The resource existed and is gone for good (for example an expired export).
412 The If-Match version is stale: someone changed the resource since you read it.
422 The request is well formed, but a network or the media refuses it (for example text over a network’s limit, or a missing consent).
428 The endpoint needs an If-Match header and the request has none (common_if_match_required).
429 Too many requests (common_rate_limited, also when a workspace already runs several creates at the same time), or an action you may repeat only after a delay. Wait for the Retry-After header (seconds) before you retry.
500, 502, 503 Something failed on our side or at a network we depend on. Retry later with backoff.

Idempotency and concurrency explains 409 idempotency_conflict, 409 idempotency_in_progress, 412 and 428 in detail.

retryable is true for 429, 500, 502 and 503, and for 409 idempotency_in_progress. Retry those with exponential backoff, and never sooner than Retry-After when the answer carries it. Every other error needs a change first: a different request, a fresh read of the resource, or a person’s decision.

Some refusals cannot be solved by your code alone. They carry an action object that says who must do what.

action.kind Meaning
requires_user_action A person must approve the publication in the web app. Show them review_url; after the approval, repeat the call with authorization_reference. The approval expires at expires_at_utc.
manage_plan The workspace owner’s plan blocks writes. The key was created by the owner, who can fix it in the web app.
contact_owner The workspace owner’s plan blocks writes. Ask the owner to fix it.

Every answer, error or not, carries an X-Correlation-Id header with the same value as correlation_id. You may send your own X-Correlation-Id (up to 64 characters) to tie our answer to your logs; otherwise we create one.

The API reference does not list response headers yet. These are the ones /v1 sends:

Header On
ETag Resources with a version (posts, media, webhook subscriptions): on a read of one, and on a successful update.
Location A 201 Created, with the path of the new resource.
Retry-After A 429, a 409 idempotency_in_progress, and a 503 on creation when the Idempotency-Key cannot be checked, in seconds.
Idempotent-Replayed: true A replayed answer to a request with an Idempotency-Key already used.
X-Correlation-Id Every answer.
WWW-Authenticate A 401.