Scalable API to automate your letter sending

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.

Letter API for sending letters via DHL

API for print and mail automation

Pingen's letter API enables seamless software integration for automatic letter delivery through local post and DHL.

Letter API

Free of charge

We're passionate about process automation. That’s why we offer our API at no cost.

Powerful SDKs

Powerful SDKs

Use our SDKs for PHP, Python and .Net to send letters via DHL quickly and efficiently.

Payment forms

Supported payment forms

Automatically print Swiss QR invoices or SEPA payment slips in Germany and Austria.

Letter API made for developers

Made for developers

All features are accessible through our letter API and explained in the documentation.

Track and Trace

Track and Trace

Pingen offers real-time progress updates for every letter sent through the API

Generate revenue

Generate revenue

Integrators can unlock new revenue opportunities by reselling postal letters.

Fast, powerful and user-friendly letter API

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

Print and mail API for postal letters

Sending snail mail via Pingen’s letter API is as easy as sending a standard email. Our API is digital and fully scalable.

API documentation
Learn more
Online letter mailing
Automated document validation

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.

Automate Letter Mailing
Digital returns processing

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.

Detailed Track & Trace
Test environment

Pingen provides a dedicated staging environment for developers to test integrations. This sandbox mirrors all Pingen features for thorough testing before sending any letters.

Digital Returns Processing
Detailed Pricing Calculator

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.

Real-time status updates via webhooks

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.

Shipping costs statistics
Pingen PHP library

Smooth integration with Pingen's PHP library

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.

More than just a lettershop API

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.

Local print and mail service

Local print and mail service

Currently, letters are printed and dispatched locally in Germany, Austria, Switzerland, India and the Netherlands.

International delivery

International delivery

Thanks to our collaboration with DHL, Pingen ensures fast and reliable delivery to all remaining countries via air mail.

Scalable and reliable API

Scalable and reliable

Pingen easily scales and ensures fail-safe operations with our cloud-based and multi-site printing infrastructure.

Easy API integration – start developing now

Explore our letter API documentation and discover the simplicity of integrating snail mail delivery into your software solution!