Documentation

Error codes

The stable list to branch on.

{
  "success": false,
  "data": null,
  "error": "A sentence written for a person.",
  "error_code": "NOT_FOUND"
}
Code Status Means
BAD_REQUEST 400 Wrong in a way the message explains
VALIDATION_FAILED 400 A field failed validation; details names which
MALFORMED_JSON 400 The body is not JSON
UNAUTHENTICATED 401 No key, or not a valid one
FORBIDDEN 403 Valid key, not allowed to do this
INSUFFICIENT_SCOPE 403 Valid key, missing the scope this endpoint needs
NOT_FOUND 404 No such thing. One code for every missing thing
CONFLICT 409 The current state does not allow it
IDEMPOTENCY_KEY_REUSED 409 Same key, different body
IDEMPOTENT_REQUEST_IN_PROGRESS 409 The first one is still running. Retry
INSUFFICIENT_CREDITS 402 Nothing published, nothing billed
PAYLOAD_TOO_LARGE 413 The body is larger than the endpoint accepts
RATE_LIMITED 429 RateLimit-Reset says how long to wait
INTERNAL_ERROR 500 Ours
SERVICE_UNAVAILABLE 503 Ours, temporarily

A published code never changes meaning. New codes may be added, so branch with a default case.

402, specifically

INSUFFICIENT_CREDITS means nothing was published and nothing was billed. The credential stays in review and can be published later. Refusing is recoverable; over-running a plan silently is a bill nobody agreed to.