> ## 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 Partners API.

## API key

All requests require the `Authorization` header.

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

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

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

## Base URL

```text theme={null}
https://partner.onlytraffic.com
```

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://partner.onlytraffic.com/api/marketer?do=campaigns" \
    -H "Authorization: your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{"limit": 10}'
  ```

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

  response = requests.post(
      "https://partner.onlytraffic.com/api/marketer",
      params={"do": "campaigns"},
      headers={"Authorization": "your-api-key-here"},
      json={"limit": 10}
  )
  data = response.json()
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://partner.onlytraffic.com/api/marketer?do=campaigns",
    {
      method: "POST",
      headers: {
        "Authorization": "your-api-key-here",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({ limit: 10 })
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

## Errors

All responses return HTTP `200`. Check the `status` field for the actual result.

<AccordionGroup>
  <Accordion title="422 — Invalid parameters">
    | Error code | Description                                    |
    | ---------- | ---------------------------------------------- |
    | `422`      | Request contains invalid or missing parameters |
  </Accordion>

  <Accordion title="429 — Rate limit">
    | Error code | Description                        |
    | ---------- | ---------------------------------- |
    | `429`      | Too many requests — wait and retry |
  </Accordion>
</AccordionGroup>
