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

# Lehar Developer Docs

> Integrate Lehar voice and WhatsApp AI agents into your product with REST APIs, sessions, campaigns, and webhooks.

Lehar gives your product programmable AI agents for **web voice**, **outbound phone calls**, and **WhatsApp** — plus bulk **campaigns** and post-call analytics. Create and publish an agent, start sessions or campaigns from your backend, and receive results through webhooks.

<Note>
  Use your `X-API-KEY` only from trusted server-side code. Never ship a workspace API key in browser or mobile source.
</Note>

## Choose your path

<CardGroup cols={3}>
  <Card title="Backend / API" icon="code" href="/api-reference/introduction">
    Create agents, start sessions, run campaigns, receive webhooks, and query history.
  </Card>

  <Card title="Browser voice" icon="microphone" href="/get-started/quickstart">
    Start a web voice session and connect a browser participant with a session token.
  </Card>

  <Card title="Dashboard" icon="gauge-high" href="/get-started/platform">
    Create assistants, knowledge bases, and campaigns without writing code first.
  </Card>
</CardGroup>

## 5-minute integration path

<Steps>
  <Step title="Get an API key">
    In the dashboard, open **Settings → API keys** and create a key. Send it on every request as `X-API-KEY`.
  </Step>

  <Step title="Check workspace access">
    Call `GET /workspace` to verify the key, workspace, and scopes.
  </Step>

  <Step title="Pick an agent">
    Call `GET /agent/all` and choose a **published** agent for your channel.
  </Step>

  <Step title="Start a session">
    Call `POST /sessions` with the agent, participant, and any `custom_variables` your prompt uses.
  </Step>

  <Step title="Connect & process results">
    Connect the returned `participant_token` to the media room, then use webhooks or `GET /sessions` for results.
  </Step>
</Steps>

## Copy-paste starter

<CodeGroup>
  ```bash cURL theme={null}
  export LEHAR_BASE_URL="https://api.lehar.ai/ca/api/v0"
  export LEHAR_API_KEY="lk_live_your_key"

  curl "$LEHAR_BASE_URL/agent/all" \
    -H "X-API-KEY: $LEHAR_API_KEY"
  ```

  ```js Node.js theme={null}
  const BASE = "https://api.lehar.ai/ca/api/v0";
  const res = await fetch(`${BASE}/agent/all`, {
    headers: { "X-API-KEY": process.env.LEHAR_API_KEY },
  });
  console.log(await res.json());
  ```
</CodeGroup>

## API basics

| Concern             | What to use                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------- |
| Base URL            | `https://api.lehar.ai/ca/api/v0`                                                                          |
| Authentication      | `X-API-KEY: lk_live_…` (server) or `Authorization: Bearer …` (login session)                              |
| Request body        | JSON; `multipart/form-data` for recipient CSV upload                                                      |
| Phone numbers       | E.164, e.g. `+919876543210`                                                                               |
| One outbound call   | `POST /calls` — API key only, no login. See [Calls](/concepts/calls)                                      |
| Dynamic prompt data | `custom_variables`, referenced in prompts as `{{variable_name}}`                                          |
| Async results       | [Outbound webhooks](/guides/webhooks#outbound-webhooks) for production; list endpoints for reconciliation |

## Design for production

* Keep API keys in server secrets; rotate on team changes.
* Store Lehar IDs: `agent_id`, `session_id`, `campaign_id`.
* **Outbound phone calls** use `POST /calls` with an API key. **Web sessions** (`POST /sessions`) need a bearer login session instead — see [Authentication](/api-reference/authentication).
* Register an [outbound webhook](/guides/webhooks#outbound-webhooks) rather than polling; make the handler idempotent on `event_id` and return `2xx` quickly.

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/get-started/quickstart">Make your first session.</Card>
  <Card title="Authentication" icon="key" href="/api-reference/authentication">API keys, bearer sessions, scopes.</Card>
  <Card title="Platform" icon="diagram-project" href="/get-started/platform">How the pieces fit together.</Card>
  <Card title="API Reference" icon="book" href="/api-reference/introduction">Resources, errors, pagination.</Card>
</CardGroup>
