Skip to content
pokemontcgapi.com
Documentation

Error

The one body every failing request returns, whatever the status.

object4 fields

There is a single error shape across the whole API. Switch on error.code, never on error.message: codes are a published contract and do not change once shipped, messages get reworded whenever a rewording helps someone.

request_id also travels in the X-Request-Id response header, which the API sends on successful responses too. Log it — it is the key into our logs, and the first thing support will ask for.

Fields

Error fields
FieldTypeNullDescription
error.codestringnoSCREAMING_SNAKE code from the taxonomy. See errors.
error.messagestringnoEnglish sentence for a human reader. Not stable, not for parsing.
error.detailsobjectyesStructured context, and the field worth reading: position and valid_fields for query errors, valid_includes for rejected relations, supported for rejected enums, max and requested for limits. Absent when there is nothing structured to add.
error.request_idstringnoUUID for this request. Also in X-Request-Id.

Example

error.json
{
  "error": {
    "code": "INVALID_QUERY",
    "message": "Unknown search field \"nmae\" at position 0. The full list of searchable fields is in details.valid_fields.",
    "details": {
      "field": "nmae",
      "position": 0,
      "valid_fields": ["abilities.name", "abilities.text", "abilities.type", "artist", "attacks.damage"]
    },
    "request_id": "151d3d29-3839-472a-a66b-e7636c0e5701"
  }
}

Every code

This table is the complete list of codes the service can return. It is shorter than the enum in the source, on purpose: a code with no reachable throw site is a branch you would write and never execute.

Complete error taxonomy
StatusCodeRetry?
400INVALID_QUERYno
400QUERY_TOO_COMPLEXno
400QUERY_UNSUPPORTEDno
400INVALID_CURSORno
400INVALID_SELECT_FIELDno
400INVALID_INCLUDEno
400INVALID_PARAMETERno
400LIMIT_EXCEEDEDno
401MISSING_API_KEYno
401INVALID_API_KEYno
404CARD_NOT_FOUNDno
404SET_NOT_FOUNDno
404ARTIST_NOT_FOUNDno
404SEALED_NOT_FOUNDno
403PLAN_REQUIREDno
403UPGRADE_REQUIREDno
404ROUTE_NOT_FOUNDno
413PAYLOAD_TOO_LARGEno
415UNSUPPORTED_MEDIA_TYPEno
500INTERNAL_ERRORyes, with backoff
503FEATURE_NOT_CONFIGUREDyes, with backoff

view this page as markdown