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

# Billing & Credits

> How usage becomes credits, and how to read your balance and ledger.

Billing is **usage-based** and denominated in **credits**. A voice call is charged as a flat **per-minute** line; WhatsApp is charged **per message**. You read your balance and history from two customer endpoints.

<Warning>
  **A negative credit balance blocks new work.** Credit enforcement is on by default: starting a new session, campaign dial, single call, inbound answer, or agent-test run while your balance is **below zero** is rejected with `402 insufficient_credits`. A balance of exactly **0 is allowed** — the call that takes you negative still runs — and a call already in progress is **never** interrupted: live calls and open conversations always finish.
</Warning>

## How a voice call is priced

Every voice call — outbound phone, inbound phone, or web — is charged as a single flat line, **`voice_billing_minutes`**, priced per **call type** (`outbound_phone`, `inbound_phone`, `web`). Billed time is rounded **up to the next minute**, so a 90-second call bills as two minutes.

## WhatsApp

WhatsApp is billed **per message**, priced by conversation **category** — `marketing`, `utility`, `authentication`, or `service`. Any model used to generate a reply is billed with it. Billing is idempotent per message, so a retried send is never charged twice.

## Credits & ledger

Your **credit balance** is the running sum of your ledger. Entries are signed:

| Entry type         | Sign | Source                                      |
| ------------------ | ---- | ------------------------------------------- |
| `grant` / `refund` | +    | Credit added to your account                |
| `adjustment`       | ±    | Manual correction — may add or deduct       |
| `debit`            | −    | Charged for a call, session, or message     |
| `reversal`         | +    | Reverses a debit when a charge is corrected |

Charging is **idempotent** — a call is charged once. If a charge is later corrected, the prior debit is reversed and re-applied, never added on top.

## Read your usage

| Method | Path                          | Scope                           |
| ------ | ----------------------------- | ------------------------------- |
| GET    | `/billing/me/summary?from&to` | `billing:read` (customer admin) |
| GET    | `/billing/me/ledger?from&to`  | `billing:read` (customer admin) |

`me/summary` returns your credit totals for the period — `credits_granted`, `credits_used`, `credits_balance` — plus a usage `breakdown`. `me/ledger` returns your signed entries with a running `balance_after`.

```bash theme={null}
curl "$LEHAR_BASE_URL/billing/me/summary" -H "Authorization: Bearer $LEHAR_LOGIN_TOKEN"
```

<Note>
  These endpoints require a **customer-admin bearer session** and report credits only.
</Note>
