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

# Authentication

> Authenticate API requests with your API key

## API Keys

All API requests require a Bearer token in the `Authorization` header.

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

API keys are prefixed with `rapi_live_` and are generated when you create your account or from the [dashboard](https://rapportapi.com/home).

## Getting your API key

1. [Sign up](https://rapportapi.com/auth/sign-up) or [log in](https://rapportapi.com/auth/sign-in)
2. Navigate to your dashboard
3. Your API key is displayed in the API settings section

<Warning>
  **Keep your API key secret.** Don't commit it to version control or expose it in client-side code. Use environment variables instead.
</Warning>

## Example request

```bash theme={null}
curl https://api.rapportapi.com/research/TASK_ID \
  -H "Authorization: Bearer rapi_live_a1b2c3d4e5f6..."
```

## Error responses

| Status | Error                        | Cause                                |
| ------ | ---------------------------- | ------------------------------------ |
| `401`  | Missing Authorization header | No `Authorization` header in request |
| `401`  | Invalid API key format       | Key doesn't start with `rapi_live_`  |
| `401`  | Invalid or inactive API key  | Key not found or has been revoked    |
| `402`  | Insufficient credits         | Account has no remaining credits     |

**Example error response:**

```json theme={null}
{
  "detail": "Insufficient credits. Please purchase more at rapportapi.com.",
  "status_code": 402
}
```

## Security best practices

* Store API keys in environment variables, never in code
* Rotate keys periodically from the dashboard
* Use separate keys for development and production if needed
* Monitor your usage in the dashboard to detect unexpected activity
