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

# Billing Transactions

> The workspace's billing history as a statement: every change to the credit balance in
the window, newest first, and the window's opening and closing balance. Required scope
`billing:read`.

Top-ups, credits given by Yappr, refunds, adjustments and phone numbers come back one
by one. Usage comes back as one row per day per product (`voice_call`, `eval_run`),
with `count` saying how many charges it holds. Days are the workspace's clock (set with
`timezone` on PUT /call-windows) unless `timezone` names another — the clock
`GET /billing/consumption` reads by default too, so for the same `from`, `to` and
`timezone` a month's usage rows add up to its `voice_call` and `eval_run` totals there.

`summary` always adds up: `opening_balance_cents + credits_in_cents -
credits_out_cents = closing_balance_cents`. The closing balance of a window that runs
to now is the balance now. Phone numbers are paid by card, not from the balance: they
are listed with `affects_balance: false`. `card_charges_cents` is everything charged to
the card in the window, before VAT - the paid top-ups (`card_top_ups_cents`) and the
phone numbers (`card_phone_numbers_cents`). A row that did not complete moved nothing either.

`phone_number_rent` lists each of the workspace's numbers with whether Yappr charges its
monthly rent (`included`, `reason`) and when it next renews, so a window with no
`phone_number` row says why.

Amounts are signed for you, the account holder: positive put credits in, negative took
them out. That is the opposite sign from `total_amount_cents` in
`GET /billing/consumption`, which reports charges as positive. All amounts exclude VAT.

A key limited to agents is refused with `403 API_KEY_AGENT_SCOPED`: the balance is the
whole workspace's. Its own agents' spend is in `GET /billing/consumption`.

A top-up row carries `payment`: the invoice number, and what the card was charged with
VAT, when its payment record holds them. A gift row reads `Credits from Yappr`. Any row
with an `id` can be read on its own with `GET /billing/transactions/{id}`.

`format=csv` (or `Accept: text/csv`) answers the window as the dashboard's **Export
CSV** file: the opening balance, every row oldest first with the balance it left, the
closing balance and when it was read, up to 1,000 rows. A workspace that has not set a
clock reads UTC.


Your billing history as a statement: every change to the credit balance in a window, newest first, and the balance at each end of it. It is the same history **Settings → Billing → Transaction History** shows in the dashboard.

