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

# Auth

All Adaline API requests and SDK calls require authentication via a **Bearer token** (API key).

## Getting Your API Key

1. Log in to the [Adaline Dashboard](https://app.adaline.ai)
2. Follow the steps to [Create API Keys](/docs/admin/create-api-keys).

## Using Your API Key

### REST API

Include your API key in the `Authorization` header as a Bearer token:

```bash theme={null}
curl -X GET "https://api.adaline.ai/v2/some-endpoint" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### TypeScript SDK

The SDK reads from the `ADALINE_API_KEY` environment variable by default:

```bash theme={null}
export ADALINE_API_KEY=your-api-key
```

```typescript theme={null}
import { Adaline } from "@adaline/client";

// Reads ADALINE_API_KEY automatically
const adaline = new Adaline();

// Or pass it explicitly
const adaline = new Adaline({ apiKey: "your-api-key" });
```

### Python SDK

```bash theme={null}
export ADALINE_API_KEY=your-api-key
```

```python theme={null}
from adaline.main import Adaline

# Reads ADALINE_API_KEY automatically
adaline = Adaline()

# Or pass it explicitly
adaline = Adaline(api_key="your-api-key")
```

## Error Responses

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

```json theme={null}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key."
  }
}
```

Common causes:

* Missing `Authorization` header
* Malformed token (missing `Bearer` prefix)
* Expired or revoked API key
* Key does not have permission for the requested resource
