Skip to content

Sending letters

Send a PDF as a letter. It is printed, put in a window envelope and posted, anywhere in Europe, as a standard or a registered letter. You follow it with its status, a timeline of everything that happened to it, and webhooks. The letters are printed and posted by Pingen, a print-and-mail service; you only deal with us.

Operation Endpoint What it does
letter.quote POST /v1/letters/quote The price of a letter beforehand, for a country, a number of pages and the options. Free.
letter.send POST /v1/letters Checks the PDF and the recipient, then prints and posts the letter.
letter.read GET /v1/letters, GET /v1/letters/{id}, POST /v1/letters/{id}/cancel Where your letters stand, and cancelling a letter that is not printed yet. Free.

A key needs the scope letter, or the operation itself (see scopes).

Availability. In preview: the status of the operations in GET /v1/pricing is preview. Test keys work for everyone, and never print or post anything; see test mode.

  • A PDF, at most 8 MB after decoding. The type is decided from the content, not from the file name. A PDF that asks for a password cannot be printed.

  • Every page A4 (210 × 297 mm), upright or turned. Another size is 422 page_not_a4, with the number of the first wrong page.

  • Printed on both sides unless you send duplex: false, and in black and white unless you send color: true.

  • A limit per envelope. An envelope to a country takes at most this many sheets (a sheet holds two pages when printed on both sides; a cover page is a sheet too):

    Country Sheets
    NL 7
    BE, DE, FR, AT, LU 160
    ES 75
    Every other country 60

    More is 422 too_many_pages, with sheets and max_sheets. POST /v1/letters/quote gives max_sheets for a country.

The letter goes in a window envelope with the window on the left. address_placement says where the address comes from:

address_placement What happens
pdf The address is already printed on page 1 of your PDF, in the address area on the left, so it shows through the window. The address on the PDF is where the post delivers it.
cover_page We put a cover page with the address of recipient in front of your PDF. Your PDF can then have any layout, but the cover page is one sheet more, in the price too.

With pdf, recipient is still required: we check it, price the letter for its country and show it in the portal. Keep it the same as the address on the PDF. When Pingen reads another country from the PDF than recipient.country, the letter’s timeline gets an address_mismatch event; the letter still goes out.

cover_page may not be available yet. Then it is 422 validation_failed with errors.address_placement: print the address on the first page and use pdf.

recipient is the name, the country (ISO 3166-1 alpha-2) and the fields of that country’s address form, by their id, the way POST /v1/address/validate takes them. Get the form with GET /v1/address/forms/{country}.

{
"name": "Bakkerij De Korenaar B.V.",
"country": "NL",
"street": "Dorpsstraat",
"house_number": "1",
"postal_code": "1234ab",
"city": "Ergens"
}
  • Checked and normalised like an address of the address module: 1234ab becomes 1234 AB. An invalid postcode stops the letter.
  • Printed as it fits on an envelope. The name takes at most 45 characters, the street 40, the house number with its addition 10, the postcode 8 and the city 25. Longer is a 422 with the field in errors, never cut off: a cut-off address may not arrive.
  • A cover page has room for the street, the number, the postcode and the city. A field without a place on it, such as a second address line, is a 422 with cover_page. With pdf it is on your PDF already.
  • A lines key is ignored, so the address of a company profile can be passed on with a name added.

A mistake in the recipient is 422 validation_failed, with the messages per recipient.* field in errors. Nothing is sent or charged.

As JSON, with the PDF in base64:

Terminal window
curl https://api.accountcloud.io/v1/letters \
-H "Authorization: Bearer ac_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3b9f0c1e-7d2a-4c58-9e61-2f4a8b0d5c73" \
-d '{
"file": { "name": "invoice-2026-0142.pdf", "content_base64": "JVBERi0xLjcK…" },
"recipient": {
"name": "Bakkerij De Korenaar B.V.",
"country": "NL",
"street": "Dorpsstraat",
"house_number": "1",
"postal_code": "1234 AB",
"city": "Ergens"
},
"address_placement": "pdf",
"delivery": "economy",
"color": false,
"duplex": true,
"reference": "invoice-2026-0142"
}'

