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

# Authentication

> How to authenticate with the OnlyTraffic Studio API.

## API Key

All requests require the `X-API-Key` header.

<Steps>
  <Step title="Get your key">
    Go to [studio.onlytraffic.com/api](https://studio.onlytraffic.com/api) and create an API key.
  </Step>

  <Step title="Add the header">
    Include the key in every request:

    ```text theme={null}
    X-API-Key: your-api-key-here
    ```
  </Step>
</Steps>

## Base URL

```text theme={null}
https://studio-api.onlytraffic.com/api/external/v1
```

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://studio-api.onlytraffic.com/api/external/v1/subscribers \
    -H "X-API-Key: your-api-key-here"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://studio-api.onlytraffic.com/api/external/v1/subscribers",
      headers={"X-API-Key": "your-api-key-here"}
  )
  data = response.json()
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://studio-api.onlytraffic.com/api/external/v1/subscribers",
    { headers: { "X-API-Key": "your-api-key-here" } }
  );
  const data = await response.json();
  ```
</CodeGroup>

## Rate Limits

Limits are tiered and applied per API key. See [Rate Limits](/api/introduction#rate-limits) on the Introduction page for tiers, response headers, and the `429` error envelope.

## Errors

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    | Error                 | Message                      |
    | --------------------- | ---------------------------- |
    | `missing_api_key`     | X-API-Key header is required |
    | `invalid_credentials` | Invalid or inactive API key  |
  </Accordion>

  <Accordion title="403 Forbidden">
    | Error           | Message                       |
    | --------------- | ----------------------------- |
    | `access_denied` | Access denied to this account |
  </Accordion>

  <Accordion title="429 Rate Limit">
    | Error                 | Message           |
    | --------------------- | ----------------- |
    | `rate_limit_exceeded` | Too many requests |
  </Accordion>
</AccordionGroup>
