Skip to main content
Create a letter from a PDF and a postal address, then follow it by id. This page covers the core letter operations; letter templates and batches have their own pages.

Create a letter

Pass the PDF as pdfBase64, a fileName, and a recipient to address. Everything else has defaults.
The response is the letter object at status: "queued" — accepted and being prepared, nothing printed yet. pageCount and price are null until the letter is priced.
Always pass an Idempotency-Key header (or idempotencyKey in the SDKs) when creating letters. A retried create with the same key returns the original letter instead of printing a second one — physical mail cannot be unsent. See Retries & idempotency. In the CLI, dairo letter send creates a draft unless you pass --confirm, so an accidental rerun never posts anything.

Document sources

A letter’s document comes from exactly one of three sources:
file: reuse an email attachment
file: reuse a storage object
The document must be a real PDF no larger than 25 MB. A non-PDF is rejected with 422; an oversize file with 413. Providing more than one source — or none — is a 400.
Bringing your own PDF? It must follow the layout contract — A4 portrait, the recipient address inside the envelope window, franking zones clear, fonts embedded. POST /v1/letters/verify checks all of it and returns a structured pass/warn/fail report before anything is printed; GET /v1/letters/requirements returns the machine-readable spec plus compliant starter templates.

Request fields

The recipient’s country must be a destination Dairo can deliver to. An unsupported or malformed country is rejected with 422 naming to.country.

List letters

List your letters, most recent first. Page with limit (1–100, default 20) and cursor using keyset pagination, and filter by status, country, or batchId.
List items are compact: the to block carries only the recipient’s city and country, never the full address.

Get one letter

Fetch a letter by id to read its current status, price, any trackingNumber, and its full address, with the delivery events timeline inlined newest first (up to 100 events). Fetching an in-flight letter also refreshes its tracking state, so a poll returns the latest known status.
A letter id that is unknown or not yours returns 404 — the two cases are indistinguishable by design.

Cancel a letter

Cancel a letter that has not been dispatched. Cancellation is allowed while the letter is draft, queued, processing, printable, or submitted — once it is in_transit it is in the postal network and cannot be recalled.
You get back the letter with status: "canceled" and canceledAt set. Canceling a letter that is already past dispatch returns 409 Conflict with code: "letter_not_cancelable".

List a letter’s events

Fetch the delivery timeline on its own. Events come back newest first, up to the 100 most recent.
The event field reference is on Status & tracking.

Price a letter

A letter’s cost depends on its page count, print options, delivery class, and destination. POST /v1/letters/price returns the exact cost without creating a letter — pass a pageCount, or the pdfBase64 itself and Dairo counts the pages.
cURL
The full request reference, the quote-then-send pattern, and how letters bill are on Pricing.

Next steps

  • Send a batch — one template, up to 1,000 recipients, in one call.
  • API reference — full request and response schemas for every letters endpoint.