# UNAUTHORIZED

> Unauthorized: Credentials are missing or were rejected: a provider rejected LayerHop's, or a request that needs a secret didn't send one.

Source: https://docs.layerhop.com/errors/UNAUTHORIZED

| HTTP status | Retry |
|---|---|
| `401` | no |

**Where it comes from:** Provider errors from 0x, Relay and LI.FI; `PATCH /v1/splits/{id}` without an edit secret; an invalid or revoked `x-api-key`; `/v1/market/*` without an API key.

## Causes

- The market data API (`/v1/market/*`) was called without an `x-api-key` header: it always needs a key.
- The operator's provider API key is missing or invalid (0x always needs `ZEROX_API_KEY`).
- Splits: the edit request has no `x-edit-token` header (or `Authorization: Bearer`).

## How to fix

- Operators: set or rotate the provider key in the API environment.
- Integrators: report it with the `requestId`; other quotes in `quotes[]` remain usable.
- Splits: send the secret returned as `editToken` when the split was created.
- Market data: create a key in the [dashboard](https://dashboard.layerhop.com) and send it as `x-api-key`.

## Example response

```json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "0x: Invalid API key",
    "requestId": "0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21",
    "docsUrl": "https://docs.layerhop.com/errors/UNAUTHORIZED"
  }
}
```

See [Error handling & retries](/guides/error-handling) for a retry strategy, and the [error catalog](/errors) for every code.
