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

# Errors

> Error response format and status codes.

All error responses follow a consistent format.

## Error Response Format

```json theme={null}
{
  "error": {
    "code": "USER_NOT_FOUND",
    "message": "User not found",
    "detail": null
  }
}
```

| Field     | Type             | Description                                           |
| --------- | ---------------- | ----------------------------------------------------- |
| `code`    | `string`         | Machine-readable error code for programmatic handling |
| `message` | `string`         | Human-readable error description                      |
| `detail`  | `object \| null` | Additional context when available                     |

## HTTP Status Codes

| Status | Meaning                                                                                    |
| ------ | ------------------------------------------------------------------------------------------ |
| `400`  | Bad Request. Invalid input or validation error.                                            |
| `401`  | Unauthorized. Invalid or missing API key.                                                  |
| `403`  | Forbidden. Valid API key but insufficient permissions.                                     |
| `404`  | Not Found. Resource does not exist.                                                        |
| `409`  | Conflict. Resource already exists or state conflict.                                       |
| `429`  | Too Many Requests. Rate limit exceeded. See [Rate Limiting](/api-reference/rate-limiting). |
| `500`  | Internal Server Error. Contact support if persistent.                                      |

## Handling Errors

Use the `code` field for programmatic error handling:

```javascript theme={null}
if (response.error.code === 'USER_NOT_FOUND') {
  // Handle missing user
} else if (response.error.code === 'DUPLICATE_PHONE_NUMBER') {
  // Handle duplicate phone
}
```

## Retries

For `5xx` errors, retry with exponential backoff. For `4xx` errors, fix the request before retrying.
