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

# Authentication

> Authenticate your API requests with Bearer tokens

The Alta API uses **Bearer token** authentication. Every request must include a valid API token in the `Authorization` header.

## Generating a token

Generate an API token from the Alta dashboard under **User Profile > API tokens**.

## Making authenticated requests

Include the token in the `Authorization` header:

```bash theme={null}
curl https://api.altahq.com/v1/campaigns \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Multi-account users

If your user has access to multiple accounts, you must include the `x-account-id` header to specify which account to use:

```bash theme={null}
curl https://api.altahq.com/v1/campaigns \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "x-account-id: YOUR_ACCOUNT_ID"
```

If you have access to only one account, this header is optional - the API uses your account automatically.

## Error responses

If authentication fails, the API returns a `401 Unauthorized` response:

```json theme={null}
{
  "error": "Unauthorized",
  "message": "Invalid API token"
}
```

Common causes:

* Missing `Authorization` header
* Invalid or expired token
* Using a non-Bearer authorization type
* Missing `x-account-id` header for multi-account users
