Authenticate with DHL MyDHL API using HTTP Basic Authentication with your API key and secret (verify authentication scheme and base URL in current DHL MyDHL API docs, as credentials and endpoint may vary by region).
GET the rates endpoint (verify path in current docs) with query parameters for 'accountNumber', 'originCountryCode', 'originCityName', 'destinationCountryCode', 'destinationCityName', 'weight', 'length', 'width', 'height', 'plannedShippingDateAndTime', and 'isCustomsDeclarable' (boolean for international dutiable shipments); the response lists available DHL Express product codes and rates.
Select the product code (e.g., 'P' for DHL Express Worldwide; verify current product codes in DHL docs) that meets your cost and transit time requirements.
POST to the shipments endpoint (verify path in current docs) with a comprehensive request body including 'productCode', 'plannedShippingDateAndTime', 'pickup', 'accounts' (with your account number and 'typeCode'), 'customerDetails' (shipper and receiver with full address and contact), 'content' (with 'packages' including weight/dimensions and 'commodities' for customs), and 'outputImageProperties' (label format).
Parse the response for 'shipmentTrackingNumber', 'trackingUrl', 'packages' with per-piece waybill numbers, and 'documents' containing base64-encoded label and shipment documents.
Decode and print the label; attach all required customs documents to the physical shipment.
Known gotchas
DHL Express international shipments require 'commodities' data (description, quantity, weight, unit price, HS code, country of manufacture) for customs; missing or inaccurate commodity data can cause customs clearance failures.
DHL MyDHL API has regional variants; the base URL and some field behaviors may differ between DHL's Americas, Europe, and Asia-Pacific environments — confirm the correct regional endpoint with DHL support.
Pickup scheduling is part of the shipment creation request for DHL Express (via the 'pickup' object); unlike some carriers, you do not schedule pickup separately by default.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp