# Outbox

Documents ReconSmiths prepared for your system to send.

## GET /v1/outbox

**What is waiting for you to send**

For a company whose sending mode is HANDBACK: its invoices are raised in your system, so they go out from your domain, which is the one its customers already know. ReconSmith picks the template, writes the subject and body in the customer's own language and renders the PDF; you send it. Poll this.

Parameters:

- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.
- `limit` (query)
- `includeCollected` (query): Also return ones you have already marked collected but not yet sent.

Answers:

- `200` count, messages: [{ messageId, kind, to, cc, bcc, subject, body, language, attachmentName, documentRef, customerRef, customer, status, createdAt, attachment }]. attachment is the path to fetch the PDF from; it is not inlined, because it is often several hundred KB and you may already hold it.
- `409` This API key has no default company

## POST /v1/outbox/{id}/collected

**You have taken it**

Separate from sent, deliberately: marking it sent at the moment it was collected would record an outcome nobody knows yet. Safe to repeat.

Parameters:

- `id` (path, required)
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Answers:

- `200` collected: true, or false if it was already taken

## POST /v1/outbox/{id}/sent

**You sent it**

This is what makes Sent mail true. "Was that invoice sent, to whom, and when" is a question the books have to answer whoever pressed the button; one that went out through your system and is invisible here is one nobody can prove was sent.

Parameters:

- `id` (path, required)
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Body:

- `providerId` string: Your mail provider's message id, if you have one. It is what a later bounce is matched on.
- `sentAt` string (date-time): Defaults to now.

```json
{
  "providerId": "string",
  "sentAt": "2026-12-01T10:00:00+02:00"
}
```

Answers:

- `200` recorded: true

## POST /v1/outbox/{id}/failed

**You could not send it**

Parameters:

- `id` (path, required)
- `sourceSystem` (query): Your system's name, the same on every call (for example shop). Identifies your references.

Body:

- `reason` string, required: Somebody will read this when they ask why the customer never got their invoice.

```json
{
  "reason": "string"
}
```

Answers:

- `200` recorded: true
- `400` No reason given

## GET /v1/outbox/{id}/pdf

**The PDF attached to an outbox message**

The message's own attachment, drawn exactly as the built-in sender would attach it. Works for every kind of message, including ones with no document or customer reference, such as a remittance advice. GET /v1/outbox gives this path in a message's attachment field when it is the way to fetch the file.

Parameters:

- `id` (path, required): The message_id from GET /v1/outbox.

Answers:

- `200` application/pdf, named as the message's attachment
- `404` Unknown message
- `409` No company is set on this key
- `502` The renderer is unreachable or refused
- `503` No renderer is configured
