The Ultimate Guide to Tracking International Shipments with the DHL Tracking API
To track international shipments with a DHL tracking API, first identify the DHL service handling each shipment, then select the relevant API in the DHL Developer Portal. Once access is approved, your application can request tracking information, translate the returned events into customer-friendly updates, and keep checking until delivery or another final outcome is confirmed. The difficult part is not displaying a status: it is handling cross-border handoffs, incomplete events, time zones, and exceptions without telling customers more than the data actually proves.

This guide is for developers and operations teams building shipment visibility into an order management system, customer account, or support workflow. DHL offers different services and developer resources, so treat the documentation for your specific product and account as the authority on authentication, request fields, event definitions, and usage conditions. If you only need to check one parcel, DHL’s public tracking page is usually a simpler starting point than an API integration.
Start with the shipment, not the endpoint
Before writing code, establish what the tracking identifier represents. A merchant order number, a DHL tracking number, and a reference supplied by a logistics partner may all identify the same purchase internally, but an API will not necessarily accept them interchangeably. Record the carrier service, the identifier received from the shipping workflow, and the order it belongs to. If a shipment contains multiple parcels, keep a separate record for each parcel identifier rather than assuming one response describes the whole order.
The label on a shipping confirmation is not always enough to establish which DHL API applies. DHL operates across distinct shipping services, and documentation or access arrangements can differ. In the DHL Developer Portal, check the API description against the service used to create the shipment. Confirm these points before committing to an integration:
- Which shipment services and tracking identifiers the API accepts.
- Whether your use case and account are eligible for access.
- How credentials are issued, stored, and sent with requests.
- Which environments, request parameters, and response fields are documented.
- How errors, usage limits, and any notification options work for your access arrangement.
Do not assume a sample request found for one DHL API applies to every DHL shipment. An integration can be technically valid yet return no useful result if it is pointed at the wrong service or supplied with an unsupported identifier.
Build a reliable tracking workflow
1. Capture identifiers at the right point
Save the tracking number as soon as the shipping system or logistics partner provides it. Associate it with an internal shipment ID, the relevant order, and, where known, the DHL service. Preserve the original identifier exactly as received, even if you also store a normalized version for lookup. This makes it easier to investigate failures caused by formatting or by mapping the wrong parcel to a customer.
A newly created label does not always mean the parcel has entered the carrier’s physical network. In your interface, distinguish “label created” or “tracking information received” from a scan showing that DHL has possession of the shipment. If the API has no event yet, avoid presenting that absence as proof of a lost package.
2. Request updates and retain the underlying events
Implement requests using the authentication and parameters specified in the documentation for the API you selected. Store the response’s useful shipment-level fields and event history rather than keeping only the latest display sentence. Event timestamps, locations, descriptions, and identifiers provide context for support investigations and for correcting a status that was classified too broadly.
Keep the raw carrier message alongside your own normalized status. A manageable internal model might distinguish pre-transit, in transit, delivery exception, out for delivery, delivered, and outcome unknown. These are application categories, not a claim that DHL returns precisely those labels. Map each documented carrier event to a category deliberately, and leave unfamiliar events unmapped or marked for review instead of silently calling them “in transit.”
3. Decide when to refresh
Refresh timing should reflect what your chosen DHL API permits and what users need. Check the applicable documentation and account terms before setting a polling schedule; do not assume that frequent requests will produce faster physical scans. Your application should handle temporary failures, avoid duplicate work, and stop routine refreshes when a shipment reaches a confirmed final state. If your approved API supports event notifications, evaluate them against polling for your workflow rather than assuming all DHL APIs provide the same delivery mechanism.
Use an internal queue or scheduled job for refreshes when practical. This prevents a customer page load from depending entirely on a live carrier response. Display the time of the most recent successful check, especially when the current request fails. “Last checked” is more informative than showing an old status as if it were live.
4. Present a status that reflects the evidence
Show the carrier’s meaningful event description, location when available, and the event time with a clear time-zone label. A customer-facing timeline can simplify technical wording, but it should not convert an ambiguous scan into a guaranteed delivery date. Keep shipment progress separate from an estimated arrival date if your system has both. An estimate may change without a new physical scan, and a scan can occur without changing the estimate.
What changes when a shipment crosses a border?
International tracking is a sequence of events reported by parties and systems involved in moving a shipment. It is not a continuous live location feed. A long interval between scans may reflect transport, processing, or a gap in reported events. It does not, by itself, identify the cause of a delay.
Customs is a particularly common source of overconfident messaging. A tracking event may indicate that a shipment is undergoing a customs-related process or that information is needed, but the event alone may not tell your customer who must act or when release will occur. If a carrier message contains a specific instruction, present it accurately and direct the recipient to the appropriate DHL channel for confirmation. Do not infer that customs clearance is complete from an arrival scan or that every customs event requires the recipient to pay a charge.
Cross-border routes can also involve changes in the party responsible for the next movement or delivery. If you receive another tracking identifier from a shipping partner, link it to the original shipment only when your shipping records establish that relationship. Do not guess that two similarly timed tracking records belong to the same parcel. For customer support, retaining the original identifier and each verified subsequent identifier makes a handoff easier to investigate.
Time zones need equal care. Store event timestamps in a consistent internal format where the source data allows it, but preserve the original timestamp and location context. For display, make it clear whether an event is shown in the shipment’s local time or the viewer’s time. An event appearing “out of order” can be a time-zone conversion problem rather than an error in the shipment sequence.
Handle missing, delayed, and conflicting results
Design your application around states you will encounter, not just the successful response in a documentation example. A useful distinction is between “no matching shipment found,” “shipment found but no new event,” and “tracking request failed.” They call for different responses. The first may require checking the identifier and service; the second may require waiting for another scan; the third may require retrying after the technical issue is resolved.
For repeated errors, record the request context and the error information permitted by your security practices, without exposing credentials or unnecessary personal data in logs. If an API reports that a request is unauthorized, rechecking the tracking number will not solve the credential problem. Likewise, do not treat a temporary service error as evidence that a parcel has disappeared.
Events may arrive late or be corrected. Build the timeline so it can insert a newly received event in the appropriate order without duplicating existing entries. Preserve a distinction between the time an event happened and the time your system learned about it. For a shipment marked delivered, use the carrier’s reported result as the basis for the status, while leaving room for a recipient to report a delivery dispute. A “delivered” scan is not, by itself, a complete account of where a parcel was left or who received it.
When a DHL API is the right fit—and when to consider another approach
A DHL API is a direct starting point when your application needs programmatic tracking for shipments handled by a supported DHL service and your team can maintain the integration. It gives you a documented path to request carrier tracking data. Before building, verify that the particular API, your account access, and the identifiers you receive match your shipment flow.
If your business ships with several carriers, the architecture changes. You can integrate each carrier separately, or evaluate a multi-carrier tracking API as a shared layer for collecting and presenting updates. 17TRACK’s Tracking API is one option to examine for that scenario; its developer documentation is the appropriate place to check integration requirements and supported tracking workflows. Do not assume a multi-carrier service reproduces every field or event available from a direct carrier API. Test the DHL services and tracking identifiers your business actually uses, alongside your other shipment types.
For a sound proof of concept, collect representative examples: a newly created label, an active international shipment, a customs-related event, an exception, a delivery, and a case with no result. Compare the completeness and timing of the data your chosen approach returns against the customer and operations decisions you need to make. That test is more useful than deciding solely from a feature list.
A pre-launch checklist
- Service match: Verify that your DHL API choice covers the shipments and identifiers you will submit.
- Access and security: Confirm account permissions and protect credentials; keep them out of client-side code and public logs.
- Data model: Store order, shipment, and parcel identifiers separately, with raw events and customer-facing statuses.
- Freshness: Record the last successful check and define what the interface shows when data cannot be refreshed.
- International events: Test customs wording, handoffs, local timestamps, and gaps between scans.
- Exceptions: Define a support path for an unknown identifier, a tracking failure, a stalled shipment, and a disputed delivery.
- Operations: Monitor failed requests and status-mapping errors, and revisit the integration when the relevant API documentation changes.
The most useful tracking implementation is one that helps a recipient understand what is known, what is not yet known, and where to go for help. Start with the correct DHL service and API, preserve the carrier’s event context, and make every customer-facing status no stronger than the underlying evidence.
FAQ
Can I use a DHL tracking API for every DHL shipment?
Do not assume so. Check the specific API’s supported services, identifiers, and access requirements in the DHL Developer Portal. DHL-branded shipments can follow different service workflows.
Why does a valid tracking number return no events?
The first scan may not have been reported yet, or the identifier may not match the API or service being queried. Check the number, its source, and the applicable documentation. If the request failed, resolve that error before drawing a conclusion about the shipment.
Does a customs event mean the recipient must take action?
Not necessarily. Follow the wording of the reported event. If the message gives a specific instruction, direct the recipient to the relevant DHL channel to verify the required action; do not infer a payment or documentation requirement from a generic customs status.
Should my application call the API every time a customer opens the tracking page?
Not necessarily. A stored status with a visible last-checked time can keep the page usable when a live request fails. Choose a refresh method consistent with your API access and the level of freshness your users need.
When does a multi-carrier tracking API make sense?
It is worth evaluating when your team needs a shared tracking workflow across DHL and other carriers. Test real shipments and the event detail your use case requires before replacing or supplementing a direct carrier integration.
Sources
- DHL Developer Portal — API discovery and service-specific integration documentation.
- DHL Tracking — public shipment-tracking entry point.
- 17TRACK Tracking API — product information for evaluating a multi-carrier API.
- 17TRACK API Documentation — developer reference for the 17TRACK integration.


