Skip to main content
RapidDev - Software Development Agency
retool-integrationsREST API Resource

How to Integrate Retool with DHL API

Connect Retool to DHL's APIs using a REST API Resource with API key authentication. DHL offers separate REST API products — the DHL Express API for shipment creation and tracking, the Parcel Tracking API for tracking numbers across DHL services, and the eCommerce API for shipping label generation. Point the resource at your relevant DHL API base URL, configure the DHL-API-Key header, and build an international logistics dashboard for tracking shipments, calculating duties, and managing customs documentation.

What you'll learn

  • How to register on DHL's developer portal and obtain API keys for the relevant DHL API products
  • How to configure a REST API Resource in Retool for DHL's tracking and shipping endpoints
  • How to build queries for tracking international shipments and fetching delivery event timelines
  • How to create a logistics dashboard showing shipment status, location history, and estimated delivery
  • How to handle DHL's international customs data and duties estimation in a Retool panel
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate17 min read30 minutesOtherLast updated April 2026RapidDev Engineering Team
TL;DR

Connect Retool to DHL's APIs using a REST API Resource with API key authentication. DHL offers separate REST API products — the DHL Express API for shipment creation and tracking, the Parcel Tracking API for tracking numbers across DHL services, and the eCommerce API for shipping label generation. Point the resource at your relevant DHL API base URL, configure the DHL-API-Key header, and build an international logistics dashboard for tracking shipments, calculating duties, and managing customs documentation.

Quick facts about this guide
FactValue
ToolDHL API
CategoryOther
MethodREST API Resource
DifficultyIntermediate
Time required30 minutes
Last updatedApril 2026

Build an International Shipping Operations Dashboard in Retool Using DHL API

DHL is the world's leading international courier service, specializing in cross-border shipping with customs clearance, duties and taxes management, and delivery to over 220 countries. For logistics and operations teams that manage international shipments, a Retool dashboard connected to DHL's APIs provides visibility into the entire shipment lifecycle — from pickup to customs clearance to final delivery — without requiring team members to log into DHL's customer portals or parse carrier notification emails.

DHL's developer platform (developer.dhl.com) organizes API access into distinct products: the Shipment Tracking API for querying tracking status across DHL services, the Express API for creating and managing DHL Express shipments (including label generation), the eCommerce API for parcel shipping, and the Parcel DE API for German domestic parcel services. For most international shipping dashboards, the Shipment Tracking API is the starting point — it accepts tracking numbers and returns the full event history with timestamps, locations, and status codes.

The most compelling Retool use case for DHL is an operations team dashboard that aggregates all active DHL shipments, shows those currently in customs clearance, flags shipments with exception statuses (delivery attempt failed, customs hold, etc.), and surfaces the expected delivery dates for the highest-priority shipments. This view typically replaces a daily manual process of checking each tracking number in DHL's web interface — a significant time saving for teams managing more than a handful of international shipments simultaneously.

Integration method

REST API Resource

DHL's developer platform provides multiple REST API products, each with their own base URL and authentication requirements. The DHL Parcel Tracking API and Express API use API key authentication via a DHL-API-Key header. Retool connects via a REST API Resource, configuring the appropriate base URL and API key header once. Because Retool proxies all requests server-side, DHL credentials never reach the browser and CORS is not an issue. JavaScript transformers normalize DHL's nested shipment and tracking event data into clean table rows for logistics dashboards.

Prerequisites

  • A DHL developer account registered at developer.dhl.com
  • API credentials for the specific DHL API product you need (Shipment Tracking, Express, or eCommerce) — each product requires separate registration and approval
  • For Express API: a DHL Express customer account number linked to your developer account
  • A Retool account with permission to create Resources
  • Your internal database or spreadsheet containing DHL tracking numbers or order data to enrich with tracking information

Step-by-step guide

1

Register on DHL's developer portal and obtain API credentials

