> ## Documentation Index
> Fetch the complete documentation index at: https://developer.cybreeze.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Cybreeze API error codes

> Every status the Cybreeze API answers with, the two response shapes behind them, and which ones are worth a retry.

Every Cybreeze API error is JSON, but it comes in one of two shapes depending on how far your request got. Parse for both: a client that reads only one will log `undefined` for half its failures.

## The two shapes

```json Refused at the gateway theme={null}
{
  "error": "invalid_api_key",
  "message": "The x-api-key header is missing, unknown or revoked."
}
```

```json Refused by the API theme={null}
{
  "message": "This API key is not active",
  "type": "unauthorized"
}
```

The first shape, with `error`, means the request never reached Cybreeze: the key, the path, the size or the rate stopped it at the door. The second shape, with `type`, means Cybreeze itself answered. Some responses may also carry a `details` field with field-level information.

## Refused at the gateway

| Status | `error` | What happened |
| - | - | - |
| `401` | `invalid_api_key` | The `x-api-key` header is missing, unknown or revoked. A key minted less than about 45 seconds ago also reads this way |
| `404` | `not_found` | No such path on this API. Every endpoint lives under `/v1` |
| `413` | `payload_too_large` | The request body is over 10 MB |
| `429` | `rate_limited` | The per-second rate limit. Back off and retry |
| `429` | `quota_exceeded` | The daily quota is used up. It resets at `00:00` UTC |
| `504` | no body of ours | The request ran past the 29 second ceiling and was ended |

## Refused by the API

| Status | `type` | What happened |
| - | - | - |
| `400` | `bad-request` | The request body or query does not satisfy the endpoint. Check `details` |
| `401` | `unauthorized` | Your key reached us but no active key record claims it, which is what a disabled or deleted key looks like |
| `403` | `forbidden` | The call did not arrive through the Cybreeze API gateway. Call `https://public-api.cybreeze.io`, never the app's own host |
| `404` | `not-found` | The path exists but the record you named does not, or your organization cannot see it |
| `409` | `conflict` | The change collides with the current state of the record |
| `500` | `internal-server-error` | Our fault. Retry with backoff, and tell us if it persists |

> [!NOTE]
>
> A `401` can come from either layer, and the shape tells you which. `"error": "invalid_api_key"` means the gateway does not know your key. `"type": "unauthorized"` means the gateway accepted it and we did not, which is almost always a key that was disabled or deleted.

## What to retry

| Retry | Do not retry |
| - | - |
| `429 rate_limited`, with backoff and jitter | `400`, `401`, `403`, `404`, `409`, `413` |
| `500`, `504`, with backoff and a cap on attempts | `429 quota_exceeded` |

Nothing in the second column changes on a second attempt. A `401` in particular is not a transient error: either the key is wrong or it has been turned off, and retrying it just fills your logs.

## Handling both shapes

```javascript theme={null}
const response = await fetch('https://public-api.cybreeze.io/v1/ping', {
  headers: { 'x-api-key': process.env.CYBREEZE_API_KEY },
});

if (!response.ok) {
  const body = await response.json().catch(() => ({}));
  const code = body.error ?? body.type ?? 'unknown';

  throw new Error(`Cybreeze API ${response.status} ${code}: ${body.message ?? 'no message'}`);
}
```


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