Every failure returns the same JSON shape, whatever went wrong. You can write one error handler and use it everywhere.

```json
{
    "error": true,
    "is_timeout": false,
    "error_type": "HBValidationError",
    "error_message": "title is missing",
    "error_data": {
        "fields": [{ "field": "title", "message": "is missing" }]
    }
}
```

| Field           | Notes                                                                                                                              |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `error`         | Always `true` on a failure.                                                                                                        |
| `is_timeout`    | `true` only when the request exceeded the server's time limit. Safe to use as a retry signal.                                      |
| `error_type`    | A stable machine-readable identifier. Branch on this, never on `error_message`.                                                    |
| `error_message` | Human-readable. Wording may change at any time.                                                                                    |
| `error_data`    | Always present, `{}` when there is nothing to add. On a validation failure it carries a `fields` array naming each rejected field. |

### Status codes

| Status  | When                                                                                                                                                                                                                                                                                                                                                   | `error_type`                                                                                                        |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| **400** | A parameter or filter failed validation, the request body was malformed, a business rule rejected the request, the `HoneyBook-Version` header names an unknown or not yet callable version, the account's plan does not include the feature, or `ctxc` is missing on a multi-Company token (see [Accounts and Companies](#tag/accounts-and-companies)) | `HBValidationError`, `HBBadRequestError`, `HBUserError`, `HBRestrictedFeatureError`, `HBUnsupportedApiVersionError` |
| **401** | The access token is missing, malformed or expired                                                                                                                                                                                                                                                                                                      | `HBInvalidJWTError`                                                                                                 |
| **403** | The token is valid but lacks a scope this endpoint requires                                                                                                                                                                                                                                                                                            | `HBInsufficientScopeError`                                                                                          |
| **404** | The record does not exist — **or** it exists and you are not allowed to see it                                                                                                                                                                                                                                                                         | `HBObjectNotFoundError`, others                                                                                     |
| **409** | The request conflicts with the current state, such as a duplicate or an illegal status transition                                                                                                                                                                                                                                                      | `HBConflictError`                                                                                                   |
| **410** | The record existed and has been deleted — or the requested or pinned API version has sunset (see [Policy](#tag/policy))                                                                                                                                                                                                                                | `HBObjectDeletedError`, `HBApiVersionSunsetError`                                                                   |
| **500** | Something went wrong on our side                                                                                                                                                                                                                                                                                                                       | `HBInternalError`                                                                                                   |
| **502** | A webhook call could not reach the webhooks service                                                                                                                                                                                                                                                                                                    | `HBWebhooksGatewayUnavailableError`                                                                                 |
| **503** | The endpoint is temporarily shedding load                                                                                                                                                                                                                                                                                                              | `HBTempSuspendedRouteError`                                                                                         |
| **504** | A webhook call got no answer from the webhooks service in time                                                                                                                                                                                                                                                                                         | `HBWebhooksGatewayTimeoutError`                                                                                     |

### Two behaviours that catch people out

**A permission failure returns 404, not 403.** If your token is valid but the record belongs to another account, you get a 404 that is byte-for-byte identical to the one you would get for an id that never existed. This is deliberate: the API will not confirm a record exists to someone not entitled to see it. The single exception is a missing OAuth scope, which returns 403 — there, the caller is known and the requirement is public.

**A 500 never names the underlying failure.** `error_type` is normalized to `HBInternalError` and the message is generic. If you need us to investigate one, capture the request path, the time, and the `X-Request-Id` response header (see "Request IDs" below).

### Request IDs

Every response, success or error, carries an `X-Request-Id` header. Log it for each call and include it, with the approximate time of the call, when you contact HoneyBook. The id is short and opaque, and only meaningful together with the time of the call.

You may also send an `X-Client-Request-Id` header (1-255 characters: letters, digits, `_`, `-`, `@`). It is returned unchanged on the response and HoneyBook can search by it. This helps when a request timed out and you never saw a response. A malformed value is ignored; it never fails the request.

### Retrying

Retry on **500**, **502**, **503**, **504**, and any response where `is_timeout` is `true`, with exponential backoff. Do not retry **400**, **401**, **403**, **404**, **409** or **410** — the same request will fail the same way. The one exception is a `409` with `error_type` `HBIdempotencyKeyInFlight`, which is safe to retry; see [Idempotency](#tag/idempotency). A **401** is worth exactly one retry, after refreshing the token.
