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

# Authentication

> Every request to the PolyEdge API requires an API key passed in the X-PolyEdge-Key header.

## Get an API key

Visit [polyedge.dev](https://polyedge.dev) to create an account and generate your API key.

<Warning>
  Keep your API key secret. Do not expose it in client-side code, public repositories, or anywhere it can be read by others.
</Warning>

## Pass the key in your requests

Include your API key in the `X-PolyEdge-Key` header on every request.

```bash theme={null}
curl https://api.polyedge.dev/v1/analytics/leaderboard \
  -H "X-PolyEdge-Key: YOUR_API_KEY"
```

### Node.js

```javascript theme={null}
import PolyEdgeClient from './polyedge.js';

const client = new PolyEdgeClient('YOUR_API_KEY');
// The X-PolyEdge-Key header is set automatically on every request.
```

### Python

```python theme={null}
from polyedge import PolyEdgeClient

client = PolyEdgeClient('YOUR_API_KEY')
# The X-PolyEdge-Key header is set automatically on every request.
```

## Access tiers

PolyEdge has two access tiers.

|                       | Demo        | Full access  |
| --------------------- | ----------- | ------------ |
| Results per request   | Max 20      | Up to 100    |
| Pagination (`offset`) | Must be `0` | Unrestricted |
| All endpoints         | Yes         | Yes          |
| Real-time stream      | Yes         | Yes          |

<Info>
  Demo keys are useful for testing and prototyping. Upgrade to full access at [polyedge.dev](https://polyedge.dev) when you're ready to paginate deeper or retrieve larger result sets.
</Info>

## Error reference

### 401 Unauthorized

A `401` response means the request was rejected due to an authentication problem.

```json theme={null}
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key."
}
```

Common causes:

* The `X-PolyEdge-Key` header is missing from the request.
* The API key is invalid, malformed, or has been revoked.
* The key was passed in the wrong header name (e.g., `Authorization` instead of `X-PolyEdge-Key`).
