Send one template to many recipients
curl --request POST \
--url https://api.dairo.app/v1/letters/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"templateId": "<string>",
"recipients": [
{
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"templateData": {}
}
],
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": true,
"notifications": true,
"metadata": {}
}
'import requests
url = "https://api.dairo.app/v1/letters/batches"
payload = {
"templateId": "<string>",
"recipients": [
{
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"templateData": {}
}
],
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": True,
"notifications": True,
"metadata": {}
}
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({
templateId: '<string>',
recipients: [
{
to: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
templateData: {}
}
],
from: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
print: {},
autoSend: true,
notifications: true,
metadata: {}
})
};
fetch('https://api.dairo.app/v1/letters/batches', 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/batches",
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([
'templateId' => '<string>',
'recipients' => [
[
'to' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'templateData' => [
]
]
],
'from' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'print' => [
],
'autoSend' => true,
'notifications' => true,
'metadata' => [
]
]),
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/batches"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\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/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters/batches")
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 \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"object": "letter_batch",
"id": "<string>",
"total": 123,
"status": "<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>"
}
}Letters
Send one template to many recipients
Send one template to many recipients
POST
/
v1
/
letters
/
batches
Send one template to many recipients
curl --request POST \
--url https://api.dairo.app/v1/letters/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"templateId": "<string>",
"recipients": [
{
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"templateData": {}
}
],
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": true,
"notifications": true,
"metadata": {}
}
'import requests
url = "https://api.dairo.app/v1/letters/batches"
payload = {
"templateId": "<string>",
"recipients": [
{
"to": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"templateData": {}
}
],
"from": {
"country": "<string>",
"name": "<string>",
"company": "<string>",
"street": "<string>",
"houseNumber": "<string>",
"poBox": "<string>",
"addressLine2": "<string>",
"postalCode": "<string>",
"city": "<string>"
},
"print": {},
"autoSend": True,
"notifications": True,
"metadata": {}
}
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({
templateId: '<string>',
recipients: [
{
to: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
templateData: {}
}
],
from: {
country: '<string>',
name: '<string>',
company: '<string>',
street: '<string>',
houseNumber: '<string>',
poBox: '<string>',
addressLine2: '<string>',
postalCode: '<string>',
city: '<string>'
},
print: {},
autoSend: true,
notifications: true,
metadata: {}
})
};
fetch('https://api.dairo.app/v1/letters/batches', 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/batches",
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([
'templateId' => '<string>',
'recipients' => [
[
'to' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'templateData' => [
]
]
],
'from' => [
'country' => '<string>',
'name' => '<string>',
'company' => '<string>',
'street' => '<string>',
'houseNumber' => '<string>',
'poBox' => '<string>',
'addressLine2' => '<string>',
'postalCode' => '<string>',
'city' => '<string>'
],
'print' => [
],
'autoSend' => true,
'notifications' => true,
'metadata' => [
]
]),
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/batches"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\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/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters/batches")
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 \"templateId\": \"<string>\",\n \"recipients\": [\n {\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 \"templateData\": {}\n }\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 \"notifications\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"object": "letter_batch",
"id": "<string>",
"total": 123,
"status": "<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_...
Body
application/json
The stored letter template rendered once per recipient.
Required array length:
1 - 1000 elementsShow child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
economy, priority, registered, bulk, premium Optional payment-slip overlay applied to every letter.
Available options:
qr, sepaDe, sepaAt