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

# Authentication

> How to authenticate your API requests

The nexroute API uses API keys to authenticate requests.

## Authentication Header

Authentication to the API is performed via the `X-API-Key` header. You must include your API key in every request to the API.

```bash theme={null}
X-API-Key: <YOUR_API_KEY>
```

## Example Request

Here is an example of a request authenticated with an API key:

```bash theme={null}
curl https://api.nexroute.io/v1/quote \
  -H "X-API-Key: 123456789" \
  ...
```

## Error Codes

If your API key is missing, invalid, or expired, the API will return a `401 Unauthorized` error.

| Code           | Description                                                 |
| :------------- | :---------------------------------------------------------- |
| `UNAUTHORIZED` | API key is missing or invalid.                              |
| `KEY_EXPIRED`  | API key has expired. Please reach out to our team to renew. |

<Warning>
  Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.
</Warning>
