python-inema
python-inema is a Python package that implements the "Internetmarke" web API for interacing with HTTP endpoints of the German postal company Deutsche Post, in order to buy printable letter postage, online.
The Internetmarke web API is offered by Deutsche Post and allows you to buy online franking for national and international postal products like post cards and letters of all weight classes and service classes (normal, registered, ...).
Supported APIs:
- Internetmarke REST API (released 2024), cf.
inema.rest - Internetmarke SOAP API (V3, aka 1C4A Webservice API), end of life
end of 2025, cf.
inema.inema - Product Webservice SOAP API (ProdWS), cf.
inema.inema.ProductInformation - Warenpost International REST API (released 2020), cf.
inema.wpint
Note
As of 2025, AFAICS, Deutsche Post publishes only the documentation of it's server-side web APIs, i.e. it does not publish client libraries for any programming language.
API Credentials
As of 2025, Deutsche Post offers access to its APIs only to business customers. That means to use it you either have to have some kind of registered business ('Gewerbe') or self-employment ('selbständige Erwerbstätigkeit').
The registration workflow differs between the various APIs:
- Internetmarke REST API: register at the Deutsche Post DHL API Developer Portal (cf. Internetmarke Get Started Section)
- Product Webservice SOAP API: basically, you need to write to pcf-1click@deutschepost.de (cf. ProdWS documentation)
- Warenpost International API: you need to contact your Deutsche Post sales representative (cf. Deutsche Post International documentation)
Warning
FWIW, Deutsche Post refers its private customers to its online shop that doesn't provide any API access.
Portokasse
Futhermore, for actually purchasing postage via the API, you need a special wallet: a 'Portokasse'.
That means you need to register separately a Portokasse account and link it to your API account.
Note
The Portokasse web portal username/password credentials are the same that are required for an Internet API session. That means the Portokasse doesn't have a concept API keys or similar.
See also:
- Internetmarke Overview Section in the Deutsche Post API documentation for general Portokasse integration notes
- Internetmarke Portokasse Section in the Deutsche Post API documentation that describes how to get a special Portokasse for testing purposes ('Entwickler-Portokasse').
Tip
A Entwickler-Portokasse is recommended for first steps and especially so for running the test_rest.py test suite that is port of the python-inema repository.
Internetmarke API SOAP Migration
See the inema.soapfree module for comments and hints.
Sources
The python-inema source code is available from the following official locations:
- https://gitea.sysmocom.de/odoo/python-inema.git
- https://codeberg.org/gms/python-inema
- https://pypi.org/project/inema/
- https://inema.readthedocs.io/en/latest/
Authors / History
In 2016, Harald Welte started developing python-inema for internal use at his company sysmocom, in order to provide franking from the Odoo based logistics system. Like most other software at sysmocom, it was released as open source software under a strong network copyleft license.
Shortly after the initial release, Georg
Sauthoff joined the development and improved and extended the code
im various ways. He also added the command-line frank.py.
In 2025 he added support for the new Internetmarke REST API.
License
The python-inema software package is licensed under the LGPL-3.0-or-later license.