Skip to content

DHL Express - Create Shipment / Label

This module creates a shipment in DHL Express through its REST API. It receives the sender and recipient data in JSON format, along with the DHL product code, package weight, and content description. The module builds the complete payload including the planned shipping date, account configuration, customs details (automatically determined based on whether the shipment is international), and label options. It makes a POST request to the /shipments endpoint of DHL Express and returns the tracking number, tracking URL, label in base64, and dispatch confirmation number.

ParameterTypeRequiredDescription
credentials_idcredentialsYesDHL Express credential (provider: dhl_express)
shippertextareaYesSender data in JSON format with postalAddress and contactInformation
receivertextareaYesRecipient data in JSON format
product_codeselectYesDHL product code: P (Express Worldwide), D (Express Worldwide Doc), U (Express Worldwide EU), K (Express 9:00), T (Express 12:00), Y (Express 12:00 Doc), N (Domestic Express)
weighttextYesPackage weight in kilograms
descriptiontextYesShipment content description
label_typeselectNoLabel format: PDF (default), ZPL, LP2

A dhl_express type credential is required with the following fields:

  • api_key: DHL Express API Key
  • account_number: DHL Express account number

Credentials are obtained from the DHL developer portal (https://developer.dhl.com/).

{
"success": true,
"shipment_id": "1234567890",
"tracking_number": "1234567890",
"tracking_url": "https://www.dhl.com/track/1234567890",
"label_base64": "JVBERi0xLjQK...",
"dispatch_confirmation": "DPC-001",
"message": "Envio DHL creado - Tracking: 1234567890"
}
{
"credentials_id": "mi_credencial_dhl",
"shipper": "{\"postalAddress\":{\"postalCode\":\"28001\",\"cityName\":\"Madrid\",\"countryCode\":\"ES\",\"addressLine1\":\"Calle Gran Via 1\"},\"contactInformation\":{\"fullName\":\"Mi Empresa\",\"phone\":\"+34600000000\",\"email\":\"envios@miempresa.com\"}}",
"receiver": "{\"postalAddress\":{\"postalCode\":\"08001\",\"cityName\":\"Barcelona\",\"countryCode\":\"ES\",\"addressLine1\":\"Av Diagonal 100\"},\"contactInformation\":{\"fullName\":\"Cliente\",\"phone\":\"+34600000001\",\"email\":\"cliente@email.com\"}}",
"product_code": "P",
"weight": "2.5",
"description": "Articulos electronicos",
"label_type": "PDF"
}
  • The shipping date is automatically set at the time of creation
  • Customs declaration is automatically activated when the origin and destination countries are different
  • Package dimensions default to 1x1x1; for specific dimensions, modify the shipper JSON
  • The default label format is PDF with ECOM26_84_001 template at 300 DPI
  • Pickup is configured as not requested by default