DHL's developer platform is at developer.dhl.com. Create an account using your business email address. After email verification, you can explore DHL's available API products. Each API product has a separate registration and approval process — select the APIs relevant to your use case. For a tracking dashboard, register for the DHL Unified Tracking API (labeled 'Shipment Tracking' in the portal). Click 'Get Access' and complete the registration form, which asks for your intended use case and expected API call volume. DHL typically approves tracking API access within 24-48 hours for business accounts. After approval, your API key appears in the developer portal under the approved API's credential section. For the DHL Express API (for creating shipments, not just tracking), you additionally need to link a DHL Express customer account number — this requires contacting DHL Express sales or your account manager to enable API access on your existing DHL account. The Express API base URL is https://express.api.dhl.com/mydhlapi and the Tracking API base URL is https://api.dhl.com/track/shipments. API authentication uses a DHL-API-Key header for the tracking API and HTTP Basic Authentication (username + password from the Express API credentials) for the Express API. Store your tracking API key in a Retool Configuration Variable named DHL_TRACKING_API_KEY marked as secret. If using the Express API, store your username as DHL_EXPRESS_USERNAME and password as DHL_EXPRESS_PASSWORD, both marked as secret.

Pro tip: DHL's developer portal provides a sandbox environment with test tracking numbers for each API product. Use sandbox credentials during development to avoid consuming production API quota. Sandbox tracking numbers are documented in the API reference for each product on developer.dhl.com.

Expected result: DHL API credentials are obtained for the relevant API products and stored as secret Configuration Variables in Retool. The developer portal shows approved API access for your registered products.

2

Configure the REST API Resource in Retool

In Retool, navigate to the Resources tab and click Add Resource. Select REST API. Name the resource 'DHL Tracking API'. Set the Base URL to https://api.dhl.com/track/shipments (for the Unified Tracking API). For the DHL Tracking API, authentication uses a custom header. Scroll to the Headers section and add a custom header: Name → DHL-API-Key, Value → {{ retoolContext.configVars.DHL_TRACKING_API_KEY }}. Add a second header: Accept → application/json to ensure JSON responses. Click Save Resource. If you also need the DHL Express API for shipment creation, create a second resource named 'DHL Express API' with Base URL https://express.api.dhl.com/mydhlapi and select Basic Authentication with username {{ retoolContext.configVars.DHL_EXPRESS_USERNAME }} and password {{ retoolContext.configVars.DHL_EXPRESS_PASSWORD }}. Test the Tracking API resource by creating a query in a Retool app: set Method to GET and Path to / (empty path to track a shipment use /trackingNumber query param). Add URL parameter trackingNumber → 1234567890 (any valid test tracking number). A successful 200 response returns shipment tracking data. A 404 means the tracking number is not found. A 401 means the API key header is missing or incorrect. A 404 on the base path is expected — use a real or sandbox tracking number to verify authentication succeeds.

Pro tip: Use DHL's sandbox tracking numbers for initial testing: the developer portal provides test tracking numbers for each API product that simulate different shipment scenarios (in transit, delivered, customs hold, exception). These allow you to test your UI rendering without consuming production API quota.

Expected result: The DHL Tracking API resource is configured in Retool with the DHL-API-Key header. A test query with a valid tracking number returns shipment status and event history.

3

Build tracking queries and event timeline transformers

Create the core tracking queries. Create a query named 'trackSingleShipment'. Set Method to GET and Path to / (the DHL Tracking API path structure uses the base URL itself, with trackingNumber as a URL parameter). Add URL parameters: trackingNumber → {{ trackingInput.value }}, requesterCountryCode → {{ retoolContext.configVars.DHL_REQUESTER_COUNTRY || 'US' }} (the country code of the requester, required by some DHL tracking endpoints). The response JSON contains a shipments array (even for a single tracking number). Each shipment object has: id (tracking number), service (DHL service used), origin (address object), destination (address object), status (current status object with timestamp, location, description, and statusCode), events (array of all tracking events in reverse chronological order), and estimatedTimeOfDelivery. Create a transformer named 'normalizeTrackingData' that extracts the first shipment from the array and formats it: current status code, current status description, origin city and country, destination city and country, estimated delivery date formatted as a readable string, number of total events, days since first scan, and a boolean for whether the shipment has any exception-type status codes (useful for conditional formatting). Create a second transformer named 'normalizeTrackingEvents' that maps the events array to a flat list: each event has timestamp (formatted), location (city + country), description, and statusCode. Sort by timestamp descending for a most-recent-first display.

