Skip to main content
A letter is printed exactly as your PDF renders, folded into a window envelope, and the recipient address is read optically from page 1 of the PDF. That means the address must sit inside the envelope window, and a few zones must stay clear for franking and postal processing. This page is the full layout contract — and the two endpoints that make it painless:
Building with an AI agent? Point it at GET /v1/letters/requirements first: the response carries this whole spec machine-readable, plus ready-made compliant starter templates it can store and send immediately. Over MCP the same lives on the prepare_letters tool (action: "requirements" and action: "verify"). An agent needs zero prior knowledge of postal layout standards.

The three ways to get a compliant PDF

  1. Use a starter template (easiest). GET /v1/letters/requirements returns starterTemplates[] — compliant letter HTML with {{placeholders}}. Store one via POST /v1/letters/templates, then send with templateId + templateData + to. Dairo composites the recipient into the window for you; the layout is guaranteed.
  2. Store your own template. Write your own HTML (brand, layout, fonts) that keeps the zones below clear, store it as a letter template, and let Dairo render + place the address.
  3. Bring your own PDF. Generate the PDF with any toolchain (HTML-to-PDF, LaTeX, ReportLab, a word processor) following the spec below — including placing the recipient address yourself — and pass it as pdfBase64 or file.
Whichever path you take: verify before you send.

Page setup

All coordinates below are measured in mm from the top-left corner of page 1.

The address window

The recipient address must sit entirely inside one window zone: Format the block left-aligned at 10–12 pt regular (never bold, underlined, or on a dark background — it is machine-read) with 1.2 line-height, no blank lines, at most 6 lines, in postal order: optional small return-address line (7 pt, underlined), name, company, street + house number (one line) or PO box, postal code + city (one line), country in capitals (international mail only — no country prefix on domestic letters). Keep a 3 mm left/right and 2 mm top/bottom inset inside the window. Prefer the left window — it is the postal network’s standard machine-read field and the delivery-proven default.

Registered mail is different

On a delivery: "registered" letter the carrier prints its registered-mail label and barcode into the y = 50–67 mm band of the address field. The layout shifts: Template letters get this automatically. For your own PDF, place the recipient below 67 mm and verify with "delivery": "registered" — the verifier switches to the registered geometry and fails a normal-position address block. Registered mail is domestic-only and always uses the left field.
When you send with templateId, Dairo composites the recipient from the request’s to into this window at render time — a template must never contain an address of its own. The window only concerns you when you bring your own PDF.

Keep-out zones

These zones must contain nothing (except the address block itself inside the franking zone): Two more PDF rules that bite in practice: no interactive form fields (AcroForm — flatten them, or the print output can lose content), and letters over 9 sheets ship unfolded in a C4 envelope automatically. Body content is safest starting at y ≥ 100 mm with 25 mm left / 20 mm right margins. The top band (y < 38 mm) is free for your letterhead, and the area right of the franking zone (x ≥ 112 mm, y 40–90 mm) fits a date/reference block.

Verify before sending

POST /v1/letters/verify takes the same document sources as the create (pdfBase64, file, or templateId + templateData + to) and returns a structured verdict — nothing is stored, mailed, or charged. Pass to so the address printed in the PDF is matched against the intended recipient.
valid is true only when no check failed. A fail means the letter will misprint or misroute — fix it. A warn means it will probably print but carries a risk (content near the page edge, unusually small address text, image-only pages the optical address reader may struggle with). The checks: page_size, page_count, address_window, address_fit, address_font_size, address_match (with to), franking_zone, edge_clearance, bottom_left_corner, fonts_embedded — each with the expected geometry in mm in its message, so a failing PDF can be regenerated without consulting anything else.

The safe sending workflow

  1. GET /v1/letters/requirements — spec + starter templates (agents: start here).
  2. Build the document (template or your own PDF).
  3. POST /v1/letters/verify — fix every fail, review every warn.
  4. POST /v1/letters/pricepreview the cost.
  5. POST /v1/letters with dryRun: true — a full no-send rehearsal: validated, rendered, priced; never mailed, never charged.
  6. POST /v1/letters — the real send, with an Idempotency-Key.

Next steps