> ## Documentation Index
> Fetch the complete documentation index at: https://developers.vibrant-wellness.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Error format and status codes.

> [!NOTE]
>
> 🚧 **Working in progress** — the envelope below is the contract. It is not yet returned by every
> endpoint.

## Error envelope

Every error returns this shape:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "One or more testCodes were not recognized.",
    "requestId": "req_01JQ8ZC5X9K2MN",
    "details": [{ "unknownCodes": ["FOO_BAR"] }]
  }
}
```

| Field | Description |
| :- | :- |
| `error.code` | Stable, machine-readable code — branch on this, not the message. |
| `error.message` | Human-readable explanation. |
| `error.requestId` | Identifier for this request. Include it when you contact support. |
| `error.details` | Optional array with structured context (e.g. the offending values). |

Every response — success or error — also carries the identifier in an **`X-Request-Id`** header, so
you can log it for calls that succeed. You can also **send** `X-Request-Id` yourself: pass your own
correlation id and it is carried into our logs, which makes a support request much easier to trace.

## Status codes

| Status | `error.code` | Meaning |
| :- | :- | :- |
| `400` | `invalid_request` | Malformed body, bad parameter, or unknown `testCodes`. |
| `401` | `unauthorized` | Not authenticated. |
| `403` | `forbidden` | Authenticated, but not permitted for this resource. |
| `404` | `not_found` | Resource doesn't exist or isn't within your access scope. |
| `422` | — | Understood but not actioned — carries a business outcome (see the endpoint). |
| `429` | `rate_limited` | Too many requests — see [Rate limits](https://developers.vibrant-wellness.com/platform/rate-limits.md). |
| `500` | `internal_error` | Something went wrong on our side. Safe to retry with backoff. |
| `502` | `dependency_unavailable` | A downstream dependency was unreachable — retry with backoff. |
| `503` | `temporarily_unavailable` | Transient failure (e.g. report identifier resolution) — retry with backoff. |

## Business outcomes are not errors

Some endpoints return a **`200`/`422` with a business outcome** rather than an error envelope:

* An **ineligible quote** returns `200` with `eligible: false` and a `failures` array.
* An **order** returns a `status` (`placed` / `ineligible` / `rejected` / …) — `ineligible`/`rejected`
  come back as `422` with `failures` / `reason`.
* A **report** that isn't ready returns `200` with `status: registered` — read the status rather than
  treating it as an error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.