RenzoDocs

Errors

The problem+json error shape, what each status means, and which errors to retry.

View as Markdown

Every error from /api/v1 is an RFC 7807 problem document with Content-Type: application/problem+json. Each one has a stable code. Branch on code, never on title or detail: the text can change, the code does not.

The shape

{
  "type": "https://errors.renzo.app/watchlist_limit_reached",
  "title": "Watchlist Limit Reached",
  "status": 409,
  "code": "watchlist_limit_reached",
  "detail": "This product allows 3 watchlists.",
  "instance": "/api/v1/watchlists",
  "correlation_id": "0b6f3c1e8f4a4d2b9a573e2c1d0f9a11",
  "limit": 3,
  "held": 3,
  "product_code": "free"
}
FieldMeaning
typeA URI made from the code. Treat it as an ID; it is not a web page.
titleA short summary of the error kind.
statusThe HTTP status, the same as the response status.
codeThe stable, machine-readable error code. See Error codes.
detailA sentence about this occurrence. For people, not for code.
instanceThe path that failed.
correlation_idThe request ID, also in the X-Request-ID header. Quote it to support.

Some errors add fields, such as limit, held and product_code above, retry_after_seconds on a 429, or slug and access_level on article_sign_in_required. The API reference shows the possible codes of each operation, with an example body.

Validation errors

A body or parameter that fails validation answers 422 validation_failed with an errors list:

{
  "type": "https://errors.renzo.app/validation_failed",
  "title": "Validation Failed",
  "status": 422,
  "code": "validation_failed",
  "detail": "The request body or parameters did not pass validation.",
  "instance": "/api/v1/watchlists",
  "correlation_id": "0b6f3c1e8f4a4d2b9a573e2c1d0f9a11",
  "errors": [
    { "location": ["body", "name"], "message": "Field required", "type": "missing" }
  ]
}

location names the part of the request: body, query or path, then the field. A few checks made by the endpoint itself, such as a limit over 100, answer the same code with only a detail and no errors list.

Status codes

StatusMeaningTypical codes
400The request is malformed.bad_request, invalid_cursor
401No valid credential.missing_credentials, token_expired, session_revoked
402A payment failed.billing_payment_declined
403The credential is fine, but the action is not allowed.article_access_required, customer_account_deactivated
404Nothing there, or not yours.not_found, watchlist_not_found
405The path does not take this method.method_not_allowed
409The request conflicts with the current state.profile_incomplete, watchlist_limit_reached, idempotency_key_reused
410The resource is gone for good.article_archived
413The body is too large.payload_too_large
415The body is not JSON.unsupported_media_type
422The body or parameters are invalid.validation_failed, username_invalid
429Too many requests.rate_limited
500A bug on our side.internal_error
502The payment provider failed.billing_provider_failed
503A dependency is down for a moment.service_unavailable, dependency_unavailable, auth_temporarily_unavailable

A resource that belongs to someone else answers 404, not 403, so IDs do not leak.

How to handle errors

  1. Read code. Handle the codes your feature expects, such as a plan limit. Show detail only as a fallback.
  2. On 401 token_expired, refresh the token pair once, then repeat the call. On any other 401, sign in again. See Authentication.
  3. On 429 and 503, wait for the Retry-After header (seconds), then retry. See Rate limits.
  4. On 500 and 502, retry a few times with backoff. For writes, send an Idempotency-Key so a retry cannot act twice. See Idempotency.
  5. Do not retry other 4xx errors unchanged. Fix the request first.
  6. Log correlation_id with every error.

Errors that are not HTTP errors

A few codes never come as an HTTP status:

The error code catalog marks these with the status "none".

On this page