tracking_events_transformer.js
1// Transformer: normalize DHL tracking events
2const shipments = data.shipments || [];
3if (shipments.length === 0) return [];
4
5const shipment = shipments[0];
6const events = shipment.events || [];
7
8const EXCEPTION_CODES = ['transit-exception', 'failure', 'customs-hold',
9 'returned', 'lost'];
10
11return events.map(event => ({
12 timestamp: event.timestamp
13 ? new Date(event.timestamp).toLocaleString()
14 : 'N/A',
15 location: [
16 event.location?.address?.addressLocality,
17 event.location?.address?.countryCode
18 ].filter(Boolean).join(', ') || 'Unknown',
19 description: event.description || event.status || '',
20 status_code: event.typeCode || '',
21 is_exception: EXCEPTION_CODES.some(code =>
22 (event.typeCode || '').toLowerCase().includes(code)
23 )
24}));

Pro tip: DHL's tracking API returns timestamps in ISO 8601 format with timezone offsets. When displaying these in Retool, use toLocaleString() with an options object to control the timezone display — for an international shipping dashboard, consider displaying all times in UTC to avoid confusion across time zones.

Expected result: The trackSingleShipment query returns formatted shipment status and a normalized event timeline for display in Retool Table and Text components.

4

Build batch tracking for multiple shipments from a database

For an operational dashboard tracking dozens or hundreds of active shipments, fetching tracking data one by one through a form input is impractical. Build a batch tracking workflow using your internal order database. Create a query named 'getActiveOrders'. This uses a PostgreSQL or other database resource to fetch all orders with DHL tracking numbers that are not yet in a final delivery status: SELECT order_id, customer_name, tracking_number, destination_country, order_date FROM orders WHERE carrier = 'DHL' AND delivery_status NOT IN ('delivered', 'returned') ORDER BY order_date DESC LIMIT 100. Create a JavaScript query named 'batchTrackShipments'. This iterates over getActiveOrders.data and calls the DHL Tracking API for each tracking number. Use Promise.all to parallelize requests (limit to 5 concurrent to respect rate limits): split the array into chunks of 5, process each chunk with Promise.all, then concatenate results. Each result is merged with the order record by tracking_number to produce rows containing both order metadata (customer name, order ID) and tracking status (current status, last location, estimated delivery). Store the merged results in a Retool state variable named 'batchTrackingResults'. Create a transformer that flags shipments with exception statuses, those in customs for more than 5 days, and those with no movement in more than 7 days. These flagged rows form the alert section of your dashboard.

batch_tracking.js
1// JavaScript query: batch track multiple DHL shipments
2// References getActiveOrders.data for tracking numbers
3const orders = getActiveOrders.data || [];
4const CHUNK_SIZE = 5;
5
6const chunks = [];
7for (let i = 0; i < orders.length; i += CHUNK_SIZE) {
8 chunks.push(orders.slice(i, i + CHUNK_SIZE));
9}
10
11const allResults = [];
12for (const chunk of chunks) {
13 const chunkResults = await Promise.all(
14 chunk.map(async order => {
15 try {
16 const result = await dhlTrackingResource.get('/', {
17 params: { trackingNumber: order.tracking_number }
18 });
19 const shipment = result.data?.shipments?.[0] || {};
20 return {
21 order_id: order.order_id,
22 customer: order.customer_name,
23 tracking_number: order.tracking_number,
24 destination: order.destination_country,
25 status: shipment.status?.description || 'Unknown',
26 status_code: shipment.status?.typeCode || '',
27 last_location: [
28 shipment.status?.location?.address?.addressLocality,
29 shipment.status?.location?.address?.countryCode
30 ].filter(Boolean).join(', '),
31 eta: shipment.estimatedTimeOfDelivery
32 ? new Date(shipment.estimatedTimeOfDelivery).toLocaleDateString()
33 : 'N/A',
34 has_exception: ['failure', 'returned'].some(e =>
35 (shipment.status?.typeCode || '').includes(e))
36 };
37 } catch (e) {
38 return { ...order, status: 'API Error', has_exception: false };
39 }
40 })
41 );
42 allResults.push(...chunkResults);
43}
44
45return allResults;

