const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
front_image_url: 'https://cdn.thanks.io/letter-backgrounds/bg0.png',
message: 'Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!',
handwriting_style_id: 4,
recipients: [
{
name: 'Current Resident',
address: '123 Main Street',
city: 'Fake City',
province: 'NY',
postal_code: '55555',
country: 'US',
custom1: 'Example Custom 1',
custom2: 'Example Custom 2',
custom3: 'Example Custom 3',
custom4: 'Example Custom 4'
},
{
name: 'Jane Doe',
address: '456 Another St',
city: 'Fake City',
province: 'NY',
postal_code: '55555',
country: 'US'
}
]
})
};
fetch('https://api.thanks.io/api/v2/estimate/windowlessletter', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.thanks.io/api/v2/estimate/windowlessletter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"front_image_url": "https://cdn.thanks.io/letter-backgrounds/bg0.png",
"message": "Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!",
"handwriting_style_id": 4,
"recipients": [
{
"name": "Current Resident",
"address": "123 Main Street",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US",
"custom1": "Example Custom 1",
"custom2": "Example Custom 2",
"custom3": "Example Custom 3",
"custom4": "Example Custom 4"
},
{
"name": "Jane Doe",
"address": "456 Another St",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US"
}
]
}
'import requests
url = "https://api.thanks.io/api/v2/estimate/windowlessletter"
payload = {
"front_image_url": "https://cdn.thanks.io/letter-backgrounds/bg0.png",
"message": "Hey %FIRST_NAME%!,
THANK YOU for allowing us the opportunity to HELP you with your plan!",
"handwriting_style_id": 4,
"recipients": [
{
"name": "Current Resident",
"address": "123 Main Street",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US",
"custom1": "Example Custom 1",
"custom2": "Example Custom 2",
"custom3": "Example Custom 3",
"custom4": "Example Custom 4"
},
{
"name": "Jane Doe",
"address": "456 Another St",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message": "OK",
"data": {
"type": "windowlessletter",
"size": null,
"total_recipients": 2,
"recipients": {
"united_states": 2,
"international": 0
},
"pending_email_lookups": 0,
"costs_in_cents": {
"united_states": 236,
"international": 0,
"additional_pages": 0,
"giftcard_face_value": 0,
"grand_total": 236
},
"total_cost_in_cents": 236,
"total_cost": "$2.36",
"current_balance_in_cents": 5000,
"covered_by_balance": true,
"test_mode": false,
"notes": []
}
}{
"message": "Sub Account ID does not exist"
}{
"message": "Unauthorized"
}{
"status": "API access has been temporarily disabled due to repeated payment failures. Please update your payment method.",
"message": "API access has been temporarily disabled due to repeated payment failures. Please update your payment method.",
"code": "api_disabled_payment_failures"
}Estimate Windowless Letter
Price a windowless letter order without placing it. Send the same request body you would send to Send Windowless Letter: nothing is charged, nothing is printed or mailed, and no order is created.
The request is validated exactly as the send is, so a payload the send would reject is rejected here too. Recipients with only an email address are priced as if the email-to-address lookup finds them, and counted in pending_email_lookups. A radius_search is counted and priced, but no records are purchased.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
front_image_url: 'https://cdn.thanks.io/letter-backgrounds/bg0.png',
message: 'Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!',
handwriting_style_id: 4,
recipients: [
{
name: 'Current Resident',
address: '123 Main Street',
city: 'Fake City',
province: 'NY',
postal_code: '55555',
country: 'US',
custom1: 'Example Custom 1',
custom2: 'Example Custom 2',
custom3: 'Example Custom 3',
custom4: 'Example Custom 4'
},
{
name: 'Jane Doe',
address: '456 Another St',
city: 'Fake City',
province: 'NY',
postal_code: '55555',
country: 'US'
}
]
})
};
fetch('https://api.thanks.io/api/v2/estimate/windowlessletter', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.thanks.io/api/v2/estimate/windowlessletter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"front_image_url": "https://cdn.thanks.io/letter-backgrounds/bg0.png",
"message": "Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!",
"handwriting_style_id": 4,
"recipients": [
{
"name": "Current Resident",
"address": "123 Main Street",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US",
"custom1": "Example Custom 1",
"custom2": "Example Custom 2",
"custom3": "Example Custom 3",
"custom4": "Example Custom 4"
},
{
"name": "Jane Doe",
"address": "456 Another St",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US"
}
]
}
'import requests
url = "https://api.thanks.io/api/v2/estimate/windowlessletter"
payload = {
"front_image_url": "https://cdn.thanks.io/letter-backgrounds/bg0.png",
"message": "Hey %FIRST_NAME%!,
THANK YOU for allowing us the opportunity to HELP you with your plan!",
"handwriting_style_id": 4,
"recipients": [
{
"name": "Current Resident",
"address": "123 Main Street",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US",
"custom1": "Example Custom 1",
"custom2": "Example Custom 2",
"custom3": "Example Custom 3",
"custom4": "Example Custom 4"
},
{
"name": "Jane Doe",
"address": "456 Another St",
"city": "Fake City",
"province": "NY",
"postal_code": "55555",
"country": "US"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message": "OK",
"data": {
"type": "windowlessletter",
"size": null,
"total_recipients": 2,
"recipients": {
"united_states": 2,
"international": 0
},
"pending_email_lookups": 0,
"costs_in_cents": {
"united_states": 236,
"international": 0,
"additional_pages": 0,
"giftcard_face_value": 0,
"grand_total": 236
},
"total_cost_in_cents": 236,
"total_cost": "$2.36",
"current_balance_in_cents": 5000,
"covered_by_balance": true,
"test_mode": false,
"notes": []
}
}{
"message": "Sub Account ID does not exist"
}{
"message": "Unauthorized"
}{
"status": "API access has been temporarily disabled due to repeated payment failures. Please update your payment method.",
"message": "API access has been temporarily disabled due to repeated payment failures. Please update your payment method.",
"code": "api_disabled_payment_failures"
}Authorizations
Bearer token authentication using your thanks.io API key
Body
Set to true to return a preview instead of sending the mail piece. You can use this with any send call to inspect the output before submitting the order.
true
Mailing list IDs to send to. Required if recipients and radius_search are not provided.
[5166, 514]
Recipients to send to. Required if mailing_list_ids and radius_search are not provided.
Create a recipient by providing address details
- Create Recipient by Address
- Create Recipient by Email
Show child attributes
Show child attributes
Use a radius search to find recipients near an address. Required if mailing_list_ids and recipients are not provided. Lookup fees are $0.05 per record.
Show child attributes
Show child attributes
ID of handwriting style to use.
4
Handwriting color to use. Options are preset named colors or specified as hex format, such as '#4287f5'
blue, black, green, purple, red "blue"
"#4287f5"
Set to true to enable the realism effect for AI fonts.
true
Sub-account ID to use for this order.
7
Optional comma-separated list of email addresses to notify about order events such as QR scan notifications.
"ops@example.com,sales@example.com"
Set to true to use Standard Mail postage. If false or omitted, account default is used.
Custom return name for the order.
"Custom Return"
Custom return address for the order.
"1 Main Street"
Custom return address line 2 for the order.
"Unit 1"
Custom return city for the order.
"Woodbridge"
Custom return state/province for the order.
"NJ"
Custom return postal code for the order.
"07095"
Your own key/value data to store with the order. It is returned unchanged by the order endpoints and included in every webhook event for the order as order.metadata. Must be a JSON object rather than an array, and no larger than 8,192 bytes once encoded as JSON. thanks.io does not print or otherwise act on these values.
{
"crm_deal_id": "D-1042",
"campaign": "spring-winback",
"source": "hubspot"
}
ID of image template to use for the background of the cover letter. If neither image_template_id nor front_image_url is specified, a blank background will be used.
6
URL to image to use for the background of the cover letter. If neither image_template_id nor front_image_url is specified, a blank background will be used.
"https://cdn.thanks.io/letter-backgrounds/bg0.png"
Handwritten message content used for cover letter.
"Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!"
ID of message template to use for cover letter.
12
URL to Autogenerate QR Code on cover letter.
"https://www.google.com"
URL to additional pages to include with the cover letter.
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
URL to PDF file to use for entire mailer. If this is specified, no cover letter is generated. The recipient's address is printed on the envelope, so do not include it in your PDF; the full page is available for your content.
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
Was this page helpful?