PostNL and DHL API Integration | MG Software
Connect your WMS, webshop or order platform to PostNL and DHL for automated label creation, track and trace and return handling. MG Software builds carrier integrations that scale.

What is PostNL and DHL?
PostNL and DHL are the two dominant parcel carriers in the Netherlands, jointly processing millions of shipments every day. Both provide business APIs that let you programmatically generate shipping labels, schedule pickups, calculate rates and follow shipment status. For companies shipping dozens to thousands of parcels daily, manual labeling is simply no longer feasible.
PostNL offers a Shipping API with REST endpoints for creating labels in various formats (A4, A6, thermal printer), a Confirming API for registering shipments with the sorting center and a Track and Trace API that returns status information per barcode. Authentication uses API keys linked to your commercial PostNL contract. In addition, PostNL supports webhooks that push status updates to your system.
DHL provides a Parcel API for domestic and European shipments and an Express API for international time-critical deliveries. DHL authentication uses API keys and sometimes additional account credentials, depending on the product. Labels are returned as PDF or ZPL, and DHL also offers tracking endpoints and status notifications.
The key difference between the two carriers lies in API structure, label fields, error codes and tracking event terminology. Where PostNL uses barcode types and product codes specific to the Dutch market, DHL follows a more international product model. A well-designed integration abstracts these differences behind a shared interface, so your application does not become dependent on the quirks of any single carrier.
Why integrate?
As long as shipping labels are created manually through the PostNL or DHL web portals, your fulfillment process remains vulnerable to address typos, incorrect product codes and missed cutoff times. Every mistake that only surfaces at the sorting center causes delays, extra costs and a disappointed customer. Automation eliminates these risks structurally.
An integrated system generates labels directly from your order management or WMS. As soon as a picking round is completed, the system requests labels from the right carrier, prints them in the desired format and confirms the shipment automatically. The warehouse operator only needs to stick the label on the parcel. The entire flow, from order to label, takes seconds rather than minutes.
Track-and-trace integration makes it possible to inform your customers proactively about the status of their order. Instead of directing them to the PostNL or DHL website, you display tracking information inside your own portal or send automated emails and push messages when relevant status changes occur. This improves customer satisfaction and reduces the volume of "where is my parcel" inquiries to your support team.
For companies that offer both carriers, for example based on destination, weight or service level, a multi-carrier integration adds the flexibility to select the best option per shipment. Your system can automatically decide whether a parcel travels via PostNL or DHL based on configurable rules, without an operator making that choice by hand.
Common use cases
- Automatically generate PostNL and DHL shipping labels from your WMS after completing a picking wave
- Select the carrier per shipment based on destination, weight and service level for optimal routing
- Forward track-and-trace events to your customer notification system for proactive status updates
- Include return labels with outbound shipments or generate them on demand from a customer portal
- Schedule pickup requests with PostNL or DHL automatically based on expected volume and cutoff times
- Calculate shipping rates before order confirmation so customers see accurate delivery costs upfront
- Process batch labels for high-volume days such as Black Friday or seasonal peaks
- Generate customs documents and CN23 forms for international shipments outside the EU
- Store shipment history centrally for analysis of delivery times, cost per carrier and return rates
- Validate addresses upfront using postcode APIs to prevent returns caused by undeliverable shipments
Technical approach
The core of our approach is a carrier abstraction layer. Rather than scattering PostNL- and DHL-specific code throughout your application, we define a shared interface with operations like createShipment, getLabel, getTracking and createReturn. Each carrier receives an adapter that implements this interface and handles the translation to its specific API format. This means you can add a third carrier later without modifying existing code.
For PostNL we implement the Shipping API v2, configure the correct product codes (standard, letterbox parcel, evening delivery) and generate labels in the format that matches your label printer. The Confirming API is triggered once a shipment physically leaves the warehouse, and tracking updates are received via webhooks or polling and stored locally.
For DHL we connect the Parcel API for national and European shipments and, when needed, the Express API for time-critical international deliveries. DHL labels are retrieved as PDF or ZPL depending on your print infrastructure. Status updates flow through the DHL Tracking API with webhook integration where available.
Cutoff times are critical in logistics integrations. Your system needs to know when the last pickup of the day occurs, and shipments registered after the deadline must automatically roll to the next business day. We model cutoff configuration per carrier, per location and per service level.
Error handling deserves extra attention because label failures have direct impact on customer satisfaction. We classify errors by type: address validation failures are surfaced to the operator for correction, transient errors are retried via a queue with backoff, and structural API issues escalate to an alert channel. Every label that cannot be created is logged with full context for fast diagnosis.
Implementation steps
- 1
Carrier analysis and contract verification
We verify that your commercial contracts with PostNL and DHL include the required API access and that sandbox environments are available. We also inventory which product codes, service options and label formats are relevant to your operation.
- 2
Abstraction layer design
We define a carrier interface with operations for label creation, tracking, returns and rate calculation. Each carrier gets an adapter implementing this interface. The design is documented in an architecture sketch reviewed with your team.
- 3
PostNL adapter build and test
We implement the PostNL Shipping API, Confirming API and Tracking API. Labels are generated in the correct format, barcodes are stored and tracking events are processed. Everything is tested against the PostNL sandbox with representative shipments.
- 4
DHL adapter build and test
We implement the DHL Parcel API and optionally the Express API. Label fields are mapped, status codes are translated to the shared model and the adapter is tested against the DHL test environment.
- 5
Carrier selection logic and cutoff configuration
We build the decision logic that chooses the right carrier per shipment based on destination, weight, service level and cutoff times. These rules are configurable so your logistics team can adjust them without developer involvement.
- 6
Go-live, monitoring and handover
After staging acceptance we switch to production API keys. We monitor closely during the first weeks for label failures, tracking gaps and performance issues. Runbooks and documentation are handed over to your team.
Security and compliance
PostNL and DHL API keys grant access to create shipments on your commercial account, which has direct financial implications. We store keys in a secrets manager and use separate credentials per environment (development, staging, production). Keys are never included in source code and never shared through insecure channels.
Both carriers require HTTPS communication. For production environments we additionally recommend IP whitelisting where the carrier supports it, so that only your servers can make API calls. DHL offers this option explicitly; for PostNL it depends on your contract type.
Carrier webhooks are validated based on signatures or known IP ranges where available. Unknown payloads are rejected and logged. Labels containing personal address data are handled in compliance with GDPR guidelines: we retain them only as long as necessary and restrict access to authorized users.
Common challenges
The biggest challenge in a multi-carrier integration is the difference in API structure. PostNL and DHL use different field names, error codes and status terminology. Where PostNL calls a shipment "bezorgd" (delivered), DHL may use a different event schema with its own status vocabulary. Our abstraction layer translates these differences into a uniform model, but the initial mapping requires careful analysis of both API documentations.
Cutoff times are another focal point. Each carrier enforces its own deadlines that can vary by region, season and service level. If your system creates a label for a shipment that just missed the cutoff, the parcel will not be picked up until the next business day. We configure cutoff rules per carrier and location, and surface warnings when a shipment is close to the deadline.
International shipments introduce additional complexity. Outside the EU, customs documents are mandatory, including product descriptions, HS codes and value declarations. PostNL and DHL each provide separate endpoints for this. We integrate this flow into the label creation process so that customs documents are generated automatically from order data in your system.
Maintenance and monitoring
Carrier APIs are updated regularly, sometimes with changes to endpoints, product codes or authentication methods. We monitor the PostNL and DHL changelogs and schedule upgrades in maintenance windows so your operation is not surprised by breaking changes.
We also track the success rate of label creation and tracking updates daily. When the error rate exceeds a threshold, your team receives an automatic alert. Periodically we analyze log data to discover patterns, such as recurring address errors in certain regions, and advise improvements.
Investment and timeline
An integration with a single carrier, for example PostNL with label creation and tracking, typically fits within three to four weeks of development. Adding a second carrier doubles the testing effort but not the architecture cost, because the abstraction layer is already in place.
For businesses with high volumes or complex logistics, think multi-warehouse setups, international shipments with customs documents or carrier selection based on dynamic rates, the timeline is longer. We work in sprints and deliver working software after each phase.
Request a free scoping conversation. Together we map your shipment volumes, carrier needs and system landscape and provide a realistic estimate of investment and planning.
Frequently asked questions
Need this integration built?
We design reliable API integrations with monitoring, error handling, and automatic retry logic.
Start a projectRelated articles
Exact Online API Integration Services | MG Software B.V.
Connect your custom software to Exact Online for automated syncing of orders, invoices, stock and ledger data. MG Software builds reliable, production-grade integrations.
Custom Salesforce API Integration | MG Software B.V.
Connect Salesforce to your portal, data warehouse or backend. MG Software builds tailored integrations using REST, Bulk and Streaming APIs for leads, opportunities and custom objects.
Custom Shopify API Integration | MG Software B.V.
Connect Shopify to your ERP, WMS or back office. MG Software builds tailored integrations using the Admin GraphQL API and webhooks for orders, inventory and fulfillment.
REST vs GraphQL: Which API Architecture Should You Choose?
REST is simpler, GraphQL is more flexible - but which API architecture matches your data complexity? A comparison from real-world practice.