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

# Errors

> API error response format and codes

When a request fails, the API returns a JSON error body with a consistent structure.

## Error format

```json theme={null}
{
  "error": {
    "code": "ERROR_CODE",
    "message": "A human-readable description of the error."
  }
}
```

## Error codes

| Code               | HTTP Status | Description                                      |
| ------------------ | ----------- | ------------------------------------------------ |
| `UNAUTHENTICATED`  | 401         | Missing or invalid API key                       |
| `FORBIDDEN`        | 403         | The API key lacks the required permission        |
| `NOT_FOUND`        | 404         | The requested resource does not exist            |
| `VALIDATION_ERROR` | 422         | The request body or parameters failed validation |
| `RATE_LIMITED`     | 429         | Rate limit exceeded for this API key             |
| `INTERNAL_ERROR`   | 500         | An unexpected server error occurred              |

## Examples

**Missing authentication:**

```json theme={null}
{
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "Authorization header is required."
  }
}
```

**Insufficient permissions:**

```json theme={null}
{
  "error": {
    "code": "FORBIDDEN",
    "message": "API key does not have the inventory:read permission."
  }
}
```

**Validation failure:**

```json theme={null}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Field 'email' is required."
  }
}
```
