---
title: "Monthly aggregates"
description: "The totals of the restaurant's tills per calendar month, per VAT rate and per payment method, for up to 24 months in one call."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.unipage.be/llms.txt
> Use this file to discover all available pages before exploring further.

# Monthly aggregates

`GET /pos-aggregates/monthly` returns the totals of the restaurant's tills
per calendar month: revenue before and after discounts, VAT and taxable
amount per VAT rate, and the money received per payment method and per
payment name. One call covers up to 24 months.

Use it for a monthly or quarterly bookkeeping export, a VAT return check or a
revenue chart. You do not need to fetch a [day report](/core/day-report/) per
day and add them up.

```sh
curl "https://api.unipage.eu/x94d3/pos-aggregates/monthly?from=2026-08&to=2026-09" \
  -H "X-API-Key: $UNIPAGE_CORE_API_KEY"
```

## Parameters

| Query parameter | Effect |
|---|---|
| `from` | the first month, as `YYYY-MM`. Default: 11 months before `to` |
| `to` | the last month, as `YYYY-MM`, included. Default: the running month |

Without parameters you get the last 12 months, the running month included.
A call covers at most 24 months; for a longer history, make several calls.

## Response

```json title="200"
{
  "business_id": "x94d3",
  "currency": "EUR",
  "timezone": "Europe/Brussels",
  "day_starts_at": "05:00",
  "from": "2026-08",
  "to": "2026-09",
  "data": [
    {
      "month": "2026-08",
      "period": { "from": "2026-08-01T03:00:00Z", "to": "2026-09-01T02:59:59Z" },
      "is_month_over": true,
      "days_with_sales": 0,
      "tickets": { "count": 0, "refunds": 0 },
      "totals": {
        "gross_revenue": 0,
        "discounts": 0,
        "revenue": 0,
        "vat": 0,
        "taxable_amount": 0,
        "payments": 0
      },
      "vat_rates": [],
      "payment_methods": [],
      "payment_names": []
    },
    {
      "month": "2026-09",
      "period": { "from": "2026-09-01T03:00:00Z", "to": "2026-10-01T02:59:59Z" },
      "is_month_over": true,
      "days_with_sales": 2,
      "tickets": { "count": 7, "refunds": 1 },
      "totals": {
        "gross_revenue": 204.2,
        "discounts": 12.1,
        "revenue": 192.1,
        "vat": 32.1,
        "taxable_amount": 160,
        "payments": 192.1
      },
      "vat_rates": [
        { "rate": 6, "letter": "C", "taxable_amount": 10, "vat": 0.6, "total": 10.6 },
        { "rate": 21, "letter": "A", "taxable_amount": 150, "vat": 31.5, "total": 181.5 }
      ],
      "payment_methods": [
        { "payment_method": "CARD", "amount": 100 },
        { "payment_method": "CASH", "amount": 92.1 }
      ],
      "payment_names": [
        { "payment_name": "Visa", "amount": 100 },
        { "payment_name": "Cash", "amount": 92.1 }
      ]
    }
  ],
  "generated_at": "2026-10-15T12:00:00Z"
}
```

Every month from `from` to `to` is listed, oldest first. A month without
sales is a row of zeros with empty lists, so you can loop over `data` without
checking for gaps.

### Fields

