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

# Authentication

> Securely authenticating with the Unprice API

Almost all Unprice API endpoints require authentication using an API key. API keys provide access to your Unprice resources.

## Bearer Authentication

Authentication is performed using HTTP Bearer authentication in the `Authorization` header:

```bash theme={null}
Authorization: Bearer unprice_live_1234567890
```

Example request:

```bash theme={null}
curl -X GET "https://api.unprice.dev/v1/plan-versions/get/{planVersionId}" \
  -H "Authorization: Bearer unprice_live_1234567890" \
  -H "Content-Type: application/json"
```

## Security Best Practices

Never expose your API key in client-side code or include it in public repositories. For frontend applications, always use a backend server to proxy requests to the Unprice API.

## Authentication Errors

If your authentication fails, you'll receive a 401 Unauthorized or 403 Forbidden response with an error message:

```json theme={null}
{
  "meta": {
    "requestId": "req_abc123xyz789"
  },
  "error": {
    "title": "Unauthorized",
    "detail": "The provided API key is invalid or has been revoked",
    "status": 401,
    "type": "https://unprice.dev/docs/errors/unauthorized"
  }
}
```

Common authentication issues include:

* Missing the Authorization header
* Invalid key format
* Revoked or expired API key
