Archive API docs
    Jump to

    Narrow by kind with a prefix — q: queries, m: mutations, t: types, g: guides, f: fields and arguments.

    Errors

    The Archive API reports failures at three levels. You can tell which level failed from the HTTP status and the shape of the response body, so check those first.

    Identifying the error level

    1. HTTP status is not 200: transport error. Authentication, a missing header, or an unknown workspace fails before any of your query’s fields are resolved. The body is a single string under errors (429 is the exception; see the table below):

    json
    { "errors": "<message>" }
    400 Bad Request 3 lines
    {
      "errors": "WORKSPACE-ID header is required"
    }

    2. HTTP status is 200 but the body has an errors array: GraphQL error. The request was transported and parsed, but a field failed. Each entry carries a message, a machine-readable extensions.code, and locations / path pointing into your query. This example passes a Creator View’s ID to items, which accepts only content views and collections:

    200 OK 24 lines
    {
      "errors": [
        {
          "message": "Preset \"8d6ddb76-8b81-5725-a762-2d2e18432dcf\" is not valid for this resolver (its accessor is \"crm_creators\"; allowed: [\"media_deck\", \"collections\"]).",
          "extensions": {
            "code": "WRONG_VIEW_TYPE_FOR_ITEMS",
            "allowedAccessors": [
              "media_deck",
              "collections"
            ]
          },
          "locations": [
            {
              "line": 2,
              "column": 3
            }
          ],
          "path": [
            "items"
          ]
        }
      ],
      "data": null
    }

    Match on extensions.code (WRONG_VIEW_TYPE_FOR_ITEMS in this example) rather than on the message text, which can change. One code can cover several messages: items returns WRONG_VIEW_TYPE_FOR_ITEMS for a preset of the wrong type and, with a “not found” message, for a preset that doesn’t exist in the workspace.

    A response can carry both data and errors: when a dependency is temporarily unavailable, the parts that could be resolved are still returned alongside a coded error for the parts that could not. Read errors even when data is populated.

    3. HTTP 200 with data and no errors: success. A mutation may still report a business failure, though. Every mutation payload has a userErrors array; an empty array means the write succeeded.

    200 OK 12 lines
    {
      "data": {
        "createCollection": {
          "collection": {
            "id": "17ccdf4e-19d2-5b30-9787-d4f0886ddf29",
            "name": "Holiday Favorites",
            "itemCount": 0
          },
          "userErrors": []
        }
      }
    }

    The userErrors pattern

    Mutations don’t raise validation failures as GraphQL errors. They return them in userErrors, so the request still comes back HTTP 200 with data. Each UserError has the shape:

    graphql
    type UserError {
      field: [String!]
      message: String!
    }

    Always inspect userErrors on a mutation response before treating it as a success. field points at the offending input path; message is human-readable.

    HTTP status reference

    StatusBody shapeCause
    200data (+ optional errors[])Success, or a GraphQL field error / mutation userErrors
    400{"errors":"WORKSPACE-ID header is required"}Missing WORKSPACE-ID on a workspace-scoped operation
    400{"errors":"The request body is not valid UTF-8 encoded JSON"}The body could not be parsed as JSON. Fix the request; retrying it unchanged fails again
    401{"errors":"Missing or invalid authentication token"}Missing, invalid, or disabled token
    404{"errors":"Shop not found"}Unknown workspace, or one your token can’t access
    405{"errors":"Method not allowed. …"} with Allow: POSTThe request used GET, PUT, PATCH or DELETE. Send GraphQL requests as POST
    429{"errors":[{"message":"Rate limit exceeded…","extensions":{"code":"RATE_LIMIT_EXCEEDED"}}]}Request rate limit or weighted cost budget exceeded. Honor Retry-After
    5xxtypically {"errors":"<message>"}Infrastructure failure. Most server-side errors arrive as HTTP 200 instead; see the codes below

    Server-side errors arrive as HTTP 200

    A failure inside the server doesn’t usually change the status code. It comes back in the GraphQL error envelope, so match on extensions.code rather than waiting for a 5xx:

    extensions.codeMeaning
    QUERY_TIMEOUTThe query was canceled by the database statement timeout. Narrow the time range or the page size, then retry
    INTERNAL_SERVER_ERRORUnexpected server-side failure. Retry with backoff; contact support if it persists
    SERVICE_UNAVAILABLEA dependency is temporarily unavailable. The data that could be resolved is still returned; retry later for the rest

    Error codes

    Codes on a 200 response split into two groups. The server-side codes above are worth retrying. The client-error codes below are not: the same request fails the same way until you change it.

    extensions.codeMeaning
    BAD_REQUESTThe request doesn’t carry one runnable operation: query is missing, empty or not a string; the body is a batched array; or operationName is missing for a multi-operation document or names no operation in it
    PERSISTED_QUERY_NOT_SUPPORTEDThe request sent only a persisted-query hash. Send the full document in query. Apollo Client’s persisted-queries link falls back to the full query on this code
    GRAPHQL_PARSE_FAILEDThe document has a syntax error. locations points at it
    GRAPHQL_VALIDATION_FAILEDThe document is deeper than the 10-level limit. Other schema-validation failures carry a more specific code, such as undefinedField, missingRequiredArguments or argumentLiteralsIncompatible
    INVALID_INPUTA value is unusable: a variable that doesn’t match its type (extensions.problems says which part), an argument outside its allowed range such as first above 100, a { from, to } range with from after to, an after cursor this query didn’t issue, arguments that conflict, a string containing the NUL character (U+0000) anywhere in the arguments or variables (the message names where), or a superSearch image or text that can’t be embedded
    NOT_FOUNDThe id you asked for doesn’t exist in this workspace. An id that belongs to another workspace reports the same way
    INTERNAL_SERVER_ERRORUsed only for faults on the server side, never for anything in your request

    For the unknown-workspace case:

    404 Not Found 3 lines
    {
      "errors": "Shop not found"
    }

    See the Rate limits guide for 429 handling and the Authentication guide for 401 handling.