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

# API errors

> The Elastly API error body, the HTTP status of each error code, what each code means and what to do before you retry or change the request.

When the API refuses a request it returns an HTTP status and a JSON body with a machine-readable code. This page covers the error body and every error code the endpoints in the [API reference](/docs/api-reference/introduction.md) return.

## Error body

```json theme={null}
{
  "error": "insufficient_scope",
  "requestId": "9a7c2e41-6b3d-4f18-a0c5-2d8e1f7b6c90"
}
```

| Field | Meaning |
| - | - |
| `error` | The error code. Build your handling on this value, not on the status alone |
| `requestId` | The request's ID, also sent in the `X-Request-Id` header. Quote it when you contact support |

A `429` response, and a `503` response for a connection that is being updated, carry a `Retry-After` header with the seconds to wait.

A price request that is accepted can still leave individual lines unpriced. Those lines come back in a `200` response with their own state and reason. See [Price requests](/docs/developers/price-requests.md).

## Request errors

| Status | Code | Meaning and fix |
| - | - | - |
| `400` | `invalid_request` | The body, a parameter or the path is not valid. Check the request against the endpoint's reference page |
| `413` | `invalid_request` | The request body is over its size limit. See [Rate limits](/docs/developers/rate-limits.md) |
| `400` | `invalid_cursor` | The `after` cursor was altered or belongs to another list. Send `nextCursor` unchanged |
| `400` | `unsupported_api_version` | The `Elastly-Version` header names a version that does not exist or is no longer supported. See [Versioning](/docs/developers/versioning.md) |
| `400` | `idempotency_key_required` | The endpoint needs an `Idempotency-Key` header |
| `400` | `invalid_idempotency_key` | The `Idempotency-Key` is not 1 to 255 printable ASCII characters without spaces |
| `409` | `idempotency_request_in_progress` | An earlier request with the same key is still running. Wait and retry |
| `422` | `idempotency_key_reused` | The key was already used for a different request. Use a new key. See [Idempotency](/docs/developers/idempotency.md) |

## Access errors

| Status | Code | Meaning and fix |
| - | - | - |
| `401` | `unauthenticated` | The API key is missing, malformed, revoked or expired. Check the `Authorization` header and the key's status |
| `403` | `insufficient_scope` | The key's type cannot call this endpoint, for example a **Read-only** key reporting outcomes. Use a key of the right type. See [Authentication](/docs/developers/authentication.md) |
| `403` | `plan_required` | The workspace plan does not include API access |
| `403` | `workspace_read_only` | The workspace is read only. Reads still work; prices, outcomes and data writes are refused |
| `403` | `workspace_locked` | The workspace is locked. Every request is refused |
| `403` | `workspace_purging` | The workspace is being deleted. Every request is refused |
| `429` | `rate_limited` | The key or workspace reached its request limit. Wait for `Retry-After` and retry. See [Rate limits](/docs/developers/rate-limits.md) |
| `503` | `service_unavailable` | The request could not be served at this time. Retry with backoff |

## Pricing and outcome errors

| Status | Code | Meaning and fix |
| - | - | - |
| `404` | `not_found` | No decision with this ID exists for this key's environment |
| `422` | `quote_ref_customer_mismatch` | The `quoteRef` was already priced for a different customer. Use the original customer or a new `quoteRef` |
| `404` | `quote_not_found` | No quote with this `quoteRef` was priced through the API with this key's environment |

## Data errors

These come from the endpoints that send catalog items, customers and documents. See [Sending data](/docs/developers/data-ingestion.md).

| Status | Code | Meaning and fix |
| - | - | - |
| `409` | `connection_unavailable` | The integration the connector key belongs to cannot accept data. Check the integration in the dashboard |
| `503` | `connection_unavailable` | The integration is being updated. Wait for `Retry-After` and retry |
| `404` | `import_not_found` | No bulk import with this ID exists for the connector key's integration |
| `409` | `import_state_conflict` | The bulk import is not in the state this step needs, for example a file upload after the import started |
| `413` | `file_too_large` | The file is over 100 MiB. Split it into several imports |
| `415` | `unsupported_format` | The file's `Content-Type` does not match the import's format |
| `400` | `unsupported_format` | The import asks for documents in `csv`. Documents are imported as `jsonl` only |

## Retrying

Retry `429`, `503` and `409` with `idempotency_request_in_progress` after a wait. Do not retry other `4xx` responses unchanged; fix the request first. Send writes with the same `Idempotency-Key` on every retry.


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