* **Top-ups, credits from Yappr, refunds, adjustments and phone numbers** come back one row each.
* **A starting balance** — credits Yappr put on the account with no transaction behind them — comes back as one `starting_balance` row, so every credit in the balance has a line.
* **Usage** comes back as one row per day per product — `voice_call` for calls, `eval_run` for Agent Eval runs — with `count` saying how many charges the row folds. A busy day is one line, not hundreds. A call that cost nothing is not a charge, so a day's `count` can be lower than the calls Call Logs lists for it.
* **`summary`** is the window's statement, and it always adds up: `opening_balance_cents + credits_in_cents - credits_out_cents = closing_balance_cents`.
* **A top-up** carries `payment`: what the card was charged, VAT included, the VAT, and the invoice number when there is an invoice — what you need to match it to a card statement or an invoice.
* **What the card was charged** is `summary.card_charges_cents`: the window's top-ups and phone-number charges, before VAT, each part on its own field.
* **Each of your numbers** is in `phone_number_rent`, saying whether Yappr charges its monthly rent and when it next renews — so a window with no `phone_number` row says why.
* **One row** can be read on its own with [`GET /billing/transactions/{id}`](https://docs.goyappr.com/api-reference/billing/transaction), and **the whole window as a file** with `format=csv`.

```bash theme={null}
# September, as a statement
curl "https://api.goyappr.com/billing/transactions?from=2026-09-01&to=2026-09-30" \
  -H "Authorization: Bearer $YAPPR_API_KEY"
```

```json theme={null}
{
  "data": [
    {
      "id": null,
      "type": "usage",
      "product": "voice_call",
      "date": "2026-09-23",
      "created_at": "2026-09-23T19:55:12.401+00:00",
      "description": null,
      "count": 41,
      "status": "completed",
      "amount_cents": -412,
      "affects_balance": true,
      "payment": null
    },
    {
      "id": "4b1d7c3e-0c1a-4e5f-9a2b-6c7d8e9f0a1b",
      "type": "top_up",
      "product": null,
      "date": "2026-09-21",
      "created_at": "2026-09-21T08:03:44.120+00:00",
      "description": "Credits top-up",
      "count": 1,
      "status": "completed",
      "amount_cents": 5000,
      "affects_balance": true,
      "payment": { "channel": "checkout", "invoice_number": null, "receipt_number": null, "total_charged_cents": 5900, "vat_cents": 900, "currency": "usd" }
    }
  ],
  "summary": {
    "opening_balance_cents": 1210,
    "credits_in_cents": 5000,
    "credits_out_cents": 3666,
    "closing_balance_cents": 2544,
    "card_charges_cents": 6000,
    "card_top_ups_cents": 5000,
    "card_phone_numbers_cents": 1000
  },
  "balance_cents": 2544,
  "as_of": "2026-09-30T23:59:59.999999+00:00",
  "has_more": false,
  "next_cursor": null,
  "range": { "from": "2026-08-31T21:00:00.000Z", "to": "2026-09-30T20:59:59.999999Z", "timezone": "Asia/Jerusalem" },
  "phone_number_rent": [
    { "phone_number_id": "c0ffee00-0000-4000-8000-000000000001", "phone_number": "+972501234567", "provider": "telnyx", "included": false, "reason": null, "monthly_price_cents": 1000, "last_charged_at": "2026-09-18T09:31:00Z", "next_renewal_at": "2026-10-18T09:30:00.000Z" },
    { "phone_number_id": "c0ffee00-0000-4000-8000-000000000003", "phone_number": "+972501234569", "provider": "telnyx", "included": true, "reason": "no_subscription", "monthly_price_cents": null, "last_charged_at": null, "next_renewal_at": null }
  ]
}
```

## Row types

| `type` | What it is | Moves the balance |
| - | - | - |
| `top_up` | Credits you paid for. | Yes, in. |
| `gift` | Credits Yappr added with no payment behind them. Its `description` is always `Credits from Yappr`. | Yes, in. |
| `usage` | Calls (`product: voice_call`) or Agent Eval runs (`product: eval_run`), one row per day each. | Yes, out. |
| `refund` | A top-up that was refunded or disputed: its credits come back out. | Yes, out. |
| `adjustment` | A manual correction by Yappr, in either direction. | Yes. |
| `phone_number` | A number's first charge or monthly renewal. | No — paid by card. |
| `starting_balance` | Credits Yappr put on the account with no transaction behind them. | Yes, in (or out, if it is negative). |
| `other` | Anything newer than this list. | When `affects_balance` says so. |

Usage and `starting_balance` rows have no `id`: a usage row folds a day of charges, and a starting balance has no transaction behind it. `description` is `null` on usage and `starting_balance` rows — the dashboard and the file name them from their `type` (see [As a file](#as-a-file)); on every other row it is the description the billing system wrote for it, such as `Credits top-up` or `Auto top-up`.

`affects_balance` is on every row: `false` for a phone number and for a row whose `status` is not `completed` or `in_progress` (a top-up whose payment failed, say).

## What the card was charged

`summary.card_charges_cents` is everything charged to the card in the window, before VAT: `card_top_ups_cents` (the credits the window's paid top-ups bought — every one, even when `has_more` cut rows from the list) plus `card_phone_numbers_cents` (numbers' first charges and monthly renewals, which are paid by card and never move the balance). The VAT on a top-up is in its `payment`. Until 1 October 2026 `card_charges_cents` counted the phone numbers only; that figure is now `card_phone_numbers_cents`.

## Phone numbers and their rent

`phone_number_rent` lists every number the workspace has now, with whether Yappr charges its monthly rent — the same `rent` and `next_renewal_at` [`GET /phone-numbers`](https://docs.goyappr.com/api-reference/phone-numbers/list) returns:

| Field | What it is |
| - | - |
| `included` | `false` when a rent was charged for the number in the last 40 days; `true` when none was, and no `phone_number` rows are coming for it. |
| `reason` | Why it is included: `own_carrier` — a number in your own Telnyx account, whose rent Telnyx bills you; `not_charged` — a monthly subscription is on record but has charged nothing in the last 40 days; `no_subscription` — a Yappr number with no subscription (one Yappr set up for you). `null` when the rent is charged. |
| `monthly_price_cents` | The monthly rent, before VAT. `null` when included. |
| `last_charged_at` | The newest rent charge in the last 40 days, or `null`. |
| `next_renewal_at` | When the rent next renews: monthly, on the day and time the subscription started (the last day of a shorter month). The card is charged then, and its row appears when the payment lands. `null` when included, and for a number whose [release](https://docs.goyappr.com/api-reference/phone-numbers/release.md) is scheduled: it does not renew. |

A number whose rent is charged has a `phone_number` row for each renewal; a number that is `included` has none in the last 40 days. If the rent cannot be read the statement answers `500` rather than calling a number included.

## Matching a top-up to your card statement or invoice

`amount_cents` on a top-up is the credits it put in, before VAT. Its `payment` says what was actually paid:

| Field | What it is |
| - | - |
| `channel` | How it was paid: `checkout` (on the payment page, from **Billing** or [`POST /billing/topup`](https://docs.goyappr.com/api-reference/billing/topup)), `auto_top_up` (charged automatically when the balance ran low), or `saved_card` (charged to the saved card on request, as top-ups were for a while). `null` when the payment record does not say. |
| `total_charged_cents` | What the card was charged, VAT included — the amount on your card statement, on the row's `date`. |
| `vat_cents` | The VAT in that total. `null` when the VAT was not recorded, even where the total was; `0` only when it was recorded as 0 (a top-up paid before VAT applied). |
| `invoice_number` | The number printed on the invoice for this top-up. Automatic top-ups are invoiced, and so were saved-card top-ups (`channel: saved_card`) while that way of paying existed; each was invoiced the moment it was charged, so the invoice is dated the row's `date`. A saved-card top-up whose invoice could not be made was charged without one, and a top-up paid at checkout has no invoice: for those this is `null`. |
| `receipt_number` | The number printed on the card receipt, when the payment record holds one; otherwise `null`. |
| `currency` | The payment's currency, lower case. |

A field the payment record does not hold is `null`: older top-ups may lack the VAT or the total, and for those the row's date and `amount_cents` are what there is to match. The payment processor's own ids are never returned — they are on nothing you hold. `payment` is `null` on every row that is not a top-up.

## One row

[`GET /billing/transactions/{id}`](https://docs.goyappr.com/api-reference/billing/transaction) reads one row by its `id` — the same shape as in the list, with `timezone`. Usage and `starting_balance` rows have no `id`: a day folds many charges, and one call's cost is on [`GET /calls/{id}`](https://docs.goyappr.com/api-reference/calls/get). A call's id is not a transaction id; asked for one, the answer says so.

## As a file

`format=csv` answers the window as the file **Export CSV** gives in the dashboard, under the same name — `transactions-<first day>_<last day>-<day read>.csv`, the window's days on the statement's clock and the day it was read (the dashboard's **All time** is `transactions-all-time-<day read>.csv`). `Accept: text/csv` with no `format` does the same. The file is a byte-order mark, then a header line, the opening balance, every row oldest first with the balance it left, the closing balance, and when it was read; every line, the last one included, ends with a newline. The balances are in `Balance after (credits)` and `Balance after (USD)` — never in `Amount (USD)` — so a sum of `Amount (USD)` is the window's movement. The file holds up to 1,000 rows (`limit` can lower that, and a higher one is refused). A window with more is cut to its newest rows: the file then opens with **Balance before the first row listed** rather than the window's opening balance, dated at that first listed row rather than at the window's start, so every balance follows from the line above it; the line after the opening balance says the file was cut, and its name ends in `-partial` (`transactions-2026-07-01_2026-09-30-2026-09-30-partial.csv`).

```bash theme={null}
curl "https://api.goyappr.com/billing/transactions?from=2026-07-01&to=2026-09-30&format=csv" \
  -H "Authorization: Bearer $YAPPR_API_KEY" -o q3-statement.csv
```

Saved as `transactions-2026-07-01_2026-09-30-2026-09-30.csv`:

```csv theme={null}
"Date","Description","Type","Status","Amount (USD)","Credits","Balance after (credits)","ID","Balance after (USD)","Card charged (USD)","VAT (USD)","Paid via","Invoice number","Calls"
"2026-07-01","Opening balance","","","","","1210","","12.10","","","","",""
"2026-09-21","Credits top-up","Top-up","Completed","50.00","5000","6210","4b1d7c3e-0c1a-4e5f-9a2b-6c7d8e9f0a1b","62.10","59.00","9.00","Checkout","",""
"2026-09-23","41 charged calls","Usage","Completed","-4.12","-412","5798","2026-09-23:voice_call","57.98","","","","","https://api.goyappr.com/calls/export?from=2026-09-22T21:00:00.000Z&to=2026-09-23T20:59:59.999Z"
"2026-09-30","Closing balance","","","","","5798","","57.98","","","","",""
"","Figures as of 2026-09-30 23:59 Asia/Jerusalem","","","","","","","","","","","",""
```

`ID` is the row's `id` in the JSON, so two same-day top-ups of the same amount can each be joined to their `payment`. A usage row has no id, so its `ID` is its day key — `<date>:<product>`, such as `2026-09-23:voice_call` — which is not a transaction id; a starting balance's is empty. `Credits` is empty on a row that did not move the balance (a phone number, paid by card). A top-up's line carries its `payment`: `Card charged (USD)` (VAT included), `VAT (USD)` (empty when not recorded), `Paid via` (`Checkout`, `Automatic top-up` or `Saved card`) and `Invoice number`. `Calls` on a day of calls is that day's [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export), from its first to its last moment on the statement's clock. It is an API link: opening it needs your key in the `Authorization` header, as every API call does, so a browser opening it bare is answered `401 MISSING_KEY`. The dashboard's **Export CSV** links each day to that day in the dashboard's **Call Logs** instead, which the reader opens signed in.

The file names each row in words rather than codes:

| Column | What it holds |
| - | - |
| `Type` | `Top-up`, `Credits from Yappr` (a gift), `Usage`, `Refund`, `Adjustment`, `Phone number`, `Starting balance` or `Other` — the row's `type`. |
| `Status` | `Completed`, `Today so far` (today's usage, still adding up), `Pending`, `Failed` or `Refunded`. |
| `Description` | The billing system's description of a top-up, refund, adjustment or phone number — `Credits top-up` for one you made yourself, `Auto top-up` for one made automatically when the balance ran low — `Credits from Yappr` for a gift, `Balance set by Yappr, with no transaction behind it` for a starting balance, and `41 charged calls` or `4 Agent Eval runs` for a day's usage. |

## The starting balance

The ledger does not say when a starting balance was set, so its row is dated when the workspace's credit account was opened (or at its first transaction, if that is earlier). Before that date the balance is 0: a window that ends before it opens and closes at 0 with no rows, and a window that holds it counts it in `credits_in_cents`. All time therefore opens at 0, and the starting balance is its first line. A workspace whose transactions explain its whole balance has no such row.

## Today's row

Usage for today — the current day on the statement's clock — comes back with `status: "in_progress"`: the day is still running, so its `amount_cents` and `count` can still grow. Every earlier day is `completed`. `as_of` says when the statement was read.

## From a row to its charges

A usage row is a day on the statement's clock, `range.timezone`. To read that day's calls one by one with [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list), or export them with [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export), send the day's first and last moment with that clock's offset on the day. For a row dated `2026-09-12` in an `Asia/Jerusalem` workspace that is `from=2026-09-12T00:00:00%2B03:00&to=2026-09-12T23:59:59.999999%2B03:00`. Those endpoints read a date on its own as a UTC day, so `from=2026-09-12&to=2026-09-12` there would be 3 hours off the row. A statement read with `timezone=UTC` has UTC days, and plain dates line up with it.

The calls still do not add up to the row one for one. The list holds every call that started that day, free ones included (`cost_status: "not_charged"`), while `count` counts charges only. A call is charged when it ends, so a call that runs past midnight is on the next day's row. Agent Eval charges are on [`GET /agent-eval/runs`](https://docs.goyappr.com/api-reference/agent-eval/runs/list).

## Signs

Amounts are signed for you, the account holder: positive put credits in, negative took them out. [`GET /billing/consumption`](https://docs.goyappr.com/api-reference/billing/consumption) reports the other way round — a charge is a positive `total_amount_cents` there — because it adds up spending rather than a balance. Both are in cents, before VAT.

## Days on your clock

Days are the workspace's own — the clock set with `timezone` on [`PUT /call-windows`](https://docs.goyappr.com/api-reference/call-windows/update#the-workspaces-clock), the one the dashboard's Transaction History and [`GET /billing/consumption`](https://docs.goyappr.com/api-reference/billing/consumption) read by default. A workspace that has not set a clock reads UTC. A charge at 22:30 UTC on 30 September is **1 October** in an `Asia/Jerusalem` workspace, and its usage row is dated `2026-10-01`. A date-only `from` or `to` is a whole day on that clock; a value with a time in it means that moment, whatever the zone.

Pass `timezone` to read the statement on another clock — `timezone=UTC` gives UTC days. It is an IANA name (`Asia/Jerusalem`, `Europe/London`, `UTC`); an offset such as `+03:00` or a name the API does not know is refused with `400 TRANSACTIONS_QUERY_INVALID`. `range` in the response is the window that was read — its first and last moment as instants, and `timezone`, the clock its days are on — whatever form `from` and `to` were sent in.

A window that starts or ends inside a day gives that day's usage row only the charges inside the window: `from=2026-09-12T12:00:00Z` makes the 12th's row the afternoon's charges, still dated `2026-09-12`. Send dates to read whole days.

## Reconciling a month

`closing_balance_cents` is worked back from the balance now, so the closing balance of a window that runs to now is the balance [`GET /billing`](https://docs.goyappr.com/api-reference/billing/get-status) returns, and last month's closing balance is this month's opening one. With the same `from`, `to` and `timezone` — or none, since both follow the workspace's clock — `credits_out_cents` for a month is its usage, the `voice_call` and `eval_run` totals `GET /billing/consumption` reports for it, plus any refunded top-up, negative adjustment or negative starting balance that took credits out.

## Parameters

`to` defaults to now and `from` to 30 days before `to` — so `?to=2026-07-31` alone reads July 1 through July 31 — and a date-only `to` covers that whole day on the statement's clock. With both left out the window is the 30 × 24 hours before now, which is not the dashboard's **Last 30 days** (30 whole days on the workspace's clock, today included): to read the same days, send `from` as the date 29 days before today. With `to` left out, a `from` after now is refused. `limit` caps the rows (default 100, at most 500; a higher one is refused with `400 TRANSACTIONS_QUERY_INVALID`, naming the file) — never the summary, which always covers the whole window — and `has_more` says the list was cut short. Rows come newest first and usage is a row per day per product, so over a long window the default 100 rows can end months before its older top-ups: when `has_more: true`, those rows are not in this page, though `summary` still counts them. Follow `next_cursor` to read them (see [Reading every row](#reading-every-row)), or ask for the file (up to 1,000 rows). `cursor` is the `next_cursor` of the page before; it pages the JSON list only, and with `format=csv` it is refused. `format` is `json` (the default) or `csv`. Anything other than `from`, `to`, `limit`, `timezone`, `format` and `cursor` is refused with `400 TRANSACTIONS_QUERY_INVALID`, by name. A key [limited to some agents](https://docs.goyappr.com/api-reference/introduction.md#limiting-a-key-to-some-agents) is refused with `403 API_KEY_AGENT_SCOPED`: the balance is the whole workspace's.

## Reading every row

A page holds at most `limit` rows. When `has_more` is `true`, `next_cursor` reads the rest: send it as `cursor` with the same `from`, `to`, `timezone` and `limit` as the page that gave it, and repeat until `next_cursor` is `null`. Every row comes back once, in order — a day whose rows are split across two pages loses none of them — and every page carries the whole window's `summary`, so the rows of all the pages add up to it.

```bash theme={null}
first=$(curl -s "https://api.goyappr.com/billing/transactions?from=2026-08-01&to=2026-08-31&limit=100" \
  -H "Authorization: Bearer $YAPPR_API_KEY")
next=$(echo "$first" | jq -r '.next_cursor // empty')
curl -s "https://api.goyappr.com/billing/transactions?from=2026-08-01&to=2026-08-31&limit=100&cursor=$next" \
  -H "Authorization: Bearer $YAPPR_API_KEY"
```

The cursor keeps the window the first page read, so a window that runs to now ends where it did on the first page. It is opaque and signed with the query it was cut for: one sent with another `from`, `to`, `timezone` or `limit`, from another workspace, or edited, is refused with `400 TRANSACTIONS_CURSOR_INVALID` — read the first page again and follow its `next_cursor`. Stepping the window back by date (`to` set to the day before the last `date` returned) drops the rest of a day that the limit split, so do not page that way.


## OpenAPI

````yaml GET /billing/transactions
openapi: 3.1.0
info:
  title: Yappr API
  description: >
    Create and manage AI voice agents, purchase phone numbers, configure tools,
    and initiate calls — all via REST.
  version: 1.0.0
  contact:
    url: https://goyappr.com
servers:
  - url: https://api.goyappr.com
    description: Production
security:
  - apiKey: []
paths:
  /billing/transactions:
    get:
      tags:
        - Billing
      summary: Billing transactions
      description: >
        The workspace's billing history as a statement: every change to the
        credit balance in

        the window, newest first, and the window's opening and closing balance.
        Required scope

        `billing:read`.


        Top-ups, credits given by Yappr, refunds, adjustments and phone numbers
        come back one

        by one. Usage comes back as one row per day per product (`voice_call`,
        `eval_run`),

        with `count` saying how many charges it holds. Days are the workspace's
        clock (set with

        `timezone` on PUT /call-windows) unless `timezone` names another — the
        clock

        `GET /billing/consumption` reads by default too, so for the same `from`,
        `to` and

        `timezone` a month's usage rows add up to its `voice_call` and
        `eval_run` totals there.


        `summary` always adds up: `opening_balance_cents + credits_in_cents -

        credits_out_cents = closing_balance_cents`. The closing balance of a
        window that runs

        to now is the balance now. Phone numbers are paid by card, not from the
        balance: they

        are listed with `affects_balance: false`. `card_charges_cents` is
        everything charged to

        the card in the window, before VAT - the paid top-ups
        (`card_top_ups_cents`) and the

        phone numbers (`card_phone_numbers_cents`). A row that did not complete
        moved nothing either.


        `phone_number_rent` lists each of the workspace's numbers with whether
        Yappr charges its

        monthly rent (`included`, `reason`) and when it next renews, so a window
        with no

        `phone_number` row says why.


        Amounts are signed for you, the account holder: positive put credits in,
        negative took

        them out. That is the opposite sign from `total_amount_cents` in

        `GET /billing/consumption`, which reports charges as positive. All
        amounts exclude VAT.


        A key limited to agents is refused with `403 API_KEY_AGENT_SCOPED`: the
        balance is the

        whole workspace's. Its own agents' spend is in `GET
        /billing/consumption`.


        A top-up row carries `payment`: the invoice number, and what the card
        was charged with

        VAT, when its payment record holds them. A gift row reads `Credits from
        Yappr`. Any row

        with an `id` can be read on its own with `GET
        /billing/transactions/{id}`.


        `format=csv` (or `Accept: text/csv`) answers the window as the
        dashboard's **Export

        CSV** file: the opening balance, every row oldest first with the balance
        it left, the

        closing balance and when it was read, up to 1,000 rows. A workspace that
        has not set a

        clock reads UTC.
      operationId: listBillingTransactions
      parameters:
        - in: query
          name: from
          schema:
            type: string
            format: date-time
          description: >
            Start of the window. Defaults to 30 days before `to` (30 × 24 hours
            before now when `to` is left out as well — not the dashboard's "Last
            30 days", which is 30 whole days on the workspace's clock). A
            date-only value starts at that day's first moment on the statement's
            clock. With `to` left out, a `from` after now is 400. A window that
            starts or ends inside a day gives that day's usage row only the
            charges inside the window; send dates to read whole days.
        - in: query
          name: to
          schema:
            type: string
            format: date-time
          description: >-
            End of the window, inclusive. Defaults to now. A date-only value
            covers that whole day on the statement's clock, up to its last
            moment.
        - in: query
          name: timezone
          schema:
            type: string
            example: Asia/Jerusalem
          description: >
            The clock days and date-only windows are read on, as an IANA name.
            Defaults to the workspace's clock, like `GET /billing/consumption`;
            `timezone=UTC` reads UTC days. An offset such as `+03:00`, or a name
            the API does not know, is 400 TRANSACTIONS_QUERY_INVALID. The
            response names the clock used in `range.timezone`.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
          description: >
            Most rows to return, newest first. A bigger number is 400
            TRANSACTIONS_QUERY_INVALID. `summary` always covers the whole
            window; `has_more` says the list was cut short — over a long window
            the default can end before its older top-ups, so follow
            `next_cursor` to read them, or ask for the file. Not a whole number,
            or 0, is 400. With `format=csv` the default and the maximum are
            1,000, as in the dashboard's file; above that is 400 too.
        - in: query
          name: cursor
          schema:
            type: string
          description: >
            The `next_cursor` of the page before. Send it with the same `from`,
            `to`, `timezone` and `limit` as that page: every row of the window
            comes back once, in order, even when a page ends inside a day, and
            every page carries the whole window's `summary`. A cursor sent with
            other parameters, from another workspace, edited or built by hand is
            400 TRANSACTIONS_CURSOR_INVALID. It pages the JSON list; with
            `format=csv` it is 400 TRANSACTIONS_QUERY_INVALID.
        - in: query
          name: format
          schema:
            type: string
            enum:
              - json
              - csv
            default: json
          description: >
            `csv` answers the statement as a file, the dashboard's Export CSV
            (so does `Accept: text/csv` with no `format`). Anything else is 400
            TRANSACTIONS_QUERY_INVALID.
      responses:
        '200':
          description: >-
            The window's rows and its statement — or, with `format=csv`, the
            same statement as a file
          content:
            text/csv:
              schema:
                type: string
                description: >
                  A byte-order mark, then one quoted line each, every line
                  ending with a newline: `Date,Description,Type,Status,Amount
                  (USD),Credits,Balance after (credits),ID,Balance after
                  (USD),Card charged (USD),VAT (USD),Paid via,Invoice
                  number,Calls`; the opening balance (in the two balance
                  columns, never in Amount, so a sum of Amount is the window's
                  movement); when the window holds more rows than the file, a
                  line saying so - and the first line is then the balance before
                  the first row listed, dated at that row, so the balances
                  chain; every row oldest first with the balance after it
                  (`Credits` empty where the row did not move the balance; `ID`
                  the row's id, or a usage row's day key `<date>:<product>`; a
                  top-up's payment in the four payment columns; a day of calls'
                  `GET /calls/export` link in `Calls`); the closing balance;
                  `Figures as of YYYY-MM-DD HH:MM <clock>`. Served as an
                  attachment named `transactions-<first day>_<last day>-<day
                  read>.csv` (`…-partial.csv` when cut), the name the
                  dashboard's Export CSV gives the same window.
              example: >
                "Date","Description","Type","Status","Amount
                (USD)","Credits","Balance after (credits)","ID","Balance after
                (USD)","Card charged (USD)","VAT (USD)","Paid via","Invoice
                number","Calls"

                "2026-09-01","Opening
                balance","","","","","1210","","12.10","","","","",""

                "2026-09-21","Credits
                top-up","Top-up","Completed","50.00","5000","6210","4b1d7c3e-0c1a-4e5f-9a2b-6c7d8e9f0a1b","62.10","59.00","9.00","Checkout","",""

                "2026-09-23","41 charged
                calls","Usage","Completed","-4.12","-412","5798","2026-09-23:voice_call","57.98","","","","","https://api.goyappr.com/calls/export?from=2026-09-22T21:00:00.000Z&to=2026-09-23T20:59:59.999Z"

                "2026-09-30","Closing
                balance","","","","","5798","","57.98","","","","",""

                "","Figures as of 2026-09-30 23:59
                Asia/Jerusalem","","","","","","","","","","","",""
            application/json:
              schema:
                type: object
                required:
                  - data
                  - summary
                  - balance_cents
                  - has_more
                  - range
                  - phone_number_rent
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/BillingTransaction'
                  summary:
                    type: object
                    required:
                      - opening_balance_cents
                      - credits_in_cents
                      - credits_out_cents
                      - closing_balance_cents
                      - card_charges_cents
                      - card_top_ups_cents
                      - card_phone_numbers_cents
                    properties:
                      opening_balance_cents:
                        type: integer
                        description: >-
                          The balance at the start of the window, worked back
                          from the balance now.
                      credits_in_cents:
                        type: integer
                        description: >-
                          Credits the window's completed rows put in (top-ups,
                          credits from Yappr, positive adjustments).
                      credits_out_cents:
                        type: integer
                        description: >-
                          Credits the window's completed rows took out (usage,
                          refunded top-ups, negative adjustments), as a positive
                          number.
                      closing_balance_cents:
                        type: integer
                        description: >-
                          The balance at the end of the window. Equals opening +
                          in - out.
                      card_charges_cents:
                        type: integer
                        description: >
                          Everything charged to the card in the window, before
                          VAT: card_top_ups_cents + card_phone_numbers_cents.
                          Until 1 October 2026 it counted the phone numbers
                          only.
                      card_top_ups_cents:
                        type: integer
                        description: >-
                          The credits the window's paid top-ups bought, before
                          VAT - every one, even when has_more cut rows from
                          data.
                      card_phone_numbers_cents:
                        type: integer
                        description: >-
                          Phone numbers charged to the card in the window, net
                          of card refunds. Never part of the balance.
                  balance_cents:
                    type: integer
                    description: >-
                      The credit balance now — the same figure `GET /billing`
                      returns.
                  as_of:
                    type: string
                    format: date-time
                    description: >-
                      When the statement was read. Today's `in_progress` row,
                      and a closing balance that runs to now, are as of this
                      moment.
                  has_more:
                    type: boolean
                    description: >-
                      True when the window holds more rows than this page, so
                      its older rows — often its older top-ups — are not in
                      `data` (`summary` still counts them). Follow `next_cursor`
                      to read them.
                  next_cursor:
                    type: string
                    nullable: true
                    description: >
                      Send as `cursor`, with the same `from`, `to`, `timezone`
                      and `limit`, to read the next page; `null` on the window's
                      last page. Opaque and signed with the query it was cut
                      for.
                  range:
                    type: object
                    description: >-
                      The window that was read — as instants, whatever form
                      `from` and `to` were sent in — and its clock.
                    properties:
                      from:
                        type: string
                        format: date-time
                        description: The window's first moment.
                      to:
                        type: string
                        format: date-time
                        description: The window's last moment.
                      timezone:
                        type: string
                        description: The clock the days were read on.
                        example: Asia/Jerusalem
                  phone_number_rent:
                    type: array
                    description: >
                      Each of the workspace's numbers now, and whether Yappr
                      charges its monthly rent - the `rent` and
                      `next_renewal_at` GET /phone-numbers returns. A number
                      whose rent is included never has a phone_number row. If
                      the rent cannot be read the statement is 500, never a
                      number called included.
                    items:
                      allOf:
                        - type: object
                          properties:
                            phone_number_id:
                              type: string
                              format: uuid
                            phone_number:
                              type: string
                              nullable: true
                            provider:
                              type: string
                              nullable: true
                              enum:
                                - telnyx
                                - external
                            next_renewal_at:
                              type: string
                              format: date-time
                              nullable: true
                        - $ref: '#/components/schemas/PhoneNumberRent'
              example:
                data:
                  - id: null
                    type: usage
                    product: voice_call
                    date: '2026-09-23'
                    created_at: '2026-09-23T19:55:12.401+00:00'
                    description: null
                    count: 41
                    status: completed
                    amount_cents: -412
                    affects_balance: true
                    payment: null
                  - id: 4b1d7c3e-0c1a-4e5f-9a2b-6c7d8e9f0a1b
                    type: top_up
                    product: null
                    date: '2026-09-21'
                    created_at: '2026-09-21T08:03:44.120+00:00'
                    description: Credits top-up
                    count: 1
                    status: completed
                    amount_cents: 5000
                    affects_balance: true
                    payment:
                      channel: checkout
                      invoice_number: null
                      receipt_number: null
                      total_charged_cents: 5900
                      vat_cents: 900
                      currency: usd
                summary:
                  opening_balance_cents: 1210
                  credits_in_cents: 5000
                  credits_out_cents: 3666
                  closing_balance_cents: 2544
                  card_charges_cents: 6000
                  card_top_ups_cents: 5000
                  card_phone_numbers_cents: 1000
                balance_cents: 2544
                as_of: '2026-09-30T23:59:59.999999+00:00'
                has_more: false
                next_cursor: null
                range:
                  from: '2026-08-31T21:00:00.000Z'
                  to: '2026-09-30T20:59:59.999999Z'
                  timezone: Asia/Jerusalem
                phone_number_rent:
                  - phone_number_id: c0ffee00-0000-4000-8000-000000000001
                    phone_number: '+972501234567'
                    provider: telnyx
                    included: false
                    reason: null
                    monthly_price_cents: 1000
                    last_charged_at: '2026-09-18T09:31:00Z'
                    next_renewal_at: '2026-10-18T09:30:00.000Z'
        '400':
          description: >
            TRANSACTIONS_QUERY_INVALID — a parameter other than `from`, `to`,
            `limit`, `timezone`, `format` and `cursor`, a `cursor` with
            `format=csv`, a parameter sent twice or with no value, a `limit`
            that is not a whole number of at least 1 or is above the maximum
            (500, or 1,000 for the file), a `timezone` that is not an IANA
            timezone name, a `format` other than `json` or `csv`, a `from` /
            `to` that is not a real ISO 8601 timestamp, a `from` after `to` on
            the statement's clock (a date-only `to` ends that day on it), or a
            `from` after now with `to` left out. None of these reaches the
            database. TRANSACTIONS_CURSOR_INVALID — a `cursor` this query did
            not issue: one from a page read with another `from`, `to`,
            `timezone` or `limit`, from another workspace, or edited.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >
            INSUFFICIENT_SCOPE — the key lacks `billing:read`.
            API_KEY_AGENT_SCOPED — the key is limited to agents, and the balance
            belongs to the whole workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >
            "Failed to load the transaction history" - the statement, its
            top-ups' payments, the window's top-up total or the numbers' rent
            could not be read. Retry; nothing was changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    BillingTransaction:
      type: object
      description: >
        One row of `GET /billing/transactions`. A usage row folds one day (on
        the statement's clock) of one product's

        charges (`id` and `description` null, `count` the number of charges); a
        `starting_balance`

        row is the balance no ledger entry records (`id` and `description`
        null); every other row

        is one ledger entry (`count` 1).
      required:
        - id
        - type
        - product
        - date
        - created_at
        - description
        - count
        - status
        - amount_cents
        - affects_balance
        - payment
      properties:
        id:
          type: string
          format: uuid
          nullable: true
          description: >-
            The entry's id — the one `GET /billing/transactions/{id}` reads.
            Null on a usage row and a starting balance.
        type:
          type: string
          enum:
            - top_up
            - gift
            - usage
            - refund
            - adjustment
            - phone_number
            - starting_balance
            - other
          description: >
            `top_up` — credits you paid for. `gift` — credits Yappr added with
            no payment behind them. `usage` — calls and Agent Eval runs, one row
            per day per product. `refund` — a top-up that was refunded or
            disputed, taking its credits back out. `adjustment` — a manual
            correction by Yappr, in either direction. `phone_number` — a
            number's first charge or monthly renewal, paid by card.
            `starting_balance` — a balance Yappr set with no ledger entry behind
            it, dated when the credit account was opened (the ledger does not
            say when it was set); before it the balance is 0. `other` — anything
            newer than this list.
        product:
          type: string
          enum:
            - voice_call
            - eval_run
          nullable: true
          description: On a usage row, what was charged. Null on every other row.
        date:
          type: string
          format: date
          description: >-
            The day of the entry on the statement's clock (`range.timezone`), or
            of the charges a usage row folds.
          example: '2026-09-23'
        created_at:
          type: string
          format: date-time
          description: When the entry was recorded. On a usage row, the day's last charge.
        description:
          type: string
          nullable: true
          description: >-
            The entry's own description. Null on a usage row. A `gift` row
            always reads `Credits from Yappr`.
        count:
          type: integer
          description: >
            How many ledger entries the row stands for. 1 except on usage rows,
            where it is the number of charges: a call that cost nothing has no
            entry, so a day's `count` can be lower than the number of calls Call
            Logs shows for it.
        status:
          type: string
          enum:
            - completed
            - in_progress
            - pending
            - failed
            - refunded
          description: >
            Usage rows count completed charges only. The row for today (on the
            statement's clock) is `in_progress`: the day is still running and
            its amount can still grow. Every earlier usage row is `completed`.
        amount_cents:
          type: integer
          description: >-
            Signed for the account holder — positive put credits in, negative
            took them out (or, for a phone number, was charged to the card).
        affects_balance:
          type: boolean
          description: >-
            True when the row moved the credit balance. False for phone numbers
            (paid by card) and for a row that did not complete.
        payment:
          allOf:
            - $ref: '#/components/schemas/TransactionPayment'
          nullable: true
          description: >-
            On a `top_up` row, what the payment record holds to match it to a
            card statement or an invoice. Null on every other row.
    PhoneNumberRent:
      type: object
      required:
        - included
        - reason
        - monthly_price_cents
        - last_charged_at
      properties:
        included:
          type: boolean
          description: >
            False when a rent was charged for the number in the last 40 days
            (each renewal is a phone_number row on GET /billing/transactions);
            true when none was.
        reason:
          type: string
          nullable: true
          enum:
            - own_carrier
            - not_charged
            - no_subscription
            - phone_system
            - null
          description: >
            Why the rent is included: `own_carrier` - a number in your own
            Telnyx account, whose rent Telnyx bills you; `not_charged` - a
            monthly subscription is on record but has charged nothing in the
            last 40 days; `no_subscription` - a Yappr number with no
            subscription (one Yappr set up for you); `phone_system` - a number
            that calls out through your own phone system, which Yappr does not
            rent. Null when the rent is charged.
        monthly_price_cents:
          type: integer
          nullable: true
          description: The monthly rent before VAT, paid by card. Null when included.
        last_charged_at:
          type: string
          format: date-time
          nullable: true
          description: The newest rent charge in the last 40 days, or null.
    Error:
      type: object
      required:
        - error
        - code
      description: >
        Every error response - the secret-key API and the browser data plane
        alike - carries a

        human-readable `error` and a stable machine `code`, and a refusal that
        names what is

        wrong with the request carries `issues[]` too. Branch on `code`, never
        on the `error`

        text. A refusal that names nothing more specific carries the code its
        status means:

        `BAD_REQUEST` (400), `UNAUTHORIZED` (401, the browser data plane; the
        secret-key API

        answers `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY`), `BILLING_ERROR`
        (402),

        `FORBIDDEN` (403), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405),
        `CONFLICT` (409),

        `GONE` (410), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415),

        `UNPROCESSABLE_REQUEST` (422), `RATE_LIMIT` (429), `INTERNAL_ERROR`
        (500),

        `UPSTREAM_ERROR` (502), `SERVICE_UNAVAILABLE` (503), `UPSTREAM_TIMEOUT`
        (504). Some

        refusals add members of their own beside these (a call request's
        `status`, a workflow's

        `current_version`); the operation says which.
      properties:
        error:
          type: string
          description: The refusal, in one sentence for a person. Its wording may change.
        code:
          type: string
          description: The stable code to branch on.
        issues:
          type: array
          description: >
            Each thing at fault, on a 400 or 422 that names them: every query
            parameter or body field, not just the first. `path` is the
            parameter's name or the field's location.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                description: >-
                  query_param_unknown, query_param_repeated, query_param_blank,
                  query_param_invalid, field_unknown, field_required,
                  field_invalid, or the route's own word.
              path:
                type: string
              message:
                type: string
    TransactionPayment:
      type: object
      description: >
        What a top-up's payment record holds that you can match to your card
        statement or an

        invoice. A card line shows the day and the total charged, VAT included;
        an invoiced

        top-up also has the number printed on its invoice. The payment
        processor's own ids are

        never returned: they are on nothing you hold. A field the record does
        not hold is null —

        older top-ups may lack the VAT or the total, and a top-up paid at
        checkout has no

        invoice.
      required:
        - channel
        - invoice_number
        - receipt_number
        - total_charged_cents
        - vat_cents
        - currency
      properties:
        channel:
          type: string
          nullable: true
          enum:
            - checkout
            - auto_top_up
            - saved_card
          description: >-
            How the top-up was paid — `checkout` (paid on the payment page from
            Billing or `POST /billing/topup`), `auto_top_up` (charged
            automatically when the balance ran low), or `saved_card` (charged to
            the saved card on request, as top-ups were for a while). Null when
            the payment record does not say.
          example: auto_top_up
        receipt_number:
          type: string
          nullable: true
          description: >-
            The number printed on the card receipt for this top-up, when the
            payment record holds one; null otherwise. Never a payment processor
            id.
          example: null
        invoice_number:
          type: string
          nullable: true
          description: >-
            The number printed on the invoice for this top-up (automatic
            top-ups, and saved-card top-ups that were invoiced). Null when there
            is no invoice.
          example: A1B2C3D4-0007
        total_charged_cents:
          type: integer
          nullable: true
          description: >-
            What the card was charged, VAT included — the amount on the card
            statement. `amount_cents` on the row is the credits, before VAT.
          example: 5900
        vat_cents:
          type: integer
          nullable: true
          description: >-
            The VAT in `total_charged_cents`. Null when the VAT was not
            recorded, even if the total was; `0` only when it was recorded as 0
            (a top-up paid before VAT applied).
          example: 900
        currency:
          type: string
          description: The currency of the payment, lower case.
          example: usd
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Yappr API key (e.g. `ypr_live_...`). Generate one in the dashboard
        under **Settings → API Keys**. No key is `401 MISSING_KEY`; a key that
        is not one of ours, or is revoked, is `401 INVALID_KEY`; an expired one
        is `401 EXPIRED_KEY`. A valid key without the scope an operation needs
        is `403 INSUFFICIENT_SCOPE` on every operation, and the message names
        the scope. Every response, a 401 included, carries X-RateLimit-Limit,
        X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a
        minute per API key. Every 429, whatever its code, carries Retry-After
        (whole seconds, never zero): the per-key budget's `RATE_LIMIT` asks for
        what is left of the minute, a route's daily cap (`RATE_LIMITED`) for the
        time until that cap resets. All four headers are listed in
        Access-Control-Expose-Headers, so a browser can read them. A path the
        API does not serve (an unknown sub-path, an id left empty) is `404
        ROUTE_NOT_FOUND`, and a method a served path does not take is `405
        METHOD_NOT_ALLOWED` with an `Allow` header; both are answered before any
        scope check, and nothing is read or changed. A trailing slash is ignored
        where it cannot be an id left empty (`POST /calls/` is `POST /calls`)
        and refused where it can (`GET /calls/`). A doubled slash inside a path
        is merged into one before the request reaches the API (`GET //calls` is
        `GET /calls`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.