Use Pingen's fully scalable API for automated letter sending. Our powerful API enables your software solution to directly send physical mail by post. Integration is a breeze with our SDKs, allowing you to get up and running in just 5 minutes.
Pingen's letter API enables seamless software integration for automatic letter delivery through local post and DHL.
Free of charge
We're passionate about process automation. That’s why we offer our API at no cost.
Powerful SDKs
Use our SDKs for PHP, Python and .Net to send letters via DHL quickly and efficiently.
Supported payment forms
Automatically print Swiss QR invoices or SEPA payment slips in Germany and Austria.
Made for developers
All features are accessible through our letter API and explained in the documentation.
Track and Trace
Pingen offers real-time progress updates for every letter sent through the API
Generate revenue
Integrators can unlock new revenue opportunities by reselling postal letters.
Pingen’s Snail Mail API is crafted for flexibility and simplicity, ensuring effortless integration. Alongside user-friendly documentation, we provide code examples for a swift start.
import pingen2sdk
pingen2sdk.client_id = "YOUR_OAUTH2_CLIENT_ID"
pingen2sdk.client_secret = "YOUR_OAUTH2_CLIENT_SECRET"
resp = pingen2sdk.OAuth.get_token(
grant_type = "client_credentials",
scope = "letter batch webhook organisation_read",
)
try:
print(
pingen2sdk.FileUpload(pingen2sdk.APIRequestor(resp["access_token"]))
.request_file_upload()
.data
)
except pingen2sdk.error.PingenError as e:
print(e.status_code)
print(e.json_body)
require __DIR__ . '/vendor/autoload.php';
$provider = new \Pingen\Provider\Pingen(
array(
'clientId' => 'YOUR_OAUTH2_CLIENT_ID',
'clientSecret' => 'YOUR_OAUTH2_CLIENT_SECRET'
)
);
$access_token = $provider->getAccessToken('client_credentials');
$lettersEndpoint = (new \Pingen\Endpoints\LettersEndpoint($access_token))
->setOrganisationId('INSERT_YOUR_ORGANISATION_UUID_HERE');
$lettersEndpoint->uploadAndCreate(
(new \Pingen\Endpoints\DataTransferObjects\Letter\LetterCreateAttributes())
->setFileOriginalName('your_original_pdf_name.pdf')
->setAddressPosition('left')
->setAutoSend(false),
fopen('path_to_your_original_pdf_name.pdf', 'r')
);
import json
import requests
url_file_upload = 'https://api.v2.pingen.com/file-upload'
url_letters = 'https://api.v2.pingen.com/organisations/YOUR_ORGANISATION_UUID/letters'
access_token = 'INSERT_YOUR_ACCESS_TOKEN_HERE'
response = requests.get(url_file_upload, headers = {
'Authorization': 'Bearer {}'.format(access_token),
})
data = json.loads(response.text)['data']
file_url = data['attributes']['url']
file_url_signature = data['attributes']['url_signature']
file = open('path_to_your_file.pdf', 'rb')
requests.put(file_url, data=file)
file.close()
payload = {
'data': {
'type': 'letters',
'attributes': {
'file_original_name': 'your_filename.pdf',
'file_url': file_url,
'file_url_signature': file_url_signature,
'address_position': 'left',
'auto_send': False
}
}
}
requests.post(
url_letters,
json.dumps(payload),
headers = {
'Content-Type': 'application/vnd.api+json',
'Authorization': 'Bearer {}'.format(access_token)
})
$accessToken = 'INSERT_YOUR_ACCESS_TOKEN_HERE';
$organisationUuid = 'YOUR_ORGANISATION_UUID';
$filePath = 'path_to_your_file.pdf';
$fileName = 'your_filename.pdf';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.pingen.com/file-upload");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $accessToken"]);
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response, true);
$fileUploadUrl = $responseData['data']['attributes']['url'];
$fileUrlSignature = $responseData['data']['attributes']['url_signature'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $fileUploadUrl);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_INFILE, fopen($filePath, 'r'));
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($filePath));
$response = curl_exec($ch);
curl_close($ch);
$letterData = [
'data' => [
'type' => 'letters',
'attributes' => [
'file_original_name' => $fileName,
'file_url' => $fileUploadUrl,
'file_url_signature' => $fileUrlSignature,
'address_position' => 'left',
'auto_send' => false,
'delivery_product' => 'fast',
'print_mode' => 'simplex',
'print_spectrum' => 'color'
]
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.pingen.com/organisations/$organisationUuid/letters");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($letterData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: Bearer $accessToken"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
curl \
-X GET "https://api.v2.pingen.com/file-upload" \
-H "Authorization: Bearer INSERT_YOUR_ACCESS_TOKEN_HERE"
# Extract data.attributes.url and data.attributes.url_signature from response
curl -X PUT -T path_to_your_file.pdf "INSERT_URL_FROM_INITIAL_CURL_REQUEST"
curl \
-X POST "https://api.v2.pingen.com/organisations/INSERT_YOUR_ORGANISATION_UUID_HERE/letters" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer INSERT_YOUR_ACCESS_TOKEN_HERE" \
--data-binary @- << EOF
{
"data": { \
"type": "letters", \
"attributes": { \
"file_original_name": "your_filename.pdf", \
"file_url": "INSERT_URL_FROM_INITIAL_CURL_REQUEST", \
"file_url_signature": "INSERT_URL_SIGNATURE_FROM_INITIAL_CURL_REQUEST", \
"address_position": "left", \
"auto_send": false, \
"delivery_product": "fast", \
"print_mode": "simplex", \
"print_spectrum": "color" \
} \
} \
}
EOF
Sending snail mail via Pingen’s letter API is as easy as sending a standard email. Our API is digital and fully scalable.
Pingen automatically verifies all submitted PDFs to ensure compliance with postal letter requirements. If any criteria are not met, Pingen offers solutions directly through the API.
If any letters fail to be delivered, they are automatically captured by the Pingen DMC, destroyed securely, and reported via webhooks, ensuring undeliverable letters are always processed digitally.
Pingen provides a dedicated staging environment for developers to test integrations. This sandbox mirrors all Pingen features for thorough testing before sending any letters.
Use the price calculator to preview the cost of your physical mail in advance. This ensures full cost transparency before sending any letters, allowing for better budget management.
Pingen provides automatic webhook notifications for key events, ensuring timely updates on letter status. You'll be alerted instantly about sent letters, issues, or undeliverable items. This allows for quick reaction, without the need to actively monitor our API.
Within Pingen's webhook management, you gain access to detailed request information, including payload and system responses. This allows for quick problem identification and solving with minimal effort.
Our PHP library ensures effortless integration with our API, facilitating letter sending via local post and DHL. Pingen had already done the heavy lifting for PHP developers. Our easy-to-use SDKs are available for all developers.
Our letter API goes beyond traditional solutions offered by lettershops or mail service providers. Pingen provides access to a rapidly expanding international service, enabling cost-effective global snail mail delivery.
Currently, letters are printed and dispatched locally in Germany, Austria, Switzerland, India and the Netherlands.
Thanks to our collaboration with DHL, Pingen ensures fast and reliable delivery to all remaining countries via air mail.
Pingen easily scales and ensures fail-safe operations with our cloud-based and multi-site printing infrastructure.
Pingen enables you to send letters directly via email, S3, Google Drive, OneDrive , Zapier and many more.
With our global reach and partnerships with local carriers and DHL, Pingen prints and delivers at competitive rates.
Pingen offers a wide range of practical and innovative features for efficient snail mail delivery – both locally and globally!
Explore our letter API documentation and discover the simplicity of integrating snail mail delivery into your software solution!