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

# Authentication

> How to authenticate requests to the SportXAPI Cricket API.

SportXAPI authenticates API requests using an API key passed in the request headers.

## API Key Header

Send your key in the `X-API-Key` HTTP header with each request:

```http theme={null}
X-API-Key: YOUR_API_KEY
```

| Header | Required | Description |
| :- | :- | :- |
| `X-API-Key` | **Yes** (Paid) | Your secret SportXAPI token generated from the dashboard. |
| `Accept` | No | Recommended: `application/json`. |

## Header Example

```bash theme={null}
curl -X GET "https://apiv2.sportxapi.com/cricket/api/v2/match/featured" \
  -H "X-API-Key: sx_live_1234567890abcdef" \
  -H "Accept: application/json"
```

## Security Best Practices

> [!WARNING]
>
> Never commit your API key to client-side code, public GitHub repositories, or browser-accessible scripts.

1. **Keep Keys Server-Side:** Make requests from backend servers, serverless functions, or reverse proxies.
2. **Environment Variables:** Store keys in environment variables (e.g. `SPORTXAPI_KEY`) rather than hardcoding.
3. **Key Rotation:** If a key is accidentally exposed, immediately revoke it from the [Dashboard](https://dashboard.sportxapi.com/) and generate a replacement.


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