# Documents, statements and sending

## Issued documents

| You want | Call |
|---|---|
| The tax invoice or credit note as a PDF | `GET /v1/documents/{externalRef}/pdf` |
| The same document as data | `GET /v1/documents/{externalRef}/content?format=json` (or `xml`) |
| Which of your invoices are still open | `GET /v1/documents?externalRefs=a,b,c` |

There is one renderer, so the PDF you fetch is the one the office prints and e-mails: same layout, same numbers, the company's letterhead as it stood on the document's date. A draft has no PDF (`409`).

## Customer statements

| You want | Call |
|---|---|
| The statement as data | `GET /v1/customers/{externalRef}/statement` |
| The statement as a PDF | `GET /v1/customers/{externalRef}/statement/file` |
| Send it now, by e-mail | `POST /v1/customers/{externalRef}/statement/send` |
| How this customer receives statements | `GET` / `PUT /v1/customers/{externalRef}/statement-delivery` |
| Which statement rule applies (monthly, weekly...) | `GET /v1/statement-rules`, `PUT /v1/customers/{externalRef}/statement-rule` |

Each payment line on a statement carries its settlement trace: which invoices it paid, and how much of each.

## Who sends: ReconSmiths, or your system

A company chooses how its documents leave:

- **ReconSmiths sends** them by e-mail from the company's address. You do nothing.
- **Your system sends** them (hand-back), for a company whose customers know your system's address. ReconSmiths prepares each message - the right template, the subject and text in the customer's language, the PDF - and puts it in the **outbox** for you:

1. `GET /v1/outbox` - what is waiting. Poll it.
2. `GET /v1/outbox/{id}/pdf` - the attachment.
3. `POST /v1/outbox/{id}/collected` - you have taken it.
4. `POST /v1/outbox/{id}/sent` (or `/failed` with a reason) - what happened.

Report the outcome: "was this invoice sent, to whom and when" is a question the books must answer, whoever sent it.
