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

# Authentication

> Authenticate requests with a Bearer API key.

NextSportsAPI uses API keys for authentication. Send your key in the `Authorization` request header.

```http theme={"system"}
Authorization: Bearer YOUR_API_KEY
```

## Example

```bash theme={"system"}
curl --request GET \
  "https://api.nextsportsapi.com/v1/football/fixtures?date=2026-08-16&league=L7K9Q2R&season=2026" \
  --header "Authorization: Bearer YOUR_API_KEY"
```

## Key handling

* Store production API keys in environment variables or a secrets manager.
* Use separate keys for development, staging, and production projects.
* Rotate keys if they are exposed in logs, source control, client-side code, or third-party tools.
* Keep high-volume polling on a backend service so usage can be controlled and cached.

## Authentication errors

Authentication failures return a standard error response with an HTTP status code and a readable error object.

```json theme={"system"}
{
  "get": "football/fixtures",
  "parameters": {},
  "errors": [
    {
      "code": "auth.invalid_key",
      "message": "The API key is missing or invalid."
    }
  ],
  "results": 0,
  "paging": {
    "current": 1,
    "total": 1
  },
  "response": []
}
```
