Letters
Create a letter
Create a letter from a template or content blocks. Set auto_send to print and post immediately.
POST
/
v1
/
letters
Create a letter
curl --request POST \
--url https://api.yorlet.com/v1/letters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": {
"customer": "<string>",
"owner": "<string>"
},
"auto_send": false,
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"delivery_product": "standard",
"name": "<string>",
"template": "<string>",
"variables": {}
}
'import requests
url = "https://api.yorlet.com/v1/letters"
payload = {
"recipient": {
"customer": "<string>",
"owner": "<string>"
},
"auto_send": False,
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"delivery_product": "standard",
"name": "<string>",
"template": "<string>",
"variables": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipient: {customer: '<string>', owner: '<string>'},
auto_send: false,
blocks: [{type: 'heading', content: '<string>'}],
delivery_product: 'standard',
name: '<string>',
template: '<string>',
variables: {}
})
};
fetch('https://api.yorlet.com/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.yorlet.com/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([
'recipient' => [
'customer' => '<string>',
'owner' => '<string>'
],
'auto_send' => false,
'blocks' => [
[
'type' => 'heading',
'content' => '<string>'
]
],
'delivery_product' => 'standard',
'name' => '<string>',
'template' => '<string>',
'variables' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.yorlet.com/v1/letters"
payload := strings.NewReader("{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.yorlet.com/v1/letters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yorlet.com/v1/letters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": 123,
"object": "letter",
"address_position": "left",
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"customer": "<string>",
"delivery_error": "<string>",
"delivery_product": "standard",
"name": "<string>",
"owner": "<string>",
"page_count": 123,
"recipient_type": "customer",
"sent_at": 123,
"status": "draft",
"template": "<string>",
"tracking_number": "<string>",
"variables": {},
"account": "<string>",
"deleted": false
}Body
application/json
Response
200 - application/json
Returns the letter object if the request succeeded.
Was this page helpful?
Create a letter
curl --request POST \
--url https://api.yorlet.com/v1/letters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": {
"customer": "<string>",
"owner": "<string>"
},
"auto_send": false,
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"delivery_product": "standard",
"name": "<string>",
"template": "<string>",
"variables": {}
}
'import requests
url = "https://api.yorlet.com/v1/letters"
payload = {
"recipient": {
"customer": "<string>",
"owner": "<string>"
},
"auto_send": False,
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"delivery_product": "standard",
"name": "<string>",
"template": "<string>",
"variables": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipient: {customer: '<string>', owner: '<string>'},
auto_send: false,
blocks: [{type: 'heading', content: '<string>'}],
delivery_product: 'standard',
name: '<string>',
template: '<string>',
variables: {}
})
};
fetch('https://api.yorlet.com/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.yorlet.com/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([
'recipient' => [
'customer' => '<string>',
'owner' => '<string>'
],
'auto_send' => false,
'blocks' => [
[
'type' => 'heading',
'content' => '<string>'
]
],
'delivery_product' => 'standard',
'name' => '<string>',
'template' => '<string>',
'variables' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.yorlet.com/v1/letters"
payload := strings.NewReader("{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.yorlet.com/v1/letters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yorlet.com/v1/letters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": {\n \"customer\": \"<string>\",\n \"owner\": \"<string>\"\n },\n \"auto_send\": false,\n \"blocks\": [\n {\n \"type\": \"heading\",\n \"content\": \"<string>\"\n }\n ],\n \"delivery_product\": \"standard\",\n \"name\": \"<string>\",\n \"template\": \"<string>\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created": 123,
"object": "letter",
"address_position": "left",
"blocks": [
{
"type": "heading",
"content": "<string>"
}
],
"customer": "<string>",
"delivery_error": "<string>",
"delivery_product": "standard",
"name": "<string>",
"owner": "<string>",
"page_count": 123,
"recipient_type": "customer",
"sent_at": 123,
"status": "draft",
"template": "<string>",
"tracking_number": "<string>",
"variables": {},
"account": "<string>",
"deleted": false
}