| Key | Meaning |
|---|---|
| `currency` | the currency of every amount (`EUR`) |
| `timezone`, `day_starts_at` | the restaurant's timezone and the hour its business day starts (see [The month](#the-month)) |
| `from`, `to` | the first and last month of this answer |
| `data[].month` | the month, as `YYYY-MM` |
| `data[].period.from`, `.period.to` | the exact window, in UTC, the month covers |
| `data[].is_month_over` | `false` while the month is still running: the totals will still grow |
| `data[].days_with_sales` | the business days in the month with at least one receipt |
| `data[].tickets.count` | VAT receipts in the month, refunds included |
| `data[].tickets.refunds` | how many of those are refund receipts |
| `data[].totals.gross_revenue` | revenue including VAT, before discounts: `revenue + discounts` |
| `data[].totals.discounts` | the discounts given, as a positive amount |
| `data[].totals.revenue` | revenue including VAT, after discounts |
| `data[].totals.vat` | the VAT owed |
| `data[].totals.taxable_amount` | the taxable amount (revenue excluding VAT) |
| `data[].totals.payments` | all money received, every payment method together |
| `data[].vat_rates[]` | one row per VAT rate that has any amount, lowest rate first |
| `data[].vat_rates[].rate` | the rate in percent (`21`) |
| `data[].vat_rates[].letter` | the Belgian receipt letter of the rate (`A` 21 %, `B` 12 %, `C` 6 %, `D` 0 %), `null` for another rate |
| `data[].vat_rates[].taxable_amount`, `.vat`, `.total` | the base, the VAT and the amount including VAT at that rate |
| `data[].payment_methods[]` | the money received per payment method (`CASH`, `CARD`), largest first. `payment_method` is `null` for payments the till sent without a method |
| `data[].payment_names[]` | the same money per payment name as the till shows it (`Visa`, `Bancontact`), largest first |
| `generated_at` | when this answer was computed |

Every amount has two decimals, rounded after adding up. The rates add up to
the totals and the payment methods to `totals.payments`, but a sum of rounded
rows can differ from the rounded total by a cent.

## How the totals are computed

- **Signed amounts.** A refund counts negative, so a sold and refunded item
  nets to zero. A rate, a payment method or a payment name that nets to
  exactly zero is left out.
- **Discounts are already in `revenue`.** `discounts` reports their size;
  `gross_revenue` adds them back. Do not subtract them from `revenue` again.
- **Only finalized VAT receipts** (sales and refunds) count, from every till
  of the location. This is where a month can differ from its
  [day reports](/core/day-report/) added up: the day report also counts a VAT
  receipt the till has not finalized yet. The monthly figures are the ones the
  restaurant sees in Unipage under Rapporten > Periodeoverzicht.
- **No row for a missing VAT rate.** A receipt line the till sent without a
  VAT rate is counted at 0 % here. The day report lists such lines apart
  (`rate: null`).

## The month

A month is made of business days, not of calendar days. A business day starts
at the restaurant's `day_starts_at` (default `00:00`) in its timezone. With
`05:00`, a sale at 01:30 on 1 October still belongs to **September**.
`period` tells you the exact window of each month.

## When to fetch it

The totals of a finished day are prepared every night. The running day, and
yesterday until the night run is done, are added from the receipts the tills
have synced so far, so the running month is always up to date (an answer can
be up to a minute old).

Tills keep working offline and sync their receipts when they are back online.
A receipt that arrives late is added to its month during the next night. A
robust monthly export:

1. Fetch the month once `is_month_over` is `true`, for example on the second
   day of the next month.
2. Fetch it again a few days later and replace your copy when a total changed.

```js title="monthly-export.js"
const res = await fetch(
  `https://api.unipage.eu/${BUSINESS_ID}/pos-aggregates/monthly?from=2026-07&to=2026-09`,
  { headers: { "X-API-Key": process.env.UNIPAGE_CORE_API_KEY } },
);
const { data } = await res.json();

for (const month of data) {
  if (!month.is_month_over) continue;
  for (const rate of month.vat_rates) {
    bookkeeping.addVatLine(month.month, rate.rate, rate.taxable_amount, rate.vat);
  }
  for (const method of month.payment_methods) {
    bookkeeping.addPayment(month.month, method.payment_method, method.amount);
  }
}
```

> **Note**
>
> After a change of owner (a takeover of the location), the months only cover
> the receipts from the takeover on: the previous owner's sales are not part
> of the new owner's data.

## Errors

| Status | Body | Meaning |
|---|---|---|
| `422` | `{"error": "invalid_month", "message": "..."}` | `from` or `to` is not a month in `YYYY-MM` form |
| `422` | `{"error": "invalid_range", "message": "..."}` | `from` is after `to`, or the range is longer than 24 months |

Plus the errors of the [key check and the rate limits](/core/errors-and-limits/).

Source: https://developer.unipage.be/core/monthly-aggregates/index.mdx