Or as multipart, with the same fields as form fields:

Terminal window
curl https://api.accountcloud.io/v1/letters \
-H "Authorization: Bearer ac_test_…" \
-H "Idempotency-Key: 3b9f0c1e-7d2a-4c58-9e61-2f4a8b0d5c73" \
-F "recipient[name]=Bakkerij De Korenaar B.V." \
-F "recipient[country]=NL" \
-F "recipient[street]=Dorpsstraat" \
-F "recipient[house_number]=1" \
-F "recipient[postal_code]=1234 AB" \
-F "recipient[city]=Ergens" \
-F "address_placement=pdf" \
-F "color=false" \
-F "reference=invoice-2026-0142"
Field What it is
file Required. In JSON an object with name (at most 255 characters) and content_base64, where a prefix such as data:application/pdf;base64, is allowed. In multipart a file field. See the PDF.
recipient Required. See the recipient.
address_placement Required. pdf or cover_page; see where the address goes.
delivery economy (default): the standard letter of the country. registered: a registered letter, with a tracking number, only to the countries that have one.
color true to print in colour. Default false.
duplex false to print on one side of each sheet. Default true.
reference Your own id for the letter, at most 255 characters. You can filter the list on it.
test_scenario Test keys only: the life a test letter plays. See test mode.

Everything is checked before anything is sent: the recipient, the PDF, the sheets for the country and whether the delivery is offered there. Then the price is reserved, and the answer is 202 with the letter, processing, and a Location header:

{
"id": "ltr_01jbx6y4q9t2m8rz1v3k5n7p0a",
"object": "letter",
"environment": "live",
"status": "processing",
"reason": null,
"reason_code": null,
"recipient": { "name": "Bakkerij De Korenaar B.V.", "country": "NL", "street": "Dorpsstraat", "house_number": "1", "postal_code": "1234 AB", "city": "Ergens" },
"country": "NL",
"delivery": "economy",
"address_placement": "pdf",
"color": false,
"duplex": true,
"pages": 2,
"sheets": 1,
"tracking_number": null,
"corrected_address": null,
"reference": "invoice-2026-0142",
"test_scenario": null,
"events": [],
"price": {
"amount": "2.5000",
"currency": "EUR",
"lines": [
{ "operation": "letter.send", "variant": "nl.economy", "quantity": 1, "unit_price": "2.5000", "amount": "2.5000" }
]
},
"charge": { "operation": "letter.send", "status": "reserved", "amount": "2.5000", "currency": "EUR" },
"created_at": "2026-11-16T09:14:12Z",
"submitted_at": null,
"sent_at": null,
"delivered_at": null,
"undeliverable_at": null,
"cancelled_at": null,
"failed_at": null
}

Send an Idempotency-Key with every letter: a retry with the same key gives the same letter, never a second one in the post.

POST /v1/letters/quote gives the price of a letter before you send it, with your own prices where you agreed them. It checks the same as sending: a delivery the country does not have, and more sheets than its envelope takes, are a 422.

Terminal window
curl https://api.accountcloud.io/v1/letters/quote \
-H "Authorization: Bearer ac_test_…" \
-H "Content-Type: application/json" \
-d '{ "country": "DE", "pages": 6, "delivery": "registered", "color": true }'
{
"object": "letter_quote",
"country": "DE",
"delivery": "registered",
"address_placement": "pdf",
"color": true,
"duplex": true,
"pages": 6,
"sheets": 3,
"max_sheets": 160,
"amount": "6.6500",
"currency": "EUR",
"lines": [
{ "operation": "letter.send", "variant": "de.registered", "quantity": 1, "unit_price": "5.0000", "amount": "5.0000" },
{ "operation": "letter.sheet", "variant": null, "quantity": 1, "unit_price": "0.7500", "amount": "0.7500" },
{ "operation": "letter.color", "variant": null, "quantity": 6, "unit_price": "0.1500", "amount": "0.9000" }
]
}

