curl --request POST \
--url https://api.dairo.app/v1/letters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"pdfBase64": "<string>",
"file": {
"attachmentId": "<string>",
"messageId": "<string>",
"objectId": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": true,
"metadata": {},
"templateId": "<string>",
"templateData": {},
"dryRun": false,
"notifications": true,
"payment": {
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
}
}
'import requests
url = "https://api.dairo.app/v1/letters"
payload = {
"fileName": "<string>",
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"pdfBase64": "<string>",
"file": {
"attachmentId": "<string>",
"messageId": "<string>",
"objectId": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": True,
"metadata": {},
"templateId": "<string>",
"templateData": {},
"dryRun": False,
"notifications": True,
"payment": {
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileName: '<string>',
to: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
pdfBase64: '<string>',
file: {attachmentId: '<string>', messageId: '<string>', objectId: '<string>'},
from: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
print: {},
autoSend: true,
metadata: {},
templateId: '<string>',
templateData: {},
dryRun: false,
notifications: true,
payment: {
creditor: {
name: '<string>',
iban: '<string>',
country: '<string>',
bic: '<string>',
street: '<string>',
houseNumber: '<string>',
postalCode: '<string>',
city: '<string>'
},
amount: 123,
reference: '<string>',
message: '<string>',
debtor: {
name: '<string>',
street: '<string>',
houseNumber: '<string>',
postalCode: '<string>',
city: '<string>',
country: '<string>'
}
}
})
};
fetch('https://api.dairo.app/v1/letters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dairo.app/v1/letters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => '<string>',
'to' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'pdfBase64' => '<string>',
'file' => [
'attachmentId' => '<string>',
'messageId' => '<string>',
'objectId' => '<string>'
],
'from' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'print' => [
],
'autoSend' => true,
'metadata' => [
],
'templateId' => '<string>',
'templateData' => [
],
'dryRun' => false,
'notifications' => true,
'payment' => [
'creditor' => [
'name' => '<string>',
'iban' => '<string>',
'country' => '<string>',
'bic' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'amount' => 123,
'reference' => '<string>',
'message' => '<string>',
'debtor' => [
'name' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'postalCode' => '<string>',
'city' => '<string>',
'country' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dairo.app/v1/letters"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dairo.app/v1/letters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "letter",
"id": "<string>",
"status": "draft",
"fileName": "<string>",
"pageCount": 123,
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {
"mode": "color",
"sides": "simplex",
"addressPlacement": "left"
},
"delivery": "economy",
"paperTypes": [
"standard"
],
"autoSend": true,
"price": {
"currency": "<string>",
"amount": 123
},
"trackingNumber": "<string>",
"metadata": {},
"lastEventType": "<string>",
"lastEventAt": "2023-11-07T05:31:56Z",
"submittedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"events": [
{
"object": "letter_event",
"eventId": "<string>",
"type": "<string>",
"letterId": "<string>",
"code": "<string>",
"description": "<string>",
"producer": "<string>",
"location": "<string>",
"hasImage": true,
"occurredAt": "2023-11-07T05:31:56Z",
"recordedAt": "2023-11-07T05:31:56Z"
}
],
"paymentSlip": "qr",
"dryRun": true,
"notifications": true,
"payment": {
"type": "qr",
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"currency": "CHF",
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
},
"undeliverableReason": "<string>",
"batchId": "<string>"
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}Create
Create (and queue) a physical-mail letter
curl --request POST \
--url https://api.dairo.app/v1/letters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"pdfBase64": "<string>",
"file": {
"attachmentId": "<string>",
"messageId": "<string>",
"objectId": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": true,
"metadata": {},
"templateId": "<string>",
"templateData": {},
"dryRun": false,
"notifications": true,
"payment": {
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
}
}
'import requests
url = "https://api.dairo.app/v1/letters"
payload = {
"fileName": "<string>",
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"pdfBase64": "<string>",
"file": {
"attachmentId": "<string>",
"messageId": "<string>",
"objectId": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": True,
"metadata": {},
"templateId": "<string>",
"templateData": {},
"dryRun": False,
"notifications": True,
"payment": {
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileName: '<string>',
to: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
pdfBase64: '<string>',
file: {attachmentId: '<string>', messageId: '<string>', objectId: '<string>'},
from: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
print: {},
autoSend: true,
metadata: {},
templateId: '<string>',
templateData: {},
dryRun: false,
notifications: true,
payment: {
creditor: {
name: '<string>',
iban: '<string>',
country: '<string>',
bic: '<string>',
street: '<string>',
houseNumber: '<string>',
postalCode: '<string>',
city: '<string>'
},
amount: 123,
reference: '<string>',
message: '<string>',
debtor: {
name: '<string>',
street: '<string>',
houseNumber: '<string>',
postalCode: '<string>',
city: '<string>',
country: '<string>'
}
}
})
};
fetch('https://api.dairo.app/v1/letters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dairo.app/v1/letters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => '<string>',
'to' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'pdfBase64' => '<string>',
'file' => [
'attachmentId' => '<string>',
'messageId' => '<string>',
'objectId' => '<string>'
],
'from' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'print' => [
],
'autoSend' => true,
'metadata' => [
],
'templateId' => '<string>',
'templateData' => [
],
'dryRun' => false,
'notifications' => true,
'payment' => [
'creditor' => [
'name' => '<string>',
'iban' => '<string>',
'country' => '<string>',
'bic' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'amount' => 123,
'reference' => '<string>',
'message' => '<string>',
'debtor' => [
'name' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'postalCode' => '<string>',
'city' => '<string>',
'country' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dairo.app/v1/letters"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dairo.app/v1/letters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\",\n \"to\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"pdfBase64\": \"<string>\",\n \"file\": {\n \"attachmentId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"objectId\": \"<string>\"\n },\n \"from\": {\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"company\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"poBox\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"print\": {},\n \"autoSend\": true,\n \"metadata\": {},\n \"templateId\": \"<string>\",\n \"templateData\": {},\n \"dryRun\": false,\n \"notifications\": true,\n \"payment\": {\n \"creditor\": {\n \"name\": \"<string>\",\n \"iban\": \"<string>\",\n \"country\": \"<string>\",\n \"bic\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\"\n },\n \"amount\": 123,\n \"reference\": \"<string>\",\n \"message\": \"<string>\",\n \"debtor\": {\n \"name\": \"<string>\",\n \"street\": \"<string>\",\n \"houseNumber\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "letter",
"id": "<string>",
"status": "draft",
"fileName": "<string>",
"pageCount": 123,
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {
"mode": "color",
"sides": "simplex",
"addressPlacement": "left"
},
"delivery": "economy",
"paperTypes": [
"standard"
],
"autoSend": true,
"price": {
"currency": "<string>",
"amount": 123
},
"trackingNumber": "<string>",
"metadata": {},
"lastEventType": "<string>",
"lastEventAt": "2023-11-07T05:31:56Z",
"submittedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"events": [
{
"object": "letter_event",
"eventId": "<string>",
"type": "<string>",
"letterId": "<string>",
"code": "<string>",
"description": "<string>",
"producer": "<string>",
"location": "<string>",
"hasImage": true,
"occurredAt": "2023-11-07T05:31:56Z",
"recordedAt": "2023-11-07T05:31:56Z"
}
],
"paymentSlip": "qr",
"dryRun": true,
"notifications": true,
"payment": {
"type": "qr",
"creditor": {
"name": "<string>",
"iban": "<string>",
"country": "<string>",
"bic": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"amount": 123,
"currency": "CHF",
"reference": "<string>",
"message": "<string>",
"debtor": {
"name": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"postalCode": "<string>",
"city": "<string>",
"country": "<string>"
}
},
"undeliverableReason": "<string>",
"batchId": "<string>"
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}Authorizations
Dairo API key, e.g. dairo_test_... or dairo_live_...
Headers
Optional idempotency key for safe retries of side-effecting operations.
128Body
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.
Show child attributes
Show child attributes
Base64-encoded PDF (alternative to file).
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.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
economy, priority, registered, bulk, premium 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.
Values for the template's {{placeholder}} variables. Ignored unless templateId is set.
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.
Email the account owner a status update at notable delivery milestones.
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).
qr, sepaDe, sepaAt, 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.
Show child attributes
Show child attributes
Response
Success
letter draft, queued, processing, printable, submitted, in_transit, delivered, undeliverable, canceled, failed Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
economy, priority, registered, bulk, premium standard, qr, sepa_at, sepa_de Show child attributes
Show child attributes
Show child attributes
Show child attributes
The chosen payment-slip overlay, or null for a normal letter.
qr, sepaDe, sepaAt, null True for a validate/price-only letter that is never mailed or charged.
Owner milestone-email preference for this letter.
The structured payment object the slip was generated from (owner records), or null.
Show child attributes
Show child attributes
Human-readable reason when the letter reached undeliverable; null otherwise.
The owning batch id for a batch-member letter; null for a single send. Pairs with the ?batchId= list filter.