Pro tip: For complex logistics Retool dashboards combining DHL tracking data with customs documentation, shipment creation workflows, and carrier rate comparison across multiple logistics providers, RapidDev's team can help architect and build the complete shipping operations solution.

Expected result: The batch tracking query returns a merged dataset of all active DHL shipments with both order metadata and current tracking status, ready for display in the main operations dashboard table.

5

Assemble the international shipping operations dashboard UI

Build the complete shipping dashboard. Add a Stat bar at the top with four Stat components: Active Shipments ({{ getActiveOrders.data.length }}), In Transit (count of shipments where status_code includes 'transit'), In Customs (count where last_location includes 'customs' or status includes 'customs'), and Exception Alerts (count of has_exception === true). Below the stats, add an Alert Banner component (red, warning-style) that shows when exception shipments exist: 'You have {{ exceptionCount }} shipments with delivery exceptions. Review below.' Make this banner conditionally visible using {{ batchTrackingResults.filter(s => s.has_exception).length > 0 }}. Add a Table named 'shipmentsTable' with Data bound to the batchTrackingResults state variable. Configure columns: tracking_number (as a link to DHL's tracking page: https://www.dhl.com/us-en/home/tracking/tracking-express.html?submit=1&tracking-id={{ row.tracking_number }}), customer, destination, status (color-coded tag: green for delivered, blue for in-transit, red for exception, orange for customs), last_location, and eta. Enable row selection. On row selection, show a detail Container on the right side displaying the full event timeline from trackSingleShipment.data (triggered on selection). Add a Refresh button that triggers batchTrackShipments on click. Add a Search input that filters the table client-side by tracking number or customer name using Retool's table search feature.

Pro tip: Add a filter button labeled 'Exceptions Only' that filters the shipmentsTable to show only rows where has_exception is true. This lets operations staff focus on the most critical shipments without scrolling through all active orders. Implement the filter using a Boolean state variable and a .filter() call in the table's data binding.

Expected result: A complete international shipping operations dashboard shows all active DHL shipments with status, location, and ETA, with exception alerts highlighted and a drill-down event timeline for each shipment.

Common use cases

Build a shipment tracking dashboard showing active international orders

Create a Retool dashboard that queries DHL's Tracking API for all active shipment tracking numbers stored in your internal order database. Display each shipment's current status, last known location, estimated delivery date, and number of days in transit. Flag shipments with exception statuses (customs delay, delivery failure, damage) in red. Allow operations staff to click into any shipment to see the full event timeline with timestamps and location details.

Retool Prompt

Build a Retool shipment tracker for DHL. Fetch tracking numbers from the orders database. For each, query DHL Tracking API and show: tracking number, origin, destination, current status, last event location, and estimated delivery date in a Table. Highlight exception statuses in red. On row selection, show a timeline of all tracking events with location, timestamp, and description.

Copy this prompt to try it in Retool

Build a customs clearance monitoring panel for international shipments

Create a Retool panel that filters all active DHL shipments to show only those currently in customs clearance, sorted by the number of days since entering customs. Show the commodity description, declared value, destination country customs requirements, and any customs messages from DHL. Alert on shipments that have been in customs for more than 5 business days without movement — these likely require intervention from the customs broker.

Retool Prompt

Build a Retool customs clearance monitor for DHL shipments. Filter tracking events to find shipments with 'customs' in their status. Show a Table with tracking number, origin country, destination country, declared value, days in customs, and latest customs event message. Highlight rows where days in customs exceeds 5 with an orange warning indicator.

Copy this prompt to try it in Retool

Build a DHL shipment creation and label management panel

Create a Retool form for generating DHL Express shipment requests: enter sender and recipient details, package dimensions and weight, service type (Express Worldwide, Express 12:00, etc.), and customs declaration information. Submit the form to create the shipment via DHL's Express API, receive the tracking number and label URL, and automatically store both in the order management database. Include a table of recently created shipments with download links for labels.

Retool Prompt

Build a Retool DHL shipment creator using the Express API. Form fields: sender address, recipient address, package dimensions, weight, service type Select, declared value, and commodity description for customs. Submit button creates the shipment. Show tracking number and a Download Label button on success. Log all created shipments to the orders database.

Copy this prompt to try it in Retool

Troubleshooting

401 Unauthorized — 'Missing or invalid credentials' on DHL Tracking API requests

Cause: The DHL-API-Key header is missing from the resource configuration, the API key is incorrect, or the key was generated for a different DHL API product (e.g., an Express API key used with the Tracking API endpoint).

Solution: In the Retool resource settings, verify the custom header name is exactly DHL-API-Key (capital D, capital H, capital L, hyphen, capital A, capital P, capital I, hyphen, capital K). DHL's header authentication is case-sensitive. Confirm the API key in the Configuration Variable matches the key shown for the correct API product in the DHL developer portal. Each DHL API product (Tracking, Express, eCommerce) issues separate credentials.

404 Not Found for a tracking number that shows results on DHL's website

Cause: DHL's API may lag the web tracking interface by a few hours for newly created shipments. Additionally, the API requires the requesterCountryCode parameter for some tracking scenarios, and missing it can cause 404 responses for shipments that require country-specific routing.

Solution: Add the requesterCountryCode URL parameter to your tracking query with the two-letter ISO country code of your organization's location (e.g., US, DE, GB). If the shipment was created in the last 4 hours, wait and retry — there can be a propagation delay before new tracking numbers appear in the API. Verify you are using the correct tracking number format: DHL Express uses a 10-digit format; DHL eCommerce uses a different format. Match the tracking number format to the correct API product.

Batch tracking query hits DHL API rate limits — some tracking calls fail with 429 errors

Cause: DHL's Tracking API enforces rate limits per API key (typically 250 requests per hour or lower depending on your plan). Sending all tracking requests simultaneously using Promise.all without throttling exceeds this limit.

Solution: Reduce the CHUNK_SIZE constant in the batch tracking JavaScript query from 5 to 2 or 3, and add a delay between chunks: use await new Promise(resolve => setTimeout(resolve, 500)) between processing each chunk to introduce a 500ms pause. Monitor your DHL developer portal's API usage dashboard to understand the rate limits on your plan. For large shipment volumes, consider running batch tracking in a Retool Workflow on a schedule rather than on demand.

typescript
1// Add delay between chunks to avoid rate limits
2for (const chunk of chunks) {
3 const chunkResults = await Promise.all(chunk.map(/* ... */));
4 allResults.push(...chunkResults);
5 // 500ms delay between chunk requests
6 await new Promise(resolve => setTimeout(resolve, 500));
7}

Event timestamps display in the wrong timezone in the Retool table

Cause: DHL returns timestamps in ISO 8601 format with local timezone offset of the scanning location. JavaScript's toLocaleString() uses the browser's local timezone by default, causing displayed times to shift based on the user's location.

Solution: Standardize all timestamp display to UTC in the transformer: use timestamp.toLocaleString('en-US', { timeZone: 'UTC', month: 'short', day: 'numeric', year: 'numeric', hour: '2-digit', minute: '2-digit' }) + ' UTC'. Alternatively, display timestamps as relative time using a helper function: show '2 hours ago' rather than an absolute time for events within the last 24 hours. This approach is timezone-agnostic and easier for international teams to parse.

typescript
1// Timezone-normalized timestamp formatting
2const formatTimestamp = (ts) => {
3 const date = new Date(ts);
4 return date.toLocaleString('en-US', {
5 timeZone: 'UTC',
6 month: 'short', day: 'numeric', year: 'numeric',
7 hour: '2-digit', minute: '2-digit'
8 }) + ' UTC';
9};

Best practices

  • Store DHL API credentials in Retool Configuration Variables marked as secret — separate variables for each DHL API product (tracking key, express username/password) since they have different scopes and rotation schedules
  • Use DHL's sandbox environment with test tracking numbers during development to avoid consuming production API quota and test different shipment scenarios (delivered, exception, customs) without creating real shipments
  • Implement chunked batch processing with 500ms delays between chunks when fetching tracking data for multiple shipments — DHL's rate limits are strict and exceeding them causes all subsequent requests to fail until the rate limit window resets
  • Display all DHL event timestamps in UTC with an explicit 'UTC' suffix rather than converting to local time — DHL operates internationally and timestamps from different scanning locations in different timezones become confusing if converted to the user's local timezone
  • Build exception alerting as the first visible section of any shipping dashboard — shipments with failed delivery attempts, customs holds, or return triggers need immediate operations team attention, and they should be visible without scrolling
  • Store tracking results in a Retool Database table after each batch refresh with a timestamp, rather than re-querying the API every time the dashboard is viewed — this reduces API consumption and provides a history of status changes over time
  • Include a direct link to DHL's web tracking portal (formatted as https://www.dhl.com/tracking?id={tracking_number}) for each shipment row in the Retool table — some tracking details and customs documentation are only visible in DHL's full web interface
  • Combine DHL tracking data with your internal order database using a JOIN query so the dashboard shows customer-facing order information (customer name, order ID, product type) alongside carrier tracking data — pure tracking numbers have no business meaning to the operations team

Alternatives

Frequently asked questions

Does Retool have a native DHL connector?

No, Retool does not have a native DHL connector. You connect via a REST API Resource using DHL's API key header authentication for the Tracking API, or Basic Authentication for the Express API. Each DHL API product has a separate base URL and authentication method, requiring separate Retool resources. The setup takes about 30 minutes including DHL developer portal registration.

What DHL API products do I need for a tracking dashboard?

For tracking existing shipments, register for DHL's Unified Shipment Tracking API at developer.dhl.com — this is a free API product that supports DHL Express, DHL Parcel, and DHL eCommerce tracking numbers. For creating new shipments and generating labels, you additionally need the DHL Express API, which requires linking a DHL Express customer account. For domestic parcel shipping in Germany, the DHL Parcel DE API is the appropriate product.

How many DHL tracking requests can I make per hour?

DHL's Unified Tracking API rate limits vary by plan and registration type. Typical limits for business accounts are 250-1,000 requests per hour. For a dashboard tracking dozens of active shipments with auto-refresh, implement chunked batch processing with delays between chunks and refresh the full dataset every 15-30 minutes rather than continuously. Monitor your usage in the DHL developer portal dashboard to understand your specific rate limit tier.

Can I track DHL shipments created by customers, not just shipments I created?

Yes. DHL's Tracking API works with any valid DHL tracking number, regardless of which party created the shipment. If customers provide their DHL tracking numbers, you can track those shipments in your Retool dashboard. The API returns the same event data available on DHL's public tracking website. Some shipment details (shipper address, declared value) may be redacted for privacy in API responses for shipments not created by your account.

How do I handle DHL's customs event codes in my Retool dashboard?

DHL uses statusCode values in tracking events to indicate customs processing stages. Common customs-related codes include 'transit-customs-clearance', 'customs-hold', and similar. In your transformer, check event.typeCode against a lookup object of known customs codes and display human-readable labels instead of the raw code values. Build a separate filter or view for shipments where any event has a customs-related type code to give your operations team quick access to shipments requiring customs attention.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.