Cancel a letter that has not yet been dispatched
curl --request POST \
--url https://api.dairo.app/v1/letters/{id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dairo.app/v1/letters/{id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dairo.app/v1/letters/{id}/cancel', 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/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.dairo.app/v1/letters/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/{id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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>"
}
}Letters
Cancel a letter that has not yet been dispatched
Cancel a letter that has not yet been dispatched
POST
/
v1
/
letters
/
{id}
/
cancel
Cancel a letter that has not yet been dispatched
curl --request POST \
--url https://api.dairo.app/v1/letters/{id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dairo.app/v1/letters/{id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dairo.app/v1/letters/{id}/cancel', 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/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.dairo.app/v1/letters/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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/{id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/letters/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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_...
Path Parameters
Response
Success
Available options:
letter Available options:
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
Available options:
economy, priority, registered, bulk, premium Available options:
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.
Available options:
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.