The amounts are an example. pages is required; delivery, color, duplex and address_placement have the same defaults as when sending (address_placement defaults to pdf here).

A letter is priced from three operations, excluding VAT. Current prices are in GET /v1/pricing; the quote gives the total for one letter.

Operation Per What it covers
letter.send letter A letter to one country with one delivery, up to two sheets in black and white. One variant per country and delivery: nl.economy, de.registered, …
letter.sheet sheet Every sheet above two. A cover page counts.
letter.color page Every printed page in colour, the cover page included.
  • Which countries. The countries with a letter.send variant in GET /v1/pricing. Another country is 422 validation_failed with errors.recipient.country.
  • Registered only where a real registered letter exists: a <country>.registered variant. Elsewhere delivery: registered is 422 with errors.delivery, never silently a standard letter.
  • When it is charged. The whole price is reserved when the letter is accepted (202); a credit that does not cover it is 402 insufficient_credits, and nothing is sent. It is charged once the letter is posted, also when it later comes back (undeliverable): the postage is spent then. A letter that failed or was cancelled costs nothing; the reservation is released. charge on the letter shows where it stands.
status What it means
processing Received; Pingen is checking the file and the address.
submitted Accepted by Pingen; on its way to the print centre. It can usually still be cancelled.
sent Handed to the postal service. Charged now. A registered letter has its tracking_number.
delivered Delivered, where the postal service reports it. Many letters stay sent: not every service reports delivery.
undeliverable It came back. reason says why, and corrected_address has the address the postal service gave back, when it gave one.
cancelled Cancelled before it was printed. Not charged.
failed Refused by Pingen or the print centre, so it was never posted. reason says why. Not charged.

A letter only moves forward. delivered, undeliverable, cancelled and failed are final.

GET /v1/letters/{id} has events, the timeline of the letter, in the order we learned it:

"events": [
{ "type": "submitted", "status": "submitted", "code": "submitted", "reason": null, "occurred_at": "2026-11-16T09:14:42Z" },
{ "type": "sent", "status": "sent", "code": null, "reason": null, "occurred_at": "2026-11-17T06:02:10Z" },
{ "type": "undeliverable", "status": "undeliverable", "code": "undeliverable_recipient_unknown", "reason": "Addressee unknown", "occurred_at": "2026-11-21T10:31:00Z" }
]
Field What it is
type The status the letter reached (submitted, sent, …), issue for a message of Pingen about a problem, or address_mismatch (see where the address goes). An issue fails the letter only when the letter cannot be sent; otherwise it is only in the timeline.
status The status of the letter after this event, when the event changed it.
code Pingen’s code or status. reason_code on the letter is the code of the event that gave it its final status.
reason Pingen’s words, where it gave them.

A letter that missed a message is caught up: we ask for the status of every open letter again after two days, then every hour (a sent letter once a day), for 45 days.

GET /v1/letters lists the letters of the key’s environment, newest first, filtered on status and reference, with limit (1 to 100) and cursor: pass next_cursor for the next page while has_more is true. With an AccountCloud-Entity header, only the letters of that entity.

POST /v1/letters/{id}/cancel cancels a letter that is not printed yet, processing or submitted. The answer is 200 with the letter, cancelled, and the letter.cancelled webhook follows. It costs nothing. Once the letter is being printed or posted, it is 409 letter_not_cancellable, with its letter_status.

Type When
letter.sent A letter was handed to the postal service.
letter.delivered The postal service reported a letter as delivered.
letter.undeliverable A letter came back.
letter.failed A letter was refused by Pingen or the print centre, so it was not posted. Not charged.
letter.cancelled A letter was cancelled before it was printed. Not charged.

They go to the endpoints of the letter’s environment, and follow the API key that sent the letter. There is no webhook for submitted, nor for a message that does not stop the letter: those are only in events.

