curl -X POST https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send \
-H "Authorization: Bearer tpc_your_api_key"
const response = await fetch(
"https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send",
{
method: "POST",
headers: { "Authorization": "Bearer tpc_your_api_key" },
}
);
const data = await response.json();
console.log(data.status); // "processing"
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "processing",
"balance_cents": 750
}
{
"error": "Letter cannot be sent — current status is 'sent'"
}
{
"error": "Insufficient balance",
"balance_cents": 100,
"letter_price_cents": 250
}
{
"error": "Letter not found"
}
Letters
Send a Draft
Send a draft letter for printing and postal delivery.
POST
/
api
/
v1
/
letters
/
{letterId}
/
send
curl -X POST https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send \
-H "Authorization: Bearer tpc_your_api_key"
const response = await fetch(
"https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send",
{
method: "POST",
headers: { "Authorization": "Bearer tpc_your_api_key" },
}
);
const data = await response.json();
console.log(data.status); // "processing"
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "processing",
"balance_cents": 750
}
{
"error": "Letter cannot be sent — current status is 'sent'"
}
{
"error": "Insufficient balance",
"balance_cents": 100,
"letter_price_cents": 250
}
{
"error": "Letter not found"
}
Send a Draft
Send a letter that is currently indraft status. This deducts your balance and queues the letter for printing and delivery.
Path parameters
string
required
The unique letter ID of the draft to send.
Response
string
The letter ID.
string
Will be
"processing" on success.integer
Your remaining balance in cents after sending.
Examples
curl -X POST https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send \
-H "Authorization: Bearer tpc_your_api_key"
const response = await fetch(
"https://thepostalcompany.com/api/v1/letters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/send",
{
method: "POST",
headers: { "Authorization": "Bearer tpc_your_api_key" },
}
);
const data = await response.json();
console.log(data.status); // "processing"
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "processing",
"balance_cents": 750
}
{
"error": "Letter cannot be sent — current status is 'sent'"
}
{
"error": "Insufficient balance",
"balance_cents": 100,
"letter_price_cents": 250
}
{
"error": "Letter not found"
}
Error codes
| Status | Description |
|---|---|
400 | Letter is missing required content or address |
401 | Missing, invalid, or revoked API key |
402 | Insufficient balance |
404 | Letter not found or does not belong to your account |
409 | Letter is not in draft status |
