Docs

Errors

The /api/ error envelope and every code it can carry, with what each one means and what to do.

View as Markdown

Every refusal on /api/ is one JSON envelope, and every envelope carries a code to branch on, a hint that says what to do next, and a docs link to the page for its code. /api/graphql sends the same fields inside each error's extensions.

{
  "error": {
    "type": "authentication",
    "code": "invalid_key",
    "message": "This API key is not valid.",
    "docs": "https://docs.capacms.com/errors/invalid_key"
  },
  "meta": {
    "version": "2026-10-01",
    "contract": 1,
    "requestId": "req_0f3c…"
  }
}

Branch on code, never on message: messages are written for people and may be reworded. type is the coarse class, stable for each status. A 500 never carries details; quote meta.requestId to Capa support. The full envelope is in the API reference.

All 31 codes

CodeStatustypeMeaning
persisted_query_not_found200invalid_requestNo document is stored for that hash.
invalid_version400invalid_requestCapa-Version names a date Capa does not serve.
unknown_field400invalid_requestA select, filter or sort names a field the model does not have.
invalid_filter_value400invalid_requestA filter value does not fit the field's type, for example text for a number or a non-ISO date.
invalid_operator400invalid_requestThe filter or sort uses an operator this field type does not support.
invalid_cursor400invalid_requestThe after or before cursor is malformed, was minted for another sort, or belongs to another parent entry.
invalid_select400invalid_requestThe selection cannot be planned, for example a relation modifier where it does not apply.
invalid_parameter400invalid_requestA request parameter is missing or out of range: first outside 1 to 200, more than 3 sort values, a non-UUID id, bad JSON in variables.
query_too_complex400invalid_requestThe query is over a budget, and the message says which, what it measured and the limit.
count_unavailable400invalid_requesttotalCount could not be computed cheaply for this filter (a relation filter matching over 50,000 entries).
graphql_parse_failed400invalid_requestThe GraphQL document has a syntax error.
graphql_validation_failed400invalid_requestThe document parses but asks for something the key's schema does not have: a field, an argument, a type or a missing variable.
persisted_query_hash_mismatch400invalid_requestThe sha256 sent does not match the query text sent.
missing_key401authenticationThe request carried no x-api-key header.
invalid_key401authenticationThe key is unknown, revoked or expired.
preview_token_invalid401authenticationThe preview token is forged, mangled or for another project.
preview_token_expired401authenticationThe preview token was real but has expired.
subscription_required402paymentThe project's plan does not include API access right now.
scope_missing403permissionThe key is valid but lacks the scope this route needs.
origin_refused403permissionThe key is restricted to other origins than the one this request came from.
edge_only403permissionThe request reached the origin directly.
contract_not_found404not_foundCapa-Contract names a contract this project does not have.
model_not_found404not_foundThe model in the path does not exist, or this key cannot read it.
entry_not_found404not_foundNo entry with that id is visible to this key.
page_not_found404not_foundNo model declares that page and no read has reported it.
route_not_found404not_foundNo route under /api/ matches the method and path you sent.
mutations_not_enabled405methodThe request tried to write.
rate_limit_exceeded429rate_limitedCapa refused the request to protect the service, for one of two reasons the message names: too many reads running at once (the API's read gate, per client, per key or per project), or too many uncached requests from this key in a minute (the CDN's limit).
internal500api_errorCapa hit an unexpected error.
service_unavailable503api_errorThe API was busy with other projects' reads for the whole database budget, or had no database connection free in time.
query_timeout504api_errorThe database stopped the query at the statement timeout.

On this page