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

# Authentication

> Every request uses a Bearer API key (al_live_...).

# Authentication

AgentLine uses **Bearer API keys**. Every authenticated request needs:

```
Authorization: Bearer al_live_xxxxxxxxxxxx
```

Keys use the `al_live_...` prefix. Legacy keys prefixed `sk_live_...` still work.

## Getting a key

Sign-up and sign-in use the same email one-time-code flow:

**1. Request a code**

```bash theme={null}
POST /v1/auth/otp   { "email": "you@example.com" }
```

**2. Verify the code to mint a key**

```bash theme={null}
POST /v1/auth/verify { "email": "...", "otp": "123456" }
```

Returns `api_key` (plaintext, **shown once**) plus your `account_id` and
balance. New emails auto-create an account with a \$0 balance. Use a plan
allowance or add wallet credit before buying a number; insufficient funds return `402`
`insufficient_balance` with top-up instructions.

The same email always resolves to the same account â€” an agent that signs up
and a human who later signs in land on the identical account.

## Managing keys

```bash Mint another key theme={null}
POST /v1/auth/keys
```

```bash List keys theme={null}
GET /v1/auth/keys
```

```bash Revoke a key theme={null}
DELETE /v1/auth/keys/{key_id}
```

> [!WARNING]
>
> You can't revoke the key currently authenticating a request. Use a second
> active key, then revoke the old one. Keys are bcrypt-hashed at rest.

## Using the key

```python theme={null}
from agentline_ai import AgentLine
client = AgentLine(api_key="al_live_...")
```

```javascript theme={null}
const res = await fetch("https://api.agentline.cloud/v1/agents", {
  headers: { Authorization: "Bearer al_live_..." },
});
```

```bash theme={null}
curl https://api.agentline.cloud/v1/agents \
  -H "Authorization: Bearer al_live_..."
```

## MCP

MCP clients use the same Bearer key against
`https://api.agentline.cloud/mcp` via `mcp-remote`. See [MCP](https://docs.agentline.cloud/guides/mcp.md).


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