> ## 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
```

## Getting a key

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

<Steps>
  <Step title="Request a code">
    ```bash theme={null}
    POST /v1/auth/otp   { "email": "you@example.com" }
    ```
  </Step>

  <Step title="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 sign-up credit.
  </Step>
</Steps>

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

<CodeGroup>
  ```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}
  ```
</CodeGroup>

<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.
</Warning>

## Using the key

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

  ```javascript theme={null}
  import { AgentLineClient } from "agentline";
  const client = new AgentLineClient({ apiKey: "al_live_..." });
  ```

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