# Statements

Customer statements and how they are delivered.

## GET /v1/customers/{externalRef}/statement

**Customer statement as data**

The customer's statement for a period: opening balance, every line, closing balance and ageing. A payment appears once for the full amount received, with the invoices it was applied to nested beneath it and any unused balance shown. The office screen, the PDF and the e-mailed statement are built from the same data, so they always agree.

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `from` (query): First day of the period. Omit for the statement's default period.
- `to` (query): Last day of the period. Omit for today.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Answers:

- `200` The statement
- `404` Unknown customer
- `409` No company is set on this key

## GET /v1/customers/{externalRef}/statement/file

**Customer statement as a PDF**

The same statement drawn as a PDF on the company letterhead, ready to show or attach. The file is named for the period's end date, e.g. "Statement 2026-11-30.pdf".

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `from` (query): First day of the period. Omit for the statement's default period.
- `to` (query): Last day of the period. Omit for today.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Answers:

- `200` application/pdf
- `404` Unknown customer
- `409` No company is set on this key
- `502` The renderer is unreachable or refused
- `503` No renderer is configured

## POST /v1/customers/{externalRef}/statement/send

**E-mail a statement now**

Queues the customer's statement for the period to be e-mailed. It is queued, not sent inside the request: the sender retries on failure, and the message shows in the outbox and in sent mail. Omit to_address to send to the customer's own e-mail address.

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Body:

- `from` string (date)
- `to` string (date)
- `to_address` string: Send here instead of the customer's own address.

```json
{
  "from": "2026-12-01",
  "to": "2026-12-01",
  "to_address": "string"
}
```

Answers:

- `200` queued: the message id
- `403` The key is read-only
- `404` Unknown customer
- `409` No company is set on this key
- `422` Refused, e.g. no address to send to

## GET /v1/customers/{externalRef}/statement-delivery

**The customer's automatic statement setting**

Whether the customer receives statements automatically, how often, to which address, and when the next one goes. A customer who has never chosen is OFF.

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Answers:

- `200` The setting
- `404` Unknown customer
- `409` No company is set on this key

## PUT /v1/customers/{externalRef}/statement-delivery

**Turn automatic statements on or off**

Sets how the customer receives statements: OFF, MONTHLY or WEEKLY, on which day, to which address, and whether to send when nothing is owed. Lets a customer switch automatic statements on for themselves from your app. The choice is recorded with the source system that made it, so it can be told apart from one made in the office.

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Body:

- `mode` string: OFF, MONTHLY, WEEKLY, required
- `send_on` integer: Monthly: day of the month, 31 = month-end. Weekly: 1 Monday to 7 Sunday.
- `to_address` string: Omit to leave it unchanged; an empty string clears it back to the customer's own address.
- `send_when_nil` boolean: Send even when nothing is owed.

```json
{
  "mode": "OFF"
}
```

Answers:

- `200` mode, send_on, to_address, send_when_nil, next_send
- `403` The key is read-only
- `404` Unknown customer
- `409` No company is set on this key
- `422` Refused, e.g. an unknown mode or a day out of range

## PUT /v1/customers/{externalRef}/statement-rule

**Put the customer on a statement rule**

Puts the customer on one of the company's named statement schedules from GET /v1/statement-rules, exactly as ticking them onto it in the office does. rule_id null takes them off. The choice is recorded with the source system that made it.

Parameters:

- `externalRef` (path, required): Your own reference for the customer, as pushed to /v1/parties.
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Body:

- `rule_id` string or null (uuid): The rule's id; null takes the customer off any rule.

```json
{
  "rule_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

Answers:

- `200` The customer's statement setting after the change
- `403` The key is read-only
- `404` Unknown customer
- `409` No company is set on this key
- `422` Refused, e.g. an unknown rule

## GET /v1/statement-rules

**The company's statement rules**

The named statement schedules the company has set up, for a customer to choose from. Put a customer on one with PUT /v1/customers/{externalRef}/statement-rule.

Answers:

- `200` rules
- `409` No company is set on this key
