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

# Authentication

> Authorize requests with a scoped API key and select the program for operational endpoints.

> [!NOTE]
>
> The API is a premium feature that's only available to users who have an active
> Business Plan. [See Pricing Page](https://referly.so/pricing)

Create a key in **Settings → Advanced → API Keys → Generate New Key**. Choose **Full access**, **Read only**, or **Custom permissions**, optionally set an expiry, then generate and copy the key.

```bash theme={null}
curl https://www.referly.so/api/v1/programs \
  -H "Authorization: Bearer $REFERLY_API_KEY"
```

Each endpoint lists its required scope. Read and write permissions are independent; full access uses `*`. Existing keys retain their access. Expired, revoked and deleted keys are rejected. Account and agency API access restrictions still apply.

Requests default to the key's original program. Operational endpoints accept `X-Program-Id` for a program provisioned by that exact key. This does not grant account-wide access. Legacy affiliate, referral, sale, link, coupon and promotional-code endpoints continue to use their usual program key.

See [authentication and permissions](https://www.referly.so/docs/developer-documentation/api/authentication.md) for all scopes, expiry, program selection and rotation, and [common API rules](https://www.referly.so/docs/developer-documentation/api/overview.md) for pagination, retries and errors.

> [!WARNING]
>
> Keep API keys on your server. Do not put them in frontend code, public repositories or query strings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.