The three ways to get a compliant PDF
- Use a starter template (easiest).
GET /v1/letters/requirementsreturnsstarterTemplates[]— compliant letter HTML with{{placeholders}}. Store one viaPOST /v1/letters/templates, then send withtemplateId+templateData+to. Dairo composites the recipient into the window for you; the layout is guaranteed. - 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.
- 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
pdfBase64orfile.
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 adelivery: "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
GET /v1/letters/requirements— spec + starter templates (agents: start here).- Build the document (template or your own PDF).
POST /v1/letters/verify— fix everyfail, review everywarn.POST /v1/letters/price— preview the cost.POST /v1/letterswithdryRun: true— a full no-send rehearsal: validated, rendered, priced; never mailed, never charged.POST /v1/letters— the real send, with anIdempotency-Key.
Next steps
- Letter templates — store branded, reusable letter HTML.
- Print & delivery options — color, duplex, registered mail, payment slips.
- Send a letter — the create call itself.