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

# Quickstart

> Create an agent, buy a number, and make your first call.

# Quickstart

## 1. Get an API key

AgentLine uses email one-time codes for sign-up and sign-in (no dashboard
required).

<CodeGroup>
  ```bash Request a code theme={null}
  curl -X POST https://api.agentline.cloud/v1/auth/otp \
    -H "Content-Type: application/json" \
    -d '{"email": "you@example.com"}'
  ```

  ```bash Verify and get a key theme={null}
  curl -X POST https://api.agentline.cloud/v1/auth/verify \
    -H "Content-Type: application/json" \
    -d '{"email": "you@example.com", "otp": "123456"}'
  ```
</CodeGroup>

The verify response returns `api_key` (shown once â€” store it). New accounts
get a sign-up credit to start.

## 2. Call the API

Python is published as `agentline-ai`. The Node package is not on npm yet, so
the JavaScript example uses `fetch`.

<CodeGroup>
  ```python theme={null}
  from agentline_ai import AgentLine

  client = AgentLine(api_key="al_live_...")

  agent = client.agents.create(
      name="Support Bot",
      system_prompt="You are a helpful assistant.",
      initial_greeting="Hello! How can I help?",
  )
  client.numbers.buy(agent_id=agent.id, country="US", area_code="415")
  call = client.calls.create(agent_id=agent.id, to_number="+12125557890")

  print("Call started:", call.id)
  ```

  ```javascript theme={null}
  const headers = {
    Authorization: "Bearer al_live_...",
    "Content-Type": "application/json",
  };

  const agent = await fetch("https://api.agentline.cloud/v1/agents", {
    method: "POST",
    headers,
    body: JSON.stringify({
      name: "Support Bot",
      system_prompt: "You are a helpful assistant.",
      initial_greeting: "Hello! How can I help?",
    }),
  }).then((res) => res.json());

  await fetch("https://api.agentline.cloud/v1/numbers", {
    method: "POST",
    headers,
    body: JSON.stringify({ agent_id: agent.id, country: "US", area_code: "415" }),
  });

  const call = await fetch("https://api.agentline.cloud/v1/calls", {
    method: "POST",
    headers,
    body: JSON.stringify({ agent_id: agent.id, to_number: "+12125557890" }),
  }).then((res) => res.json());

  console.log("Call started:", call.id);
  ```
</CodeGroup>

## 3. Install live event delivery

If the agent has terminal access, download and install the persistent relay:

```bash theme={null}
curl -fsSL https://api.agentline.cloud/static/agentline_relay.py -o agentline_relay.py
python agentline_relay.py install --agent-id agt_xxx
```

The installer detects Hermes, OpenClaw, Claude Code, or Codex, preserves one
runtime session per phone call, reconnects automatically, and installs a user
service. Runtime package/service installation may require one safety approval.
Use a [webhook](/guides/webhooks) if the agent cannot run a persistent process.

## 4. Get the results

Use the relay for live turns and durable event delivery. Poll the mailbox only
as a fallback, or receive non-live events via webhook.

<CodeGroup>
  ```python theme={null}
  events = client.events.poll()
  ```

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

<Tip>
  All phone numbers are E.164 format, e.g. `+12125557890`. Numbers are US only
  and cost \$2.00/month per number. Each agent can have one active number at a time.
</Tip>

Next: read [Authentication](/authentication) and the [Agents guide](/guides/agents).
