> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors.md).

# Errors

How The Wallet Crew API reports errors: the problem document, its stable code, validation errors, retries and trace ids. Lists the errors any endpoint can return.

Every 4xx and 5xx response of the API is a problem document, except on endpoints that implement a third-party protocol, such as the Apple Wallet web service, which answer with a bare status ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)) with the content type `application/problem+json`.

## The problem document

| Member     | Description                                                                                                |
| ---------- | ---------------------------------------------------------------------------------------------------------- |
| `type`     | URL of the page and heading that documents the error, for example `.../errors/wallet#stamp-count-changed`. |
| `title`    | Short summary of the error type. It is the same for every occurrence of that type.                         |
| `status`   | HTTP status code.                                                                                          |
| `detail`   | Explanation of this occurrence, written for a person. Its wording can change.                              |
| `code`     | Stable identifier of the error type: the anchor of `type`, for example `stamp-count-changed`.              |
| `traceId`  | Identifier of the request. Quote it when you contact support.                                              |
| `instance` | Path of the request.                                                                                       |

Some errors add extension members, such as `currentValue` or `deviceIds`. Each error below lists them.

```json
{
  "type": "https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/wallet#stamp-count-changed",
  "title": "Stamp count changed",
  "status": 409,
  "detail": "The stamp card holds 4 stamps, not 3.",
  "instance": "/api/acme/passes/8f2c41/stamps",
  "code": "stamp-count-changed",
  "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
  "currentValue": 4,
  "expectedValue": 3
}
```

## Handle errors in your code

* Branch on `code`. It never changes for a given error type.
* Do not parse `detail`. Show it to a person or log it.
* Treat a `code` you do not know by its `status`.
* When you report a problem to support, quote the `traceId`.

## Validation errors

When request fields are invalid, the problem document carries an `errors` member. Each key is the camelCase JSON path of the request field, for example `displayName`, `texts.en.title` or `items[2].code`. An empty key holds a message about the request as a whole. Each value is a list of messages.

```json
{
  "type": "https://docs.thewalletcrew.io/developers-guides/integration-guides/errors#invalid-request",
  "title": "Invalid request",
  "status": 400,
  "code": "invalid-request",
  "errors": {
    "themeId": ["Theme 'summer' does not exist."]
  },
  "traceId": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
}
```

## Error pages

The errors any endpoint can return are listed on this page. Errors specific to one area have their own page:

* [Wallet errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/wallet.md): passes, pass templates, download pages and stamp cards.
* [Benefit errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/benefits.md): benefits and benefit templates.
* [Customer errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/customers.md): customer sign-in and accounts.
* [Device errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/devices.md): devices and device profiles.
* [Administration errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/administration.md): tenant configuration, themes, templates and settings.
* [Connector errors](https://docs.thewalletcrew.io/developers-guides/integration-guides/errors/connectors.md): third-party integrations.

## Invalid request

HTTP status: `400`.

The request is malformed or a field is invalid. Fix the request before you send it again. Field errors are in `errors`, as described in [Validation errors](#validation-errors).

## Authentication required

HTTP status: `401`.

The request carries no valid credentials. Authenticate, then send the request again.

## Invalid API key

HTTP status: `401`.

The `X-API-KEY` header holds a key that is invalid, disabled or unknown. Use a valid, enabled API key, or remove the header to authenticate another way. The `resolutions` member lists these options.

## Host not allowed

HTTP status: `401`.

The request reached the tenant through a host that the tenant does not allow. Send the request to one of the tenant's allowed hosts.

## Forbidden

HTTP status: `403`.

The caller is authenticated but lacks a permission the endpoint requires. When a permission is missing, `missingScopes` lists the scopes to grant, and `detail` names them.

## Tenant disabled

HTTP status: `403`.

The tenant is disabled, so the API refuses the request. Contact the owner of the tenant.

## Not found

HTTP status: `404`.

The resource does not exist. Check the identifier. Identifiers are case-sensitive.

## Tenant not found

HTTP status: `404`.

No tenant has the identifier in the URL. Check the tenant identifier in the request path.

## Method not allowed

HTTP status: `405`.

The endpoint does not accept this HTTP method. Use the method the API reference documents.

## Not acceptable

HTTP status: `406`.

The API cannot produce a response in the format the `Accept` header asks for. Change or remove the `Accept` header.

## Conflict

HTTP status: `409`.

The request conflicts with the current state of the resource, for example a resource with that identifier already exists. Read `detail`, then change the request.

## Concurrency conflict

HTTP status: `409`.

Another write changed the resource after you read it, or another write is in progress. Read the resource again, then retry. When the request sent an expected value, `currentValue` holds the value to send on the retry.

## Precondition failed

HTTP status: `412`.

A conditional header, such as `If-Match` or `If-None-Match`, does not hold. Read the resource again to get its current state.

## Payload too large

HTTP status: `413`.

The request body is too large. Send a smaller body.

## Unsupported media type

HTTP status: `415`.

The API does not accept the `Content-Type` of the request. Send the content type the API reference documents.

## Rate limited

HTTP status: `429`.

The tenant sent too many requests, or a service the request depends on is throttling. Wait, then retry. When the response carries a `Retry-After` header, wait that number of seconds.

## Internal error

HTTP status: `500`.

The API failed to process the request. Retry later. If the error persists, contact support with the `traceId`.

## Not implemented

HTTP status: `501`.

The endpoint does not support this operation.

## Upstream error

HTTP status: `502`.

A third-party service the request depends on failed or did not answer. Retry later.

## Service unavailable

HTTP status: `503`.

The API cannot process the request right now. Retry later.

## Timeout

HTTP status: `504`.

The request took too long to complete. Retry later.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/developers-guides/integration-guides/errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
