Skip to main content
POST
Create (and queue) a physical-mail letter

Authorizations

Authorization
string
header
required

Dairo API key, e.g. dairo_test_... or dairo_live_...

Headers

Idempotency-Key
string

Optional idempotency key for safe retries of side-effecting operations.

Maximum string length: 128

Body

application/json

Exactly one document source must be provided: pdfBase64, file, or templateId. Validate any letter first with POST /v1/letters/verify; GET /v1/letters/requirements has the full layout spec and compliant starter templates.

fileName
string
required
to
object
required
pdfBase64
string | null

Base64-encoded PDF (alternative to file).

file
object | null

Reuse a PDF already stored in Dairo as the letter — no re-upload. Provide EXACTLY ONE of attachmentId (an email attachment) or objectId (a storage object from the buckets API). Providing both, or neither, is a 400.

from
object | null
print
object
delivery
enum<string>
Available options:
economy,
priority,
registered,
bulk,
premium
autoSend
boolean
default:true
metadata
object
templateId
string | null

A stored letter template id. Dairo renders the template (filled with templateData) and composites the to recipient into the address window — the third document source, mutually exclusive with pdfBase64/file. Required for the structured payment object.

templateData
object | null

Values for the template's {{placeholder}} variables. Ignored unless templateId is set.

dryRun
boolean
default:false

When true the letter is validated, rendered, and priced exactly like a real send but is NEVER created, mailed, or charged — the response is a non-persisted status:"preview" object. The per-request no-send rehearsal.

notifications
boolean
default:true

Email the account owner a status update at notable delivery milestones.

paymentSlip
enum<string> | null

Bring-your-own-slip flag for a pdfBase64/file letter whose PDF already contains the slip artwork: qr (Swiss QR-bill), sepaDe, or sepaAt. Omit/null for a normal letter. To have Dairo GENERATE the slip use the structured payment object (template letters only).

Available options:
qr,
sepaDe,
sepaAt,
null
payment
object | null

Structured payment object — Dairo GENERATES the payment slip (Swiss QR-bill / SEPA Zahlschein + GiroCode) and composites it full-width at the page bottom. Honored ONLY with templateId; pairing it with pdfBase64/file is a 400.

Response

Success

object
enum<string>
required
Available options:
letter
id
string
required
status
enum<string>
required
Available options:
draft,
queued,
processing,
printable,
submitted,
in_transit,
delivered,
undeliverable,
canceled,
failed
fileName
string | null
pageCount
integer | null
to
object
from
object | null
print
object
delivery
enum<string>
Available options:
economy,
priority,
registered,
bulk,
premium
paperTypes
enum<string>[]
Available options:
standard,
qr,
sepa_at,
sepa_de
autoSend
boolean
price
object | null
trackingNumber
string | null
metadata
object
lastEventType
string | null
lastEventAt
string<date-time> | null
submittedAt
string<date-time> | null
canceledAt
string<date-time> | null
error
string | null
createdAt
string<date-time> | null
updatedAt
string<date-time> | null
events
object[]
paymentSlip
enum<string> | null

The chosen payment-slip overlay, or null for a normal letter.

Available options:
qr,
sepaDe,
sepaAt,
null
dryRun
boolean

True for a validate/price-only letter that is never mailed or charged.

notifications
boolean

Owner milestone-email preference for this letter.

payment
object | null

The structured payment object the slip was generated from (owner records), or null.

undeliverableReason
string | null

Human-readable reason when the letter reached undeliverable; null otherwise.

batchId
string | null

The owning batch id for a batch-member letter; null for a single send. Pairs with the ?batchId= list filter.