# Authentication

Requests are authenticated with an API key. A key can carry its own limits.

## Bearer token

Send the key in the `Authorization` header. The `x-api-key` header is also accepted.

```
Authorization: Bearer $API_KEY
# or
x-api-key: $API_KEY
```

## Per-key restrictions

A key can be restricted individually. A request that breaks a restriction is rejected.

| Restriction | Behaviour | Rejection |
| --- | --- | --- |
| Model allowlist | If the list is not empty, the requested model (or its group) must be listed exactly. An empty list allows every model. | 403 `model_not_allowed` |
| IP allowlist | If set, the caller IP must match an entry. `*` works as a wildcard inside an entry. | 403 `permission_denied` |
| Budget | A key with a maximum amount stops working once its used amount reaches it. | 400 `invalid_request` (message: Use amount exceeds limit) |
| Expiry / disabled | Expired, disabled or deleted keys are refused. | 401 `invalid_api_key` |

## Public endpoints

`GET /v1/models` and `GET /v1/rankings` do not need a key.

## See also
- [API keys](https://www.novapi.ai/secret-key)
