# How billing works

When your card is charged, and how daily proration and the graduated price ladder compute your invoice.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

By the end of this page you can compute your own invoice from your connected accounts. The rates are on the [pricing page](/pricing). This page is the arithmetic behind them.

## When your card is charged

Zernio charges your card as you accrue usage, not once at the end of the month.

The first time accrued usage reaches a fraud-protection threshold (starting at $10), Zernio charges that amount. The threshold then doubles for next time.

So a brand-new paying customer sees one quick small charge that validates the card, and established customers see fewer, larger charges.

[Metronome](https://metronome.com) produces the invoices on top of Stripe. Each invoice is itemized by account, phone number, message, call and X API operation.

## Daily proration and the ladder

Zernio records every connected account once per UTC day. The whole connected-accounts line comes from one formula, which divides by 30 rather than by the length of the month:

```
billable_units = (sum of all account-days in the month) ÷ 30
```

Only UTC days 1 to 30 are metered, so a 31-day month still counts 30 account-days per account, and February bills slightly under a full month.

The graduated ladder then applies to that total, not to individual accounts:

- The first 10 units cost $6.
- The next 90 cost $3.
- Everything above costs $1, with no cap.

So 100 accounts × 3 days costs the same as 10 accounts × 30 days. The [calculator](/pricing/social#connected-accounts) uses this math.

## Worked example

A customer keeps 10 accounts all month. In week 2 they connect an 11th account and disconnect it in week 3.

In week 4 they connect a different 12th account for the rest of the month.

| Step | Calculation | Result |
|---|---|---|
| 1. Account-days | 10 × 30 + 7 + 7 | 314 |
| 2. Billable units | 314 ÷ 30 | 10.467 |
| 3. Band 1 | 10 units × $6.00 | $60.00 |
| 3. Band 2 | 0.467 units × $3.00 | $1.40 |
| Gross | | $61.40 |
| 4. Free credit | flat per month | −$12.00 |
| **Net invoice** | | **$49.40** |

The bill is 314 account-days run through the ladder. It is not "11 accounts" or "12 accounts". The extra accounts push the total past 10 units, so their fraction is priced at the $3 band.

## The $12 monthly credit

Each calendar month grants $12 of credit, which covers the first 2 accounts at the $6 rate. It applies to the gross monthly total as a flat grant, not per account.

## Reproduce your invoice

`GET /v1/usage` ([Get usage](/usage/get-usage)) with a `range` returns the billed spend behind an invoice, line for line. `range=prev-cycle` is the period you were last billed for, and `cycle` is the one running now.

`GET /v1/billing` ([Get billing](/usage/get-billing)) returns the balance, credits and payment status.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: usage } = await zernio.usage.getUsage({
  query: { range: 'prev-cycle', granularity: 'total' },
});

console.log(usage.totals.total);
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

usage = client.usage.get_usage(range="prev-cycle", granularity="total")

print(usage["totals"]["total"])
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/usage?range=prev-cycle&granularity=total" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), for the month worked through above:

```json
{
  "supported": true,
  "granularity": "total",
  "days": [],
  "totals": {
    "accounts": 61.4,
    "numbers": 0,
    "calls": 0,
    "sms": 0,
    "dlc": 0,
    "xApi": 0,
    "credits": -12,
    "other": 0,
    "total": 49.4
  },
  "lineItems": [
    { "name": "Connected Social Accounts", "product": "accounts", "totalUsd": 61.4, "quantity": 10.467 }
  ],
  "peaks": { "accounts": 12, "numbers": 0 },
  "period": { "start": "2026-08-01T00:00:00Z", "end": "2026-09-01T00:00:00Z", "source": "cycle" },
  "tax": { "taxUsd": 10.37, "ratePercent": 21, "jurisdictionLabel": "ES VAT" }
}
```

- `lineItems[].quantity` is the 10.467 billable units.
- `totals.accounts` is the $61.40 gross, `totals.credits` the $12 credit as a negative amount, and `totals.total` the $49.40 net.
- `peaks.accounts` is the highest account count in the window. A dashboard shows it, but you do not pay for it.
- `tax` is estimated on the net total and charged on top, so the card sees $59.77.

`totals` also splits spend in USD per product family: `accounts`, `numbers`, `imessage`, `calls`, `sms`, `messages`, `verify`, `dlc`, `xApi`, `ads`, `credits` and `other`.

`granularity=day` (the default) fills `days[]` with one row per UTC day, and `groupBy=profile` adds a per-profile `attribution` breakdown that sums to `totals` exactly.

Without `range`, `granularity`, `from`, `to` or `groupBy`, the same path returns the plan and quota snapshot instead.

## Common questions

- **What window does Zernio measure?** The calendar month. Account-days accumulate over UTC days 1 to 30, then a new period starts on the 1st.
- **If I disconnect and reconnect an account, does it count twice?** Each connected day counts once. Connected 10 days, off for 5, then 10 more is 20 account-days.
- **What if I connect an account mid-month?** It bills from that day, at one thirtieth of the band rate per day connected.
- **Which accounts pay $6 and which $3?** None in particular. The rate follows the total: 12.5 units bill the first 10 at $6 and the other 2.5 at $3.
- **What if there is no card?** Paid actions return `402`. See [payment method required](/pricing/payment-method-required).

## If it fails

A `400` from `GET /v1/usage` means a query parameter is invalid. `range=custom` needs both `from` and `to`:

```json
{
  "error": "range=custom requires from and to",
  "type": "invalid_request_error",
  "code": "missing_required_field",
  "param": "from"
}
```

Send both as UTC dates, at most 366 days apart.

## Related

- [Pricing](/pricing): the rates, the free credit and the calculator.
- [Get usage](/usage/get-usage): every metering parameter and response field.
- [Get billing](/usage/get-billing): balance, credits, caps and payment status.
- [Build a platform](/multi-tenant): what each of your customers costs you.