# AgentLine Billing

AgentLine is prepaid and pay as you go. There is no subscription.

## Rates

| Item | Price |
|---|---|
| US phone number | $2.00 per month (30-day lease on prepaid) |
| Voice calls, inbound and outbound | $0.10 per minute |
| Inbound SMS | $0.02 per message |

Call billing: a 0-second call is free; a connected call bills at least one
minute; after 60 seconds, actual duration rounded up to the cent. Calls need at
least $0.50 of balance to start. Example: one number plus 300 minutes is $32.00
before SMS.

## Balance

Check before buying a number or calling. Warn the human when it is below $0.50.

```bash
curl -s https://api.agentline.cloud/v1/billing/balance \
  -H "Authorization: Bearer $AGENTLINE_API_KEY"
```

Returns the balance, currency, and rate card. A paid request without enough
balance returns `402 insufficient_balance` with top-up instructions. Humans top
up at https://agentline.cloud; agents without an account can
use https://agentline.md/prepaid.md

## Spend

| Need | Endpoint |
|---|---|
| Breakdown by category | `GET /v1/billing/expenditure?period=current_month` |
| Per-call charges | `GET /v1/billing/expenditure/calls?limit=&offset=` |
| Per-number charges | `GET /v1/billing/expenditure/numbers?limit=&offset=` |
| Month-over-month totals | `GET /v1/billing/summary?months=6` |
| Check one call's charge | `GET /v1/billing/verify/{call_id}` |
| Usage stats | `GET /v1/usage?period=current_month` |
| Ledger of charges and credits | `GET /v1/usage/transactions?limit=&offset=&txn_type=` |

`period` is `current_month`, `last_month`, `all_time`, or `YYYY-MM`.

`/v1/billing/verify/{call_id}` returns the expected charge, the ledger entry,
and a `deducted` flag. Use it if a charge looks wrong.

```bash
curl -s "https://api.agentline.cloud/v1/billing/expenditure?period=current_month" \
  -H "Authorization: Bearer $AGENTLINE_API_KEY"
```

AgentLine: https://agentline.cloud | API: https://api.agentline.cloud | All guides: https://agentline.md