No personal data. The data is the letter as GET /v1/letters/{id} gives it, without recipient, without corrected_address and without the reason texts, of the letter and of every event: they can hold a name or an address, and webhook events are kept for 13 months. The codes stay. Get the letter for the rest.

{
"type": "letter.undeliverable",
"timestamp": "2026-11-21T10:31:05Z",
"data": {
"id": "ltr_01jbx6y4q9t2m8rz1v3k5n7p0a",
"object": "letter",
"environment": "live",
"status": "undeliverable",
"reason_code": "undeliverable_recipient_unknown",
"country": "NL",
"delivery": "economy",
"address_placement": "pdf",
"color": false,
"duplex": true,
"pages": 2,
"sheets": 1,
"tracking_number": null,
"reference": "invoice-2026-0142",
"test_scenario": null,
"events": [
{ "type": "submitted", "status": "submitted", "code": "submitted", "occurred_at": "2026-11-16T09:14:42Z" },
{ "type": "sent", "status": "sent", "code": null, "occurred_at": "2026-11-17T06:02:10Z" },
{ "type": "undeliverable", "status": "undeliverable", "code": "undeliverable_recipient_unknown", "occurred_at": "2026-11-21T10:31:00Z" }
],
"price": { "amount": "2.5000", "currency": "EUR", "lines": [ { "operation": "letter.send", "variant": "nl.economy", "quantity": 1, "unit_price": "2.5000", "amount": "2.5000" } ] },
"charge": { "operation": "letter.send", "status": "captured", "amount": "2.5000", "currency": "EUR" },
"created_at": "2026-11-16T09:14:12Z",
"submitted_at": "2026-11-16T09:14:42Z",
"sent_at": "2026-11-17T06:02:10Z",
"delivered_at": null,
"undeliverable_at": "2026-11-21T10:31:00Z",
"cancelled_at": null,
"failed_at": null
}
}

With a test key a letter is checked like a live one: the recipient, the PDF, the sheets and whether the delivery is offered to the country. Then it is never printed or posted, and nothing is charged: charge.amount is 0.0000, and price shows what it would cost live. It goes through the same statuses, events and webhooks as a live letter, to your test endpoints, within seconds. Which life it plays follows test_scenario:

test_scenario What happens
None submitted, then sent with letter.sent. A registered letter gets a tracking_number.
undeliverable As above, then undeliverable with letter.undeliverable, a reason and a corrected_address.
unprintable submitted, then failed with letter.failed: the print centre refused it.
cancellable Stays submitted, so you can cancel it with POST /v1/letters/{id}/cancel.

A live key with test_scenario is 422 validation_failed. See test mode for the timings.

Letters in the portal lists the letters of your account per environment, with their status, timeline and price. The PDF can be downloaded there for 45 days after sending, a test letter for 2 days; after that it is deleted.

Code Status When
file_missing, invalid_base64 422 No PDF, or the base64 is not valid.
file_too_large 413 The PDF is larger than 8 MB after decoding. With max_bytes.
unsupported_media_type 415 The file is not a PDF.
encrypted_pdf 422 The PDF asks for a password, or cannot be opened.
page_not_a4 422 A page is not A4. With page.
too_many_pages 422 More sheets than an envelope to the country takes. With sheets and max_sheets.
validation_failed 422 The recipient, a country or delivery that is not offered, test_scenario with a live key, or cover_page while it is not available. The messages per field in errors.
insufficient_credits 402 Your credit does not cover the price of the letter.
letter_not_found 404 The letter does not exist, or belongs to another account or environment.
letter_not_cancellable 409 The letter is printed or posted already, or was cancelled or refused before.
provider_unavailable 503 Pingen cannot be reached to cancel a letter, or letters cannot be sent for now. Try again after Retry-After.
service_unavailable 503 The PDF cannot be checked right now. Nothing was sent; try again shortly.

A letter that was accepted with 202 and is then refused does not give an error: it becomes failed, with reason and the letter.failed webhook, and costs nothing.