DHL Express - Create Shipment / Label
Description
Section titled “Description”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.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | DHL Express credential (provider: dhl_express) |
| shipper | textarea | Yes | Sender data in JSON format with postalAddress and contactInformation |
| receiver | textarea | Yes | Recipient data in JSON format |
| product_code | select | Yes | DHL 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) |
| weight | text | Yes | Package weight in kilograms |
| description | text | Yes | Shipment content description |
| label_type | select | No | Label format: PDF (default), ZPL, LP2 |
Credentials
Section titled “Credentials”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/).
Output
Section titled “Output”{ "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"}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "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"}API Used
Section titled “API Used”- Endpoint: POST
/shipments - Base: DHL Express API (via helper
_dhlHelper) - Documentation: https://developer.dhl.com/api-reference/dhl-express-mydhl-api
- 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