DHL API Documentation 20180305
DHL API Documentation 20180305
Version : 1.0
Date : 05-03-2018
Department : DHL MDP Development
This document is a developer's guide and provides the necessary information to integrate your
websites and mobile apps with our DHL API. Our API endpoints are implemented as RESTful web
services so they can be easily integrated on any programming platform.
A quick overview on all endpoints of the DHL API can be found in our documentation gateway:
https://api-gw.dhlparcel.nl/docs/#
In this document some of our most important API endpoints are discussed, giving their business
context and some examples on how to use specific features provided by the endpoints.
The DHL shipping interfaces are there to help you to give the best possible experience to your
end users. But if you think there is any information missing, incorrect or you wish to provide us
with suggestions, please feel free to contact us at:CIM Parcel BNL.
1.2 Intro 7
1.3 Services 8
1.4.3 Testing 10
2 Capabilities 11
2.1 Intro 12
2.2 Services 13
2.2.1 Capabilities 13
2.3.1 Examples 22
2.3.2 Responses 24
2.3.3 Testing 29
3 Labels 30
3.2 Intro 31
3.3 Services 32
3.4.3 Testing 44
4.1 Intro 46
4.2 Services 47
6 https://api-gw.dhlparcel.nl/parcel-shop-locations/<countrycode>? 48
6.1.1 Examples 48
6.1.3 Testing 54
7.1 Intro 56
7.2 Services 57
Enviroments 58
7.2.3 Testing 65
8 FAQ 66
1. Where can I find the meaning of a certain API endpoint input field? 67
7. How can I create a same day delivery (Shipment option key 'SDD')? 69
9 APPENDIX 70
A. Shipment options 71
The DHL API endpoints (but not all) make use of JWT (JSON Web Tokens) for secure
authentication and authorization. DHL secure endpoints are identified by a lock in the API docs
(see right hand side of the specific endpoint).
The JWT token is necessary to test and work in the DHL production environment when dealing
with secured endpoints. This token is to be provided in the Authorization header of the HTTP
request using the ‘Bearer’ scheme.
DHL has chosen JWT not just for authentication but also for the secure exchange of JSON
information pertaining to the user account.
Precondition
A business account is handed out by the sales department. You can place a request for an
account as a business by email to: CIM Parcel BNL
By selecting 'Settings' in the user dropdown menu and clicking the button 'CREATE API KEY' in
the tab 'API KEYS', the user-id and key are generated. Hold on to this information, since it will
only be given out once. When pressing the button again, a new user-id and key will be
generated, overwriting and invalidating the previous one.
The access token is valid for a limited time, indicated by the expiration time in the response
attribute 'accessTokenExpiration'. When this time (expressed as a unix time stamp) has expired,
the secure access can again be established by obtaining a new access token using the refresh
token and the Authenticate refresh token endpoint. Please keep in mind that this refresh token
also has an expiration date time, but it is significantly longer than that of the access token.
The reponse of the refresh endpoint is the same as the initial call to the Authenticate API key
endpoint; it also results in an access and a refresh token with expiration date times.
"accessToken":
"yJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIwOGZkMTRhMC05YWYzLTRkZDMtODU3YS1hNzUyYW
Y3ZjUyYTciLCJzdWIiOiI2YmZjNzU2MS00YjQxLTRjYjctYTFjMy1kYzMxZmFmODYwZGIiLCJvcmdhbml6YXRpb
25JZCI6ImE0MDkzM2RlLWJkMTctNDk0NC1iN2U5LTIzZmM3ZWU5YzgzNSIsIm5iZiI6MTUxMDMyNDMxNSwiZXhw
The red highlighted text is the access token to be used in the HTTP header for authentication
and the blue highlighted text is the unix time stamp for the expiration of the token (in this case,
2017-11-10 14:46:56Z).
Description URL
cURL
Response 200:
1.4.3 Testing
These test cases with their positive outcomes are merely suggestions and it is not an extensive
test set, e.g. tests with a negative outcome should also be taken into scope. Please extend with
test cases which are suitable for your line of business or wishes.
Create an authorization An access token and a refresh token with expiration are
token (initial request) returned by the My DHLParcel application.
Create an new authorization An access token and a refresh token with expiration are
with refreh token returned by the My DHLParcel application.
The Capabilities endpoint lists the available shipment options (and their exclusions) given a
certain country, parcel type and whether the recipient of the parcel is a business or a consumer.
The purpose of the endpoint is twofold: it offers all available options to choose from for a given
situation, and can then validate the interdependency of all variables for a shipment, serving as a
validation tool for your shipment request.
By situation you should think of what is possible in terms of the kind of shipment, if it is a
business-to-business or business-to-consumer shipment, does your account allow you to create
return shipments or a same day delivery.
The Create label endpoint makes use of the capabilities endpoint, thereby checking the validity
of a shipment the same way..
Preconditions
2.2.1 Capabilities
In order to get the correct capabilities for your shipment, in addition to the sender type
(mandatory), at least the top three fields in the table below should be given in order to get the
applicable set of options for a specific shipment. Without these parameters, the request will
result in a too broad dataset to be useful for a single shipment.
In certain cases, it is better to not supply the ‘parcelType’ and ‘shipmentOptions` fields. The
input fields work like a filter, returning only valid product combinations; when provided with an
impossible combination of options, the endpoint will not return an error message, but simply
return an empty list.
For example, when Saturday delivery (‘S’) is present and toBusiness is set to true, the call will
be successful, but the response will not contain possible shipment options. In fact that means
that there are none, since these options are incompatible with each other.
Parcel types can be cross-referenced through the Parcel type endpoint. This is useful since
available parcel types can differ per country. The same applies for the Shipments options
endpoint, where options differ per origin/destination country pair.
Field Description
As a result of a 'successful' call the API will return all possible parcel types, shipment options
with its exclusions.
This is just one example why the input needs to be cross-referenced with the Parcel types (or
with the Shipment options) endpoint. As already mentioned, the input in itself will not be
validated through the Capabilities endpoint. Providing non-existent or incompatible options will
just yield an empty list.
[
{
"key": "SMALL",
"minWeightKg": 0,
"maxWeightKg": 5,
"dimensions": {
"maxLengthCm": 25,
"maxWidthCm": 20,
"maxHeightCm": 5
}
},
{
"key": "MEDIUM",
"minWeightKg": 5,
"maxWeightKg": 15,
"dimensions": {
"maxLengthCm": 60,
"maxWidthCm": 50,
"maxHeightCm": 25
},
{
"key": "LARGE",
"minWeightKg": 16,
"maxWeightKg": 31,
"dimensions": {
"maxLengthCm": 120,
"maxWidthCm": 60,
"maxHeightCm": 60
}
},
{
"key": "BULKY",
"minWeightKg": 0,
"maxWeightKg": 31,
"dimensions": {
"maxLengthCm": 200,
"maxWidthCm": 120,
"maxHeightCm": 80
}
}
]
In the snippet of the Shipment options endpoint below you can see that "DOOR" is listed as an
exclusion to the shipment option "PS", indicating their incompatibility.
{
"key": "PS",
"description": "Delivery to the specified DHL Parcelshop or DHL Parcelstation",
"rank": 1,
"code": 21,
"inputType": "text",
"exclusions": [
{
"key": "EVE",
"rank": 13,
"code": 14
},
{
"key": "S",
"rank": 11,
"code": 15
},
{
"key": "NBB",
"rank": 14,
"code": 36
},
{
"key": "HANDT",
"rank": 12,
"code": 56
},
{
"key": "DOOR",
"rank": 2,
"code": 0
},
{
"key": "COD_CASH",
"rank": 17,
"code": 0,
"inputType": "number"
},
{
"key": "COD_CHECK",
"rank": 18,
"code": 0,
"inputType": "number"
},
{
"key": "EXP",
"rank": 15,
"code": 1
},
{
If, for example, a “SMALL” parcel type is chosen and the delivery of the parcel is to a business
(toBusiness = true) and the chosen option is “PS”, again the response will be successful, but
there is no result.
It might be better then not to have shipment option(s) and or parcel types as input. The
endpoint will then return all parcel types and options available based on the base input
(toBusiness, fromCountry and toCountry).
If no shipment option is entered as input for the endpoint, like in the last example (toBusiness =
true, fromCountry=NL and toCountry=NL) , the shipment option "PS" will only show up in the
result of certain parcel types.
[
{
"rank": 2,
"fromCountryCode": "NL",
"toCountryCode": "NL",
"product": {
"key": "EPL",
"label": "EUROPLUS",
"code": "04",
"menuCode": "01",
"businessProduct": true,
"monoColloProduct": false,
"softwareCharacteristic": "B2X",
"returnProduct": false
},
"parcelType": {
"key": "SMALL",
"minWeightKg": 0,
"maxWeightKg": 20,
"dimensions": {
"maxLengthCm": 80,
"maxWidthCm": 50,
"maxHeightCm": 35
}
},
"options": [
{
"key": "DOOR",
"description": "Delivery to the address of the recipient",
"rank": 2,
"code": 0,
"exclusions": [
{
"key": "PS",
"rank": 1,
"code": 21,
"inputType": "text"
},
{
"key": "BP",
"rank": 3,
"code": 91
},
{
"key": "NO_TT",
"rank": 22,
"code": 0
}
]
},
Description Production
https://api-
Capabilities gw.dhlparcel.nl/capabilities/business?
2.3.1 Examples
cURL
PHP - WordPress
<?php
// {@see https://codex.wordpress.org/HTTP_API}
$response = wp_remote_get( 'https://api-
gw.dhlparcel.nl/capabilities/business?fromCountry=NL&toCountry=NL&toBusiness=false&parc
elType=SMALL&option=PS', array(
'headers' => array(
'Accept' => 'application/json',
),
) );
if ( ! is_wp_error( $response ) ) {
// The request went through successfully, check the response code against
// what we're expecting
if ( 200 == wp_remote_retrieve_response_code( $response ) ) {
// Do something with the response
// $body = wp_remote_retrieve_body( $response );
// $headers = wp_remote_retrieve_headers( $response );
} else {
// The response code was not what we were expecting, record the message
$error_message = wp_remote_retrieve_response_message( $response );
}
} else {
// There was an error making the request
$error_message = $response->get_error_message();
}
<?php
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api-
gw.dhlparcel.nl/capabilities/business?fromCountry=NL&toCountry=NL&toBusiness=false&parc
elType=SMALL&option=PS');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/json",
]
);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
2.3.2 Responses
Response 200:
[
{
"rank": 2,
"fromCountryCode": "NL",
"toCountryCode": "NL",
"product": {
"key": "EPL",
"label": "EUROPLUS",
"code": "04",
"menuCode": "01",
"businessProduct": true,
"monoColloProduct": false,
"softwareCharacteristic": "B2X",
"returnProduct": false
},
"parcelType": {
"key": "PALLET",
"minWeightKg": 50,
"maxWeightKg": 1000,
"dimensions": {
"maxLengthCm": 240,
"maxWidthCm": 100,
"maxHeightCm": 200
}
},
"options": [
{
"key": "DOOR",
"description": "Delivery to the address of the recipient",
"rank": 2,
"code": 0,
"exclusions": [
{
"key": "PS",
"rank": 1,
"code": 21,
"inputType": "text"
},
{
2.3.3 Testing
These test cases with positive outcomes are merely suggestions and it is not an extensive test set, e.g.
tests with a negative outcome should also be taken into scope. Please extend with test cases which are
suitable for your line of business or wishes.
The Labels endpoints make it possible to create and retrieve your own labels.
The endpoints of Label are secured, therefore the use of an authorization header with 'Bearer' as
prefix and your token is required.
Preconditions
A business account is handed out by the sales department. You can place a request for an
account as a business by email to: CIM Parcel BNL
In order to create a label, a unique identifier is needed as input for the label request. The format
for this identifier is the Universally Unique Identifier (UUID). The use of UUIDs keeps our API
idempotent. It ensures in this case that a label is created uniquely and just once, without
needing to do any expensive and complicated synchronized bookkeeping.
Most programming languages and platforms have a built-in UUID generator that you can use for
this purpose.A brief explanation on the other input data is given in the table below.
Be aware that the use of an authorization token in the header of the HTTP request is mandatory.
name
firstName string N
lastName string N
companyName string N
additionalName string N
Depending on country, use designated
address endpoint to check input address
countryCode string Y
Format is checked based on country
postalCode string N Code
city string N
street string N
number string N
addition string N
email string N
phoneNumber string N
name
firstName string
lastName string
companyName string
additionalName string
Depending on country, use designated
address endpoint for address
countryCode string
Format is checked based on country
postalCode string code
city string N
street string N
number string N
addition string N
email string N
phoneNumber string N
name
firstName string N
lastName string N
companyName string N
additionalName string N
Depending on country, use designated
address endpoint to check input address
countryCode string Y
Format is checked based on country
postalCode string N code
city string N
number string N
addition string N
email string N
phoneNumber string N
accountId string Y
options array
See Capabilities endpoint in API docs
key string Y and Ad 2.
quantity integer Y
If true, PDF labels wil include a flag that
opens the print dialog in supported software
automaticPrintDialogboolean N (Acrobat reader).
For destinations offering the ‘SSN’ shipment option (e.g. Benelux) it is possible to do a shipment
on behalf of someone else. This is done by an extra information block called 'onBehalfOf'. It has
the same structure as the 'shipper' block.
"onBehalfOf": {
"name": {
"firstName": "Mr",
"lastName": "Onbehalfof",
"companyName": "DHL Parcel",
"additionalName": "Benelux"
},
"address": {
"countryCode": "NL",
"postalCode": "3542AD",
"city": "Onbehalf",
"street": "Onbehalfweg",
"number": "2",
"isBusiness": false
},
"email": "[email protected]",
"phoneNumber": "0031612345678"
}
{
"key": "SSN"
}
It is possible to do an onBehalfOf shipment outside the Benelux, but the original sender will not
be anonymous in the Track & Trace info (DHL).
In the case of an onBehalfOf shipment outside the Benelux it also necessary to use the
onBehalfOf json block, but the shipping option undisclosed sender should be left out of the
request.
Some shipments options require specifying extra information. For example, in the case of a cash
on delivery, the amount should be specified or in case of a reference, some text is needed as
input.
Whether additional information is necessary for the shipping option is determined by the 'input
type' listed with the shipment option (See Shipment Options or Capabilities endpoint).
{
"key": "REFERENCE",
"description": "Reference",
"rank": 5,
"code": 0,
"inputType": "text",
"inputMax": "15"
}
When the extra information is required the field "input" can be used to specify this.
For example in the case of a delivery to a parcel shop, the parcel shop is identified by it's id
through the input field.
{
"key": "PS",
"input": "8004-NL-272403"
}
In the situation that a parcel is to be delivered at a postbox of German PackStation, the syntax
is first the id of the parcel station delimited by ‘|’ and then the postummer of the recipient:
In case of cash on delivery, the amount that needs to be paid by the recipient serves as input.
{
"key": "COD_CASH",
"input": 5
}
Ad 3. Create return label
A label is either a 'normal', so an initial label or a return label. By setting the value of the
‘returnLabel’ attribute to ‘true’, the endpoint will create a return label; a return label is marked
as a RETURN label. Note that there must be a return product available (a setting for your
account) .
When creating a return label, make sure the receiver and shipper information are set correctly.
If a customer returns a package, the customer's address becomes the shipper's address and the
company's address becomes the receiver's address.
The create label service will produce just one label per request, but if the shipment contains
more than one piece or package it is possible to specify this on the label through ‘pieceNumber’
and ‘quantity’ request attributes.
If a shipment contains for example two packages, the label service needs to be called twice. The
information set for first call to label service would be pieceNumber 1, quantity 2. For the second
label this information is set to pieceNumber 2, quantity 2.
Multi colli is only possible if the shipment is not a single piece product (mono collo). In general
shipments meant for consumers are mono collo products, but not necessarily.
{
"rank": 2,
"fromCountryCode": "NL",
"toCountryCode": "NL",
"product": {
"key": "DFY-SDD",
"label": "DFY",
"code": "00",
"menuCode": "07",
"businessProduct": true,
"monoColloProduct": true,
"softwareCharacteristic": "B2X",
"returnProduct": false
},
"parcelType": {
"key": "MEDIUM",
"minWeightKg": 20,
"maxWeightKg": 31,
"dimensions": {
"maxLengthCm": 80,
"maxWidthCm": 50,
"maxHeightCm": 35
}
},
"options": [
{
"key": "DOOR",
"description": "Delivery to the address of the recipient",
"rank": 2,
"code": 0,
"exclusions": [
{
The endpoint will return, among other identifying information (but not the label), the registered
label id to call the label endpoint that holds the zpl or pdf label, Get label endpoint by id.
The use of the authorization token in the header of http request is mandatory.
The Get label endpoint by id has the same result as the post label endpoint and in addition the
organization-id is given.
Description URL
cURL
PHP
<?php
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api-gw.dhlparcel.nl/labels');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json; charset=utf-8",
"Authorization: Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkYWFkNzU3ZC03NGY4LTQ5YzktOWI4OC1kMzEyN2
Q2ZDczMDAiLCJzdWIiOiI5MWQ5NGZiZC0xODk2LTQyMTctODlkNy0wM2M4ZTY4Y2YwYTAiLCJvcmdhbml6YXRpb
25JZCI6ImE0MDkzM2RlLWJkMTctNDk0NC1iN2U5LTIzZmM3ZWU5YzgzNSIsIm5iZiI6MTUxMTg2NzczMSwiZXhw
IjoxNTExODY4NjMyLCJyb2xlcyI6WyJsYWJlbC1zZXJ2aWNlLkIyWCIsInBpY2t1cC1zZXJ2aWNlLkIyWCJdLCJ
hY2NvdW50cyI6WyI3NDY1NjE3MCIsIjEyMzQ1Njk4IiwiNDU5MDAxMDAiLCI0MDA0NDU4OSIsIjg3NjU0MzIxIi
wiMzMzMzMzMzMiLCIwNTkyMDUxNyIsIjA4NTAwMDAxIiwiMTIzNDU2NzgiLCIwNTk1Nzg0MCJdfQ.KywXOWovoS
Vf1WJ-CWAJ9j4rUXuMp-f0q2c2PKkOZno",
"Accept: application/pdf",
]
);
// Create body
$json_array = [
"accountId" => "01234567",
"labelId" => "85146e8f-c5c6-40a5-9a1b-25548d607cd7",
"receiver" => [
"email" => "[email protected]",
"phoneNumber" => "0031612345678",
"name" => [
"firstName" => "Slab",
"companyName" => "Lechio",
"lastName" => "Krampus"
],
"address" => [
"countryCode" => "NL",
"number" => "74",
"isBusiness" => true,
"street" => "Baan",
"city" => "Rotterdam",
"postalCode" => "3011CD"
]
],
"shipper" => [
"email" => "[email protected]",
"phoneNumber" => "0031612345678",
"name" => [
"firstName" => "Jan",
"lastName" => "Jansen"
],
"address" => [
"street" => "Reactorweg",
"city" => "Utrecht",
"number" => "25",
"postalCode" => "3542AD",
"isBusiness" => true,
"addition" => "A",
"countryCode" => "NL"
]
],
"parcelTypeKey" => "SMALL",
"pieceNumber" => 1,
"quantity" => 1,
"automaticPrintDialog" => false,
// Set body
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
<?php
// {@see https://codex.wordpress.org/HTTP_API}
$response = wp_remote_post( 'https://api-gw.dhlparcel.nl/labels', array(
'headers' => array(
'Content-Type' => 'application/json; charset=utf-8',
'Authorization' => 'Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkYWFkNzU3ZC03NGY4LTQ5YzktOWI4OC1kMzEyN2
Q2ZDczMDAiLCJzdWIiOiI5MWQ5NGZiZC0xODk2LTQyMTctODlkNy0wM2M4ZTY4Y2YwYTAiLCJvcmdhbml6YXRpb
25JZCI6ImE0MDkzM2RlLWJkMTctNDk0NC1iN2U5LTIzZmM3ZWU5YzgzNSIsIm5iZiI6MTUxMTg2NzczMSwiZXhw
IjoxNTExODY4NjMyLCJyb2xlcyI6WyJsYWJlbC1zZXJ2aWNlLkIyWCIsInBpY2t1cC1zZXJ2aWNlLkIyWCJdLCJ
hY2NvdW50cyI6WyI3NDY1NjE3MCIsIjEyMzQ1Njk4IiwiNDU5MDAxMDAiLCI0MDA0NDU4OSIsIjg3NjU0MzIxIi
wiMzMzMzMzMzMiLCIwNTkyMDUxNyIsIjA4NTAwMDAxIiwiMTIzNDU2NzgiLCIwNTk1Nzg0MCJdfQ.KywXOWovoS
Vf1WJ-CWAJ9j4rUXuMp-f0q2c2PKkOZno',
'Accept' => 'application/pdf',
),
'body' => $json,
) );
if ( ! is_wp_error( $response ) ) {
// The request went through successfully, check the response code against
// what we're expecting
if ( 200 == wp_remote_retrieve_response_code( $response ) ) {
// Do something with the response
// $body = wp_remote_retrieve_body( $response );
// $headers = wp_remote_retrieve_headers( $response );
} else {
// The response code was not what we were expecting, record the message
$error_message = wp_remote_retrieve_response_message( $response );
Response 201:
{
"labelId": "331708e4-e876-4f9a-94f3-c74bd482988b",
"labelType": "B2X_Generic_A4_Third",
"trackerCode": "JVGL01234567889003262926",
"routingCode": "2LNL3542AD+04000000",
"userId": "a86628b8-a4bd-436b-8d92-cd735223c9e5",
"orderReference": "myReference",
"pdf": "<pdf-label>"
}
Response 200:
[
{
"labelId": "ecda3006-b605-413f-b3b1-e0dca32e987e",
"orderReference": "393d649c-fdf4-4e16-b329-40c36e8cff48",
"labelType": "B2X_Generic_A4_Third",
"trackerCode": "JVGL08500001813590386271",
"routingCode": "2LIC12342+04000001",
"userId": "6bfc7561-4b41-4cb7-a1c3-dc31faf860db",
"organizationId": "a40933de-bd17-4944-b7e9-23fc7ee9c835"
Response 200:
{
"labelId": "ecda3006-b605-413f-b3b1-e0dca32e987e",
"labelType": "B2X_Generic_A4_Third",
"trackerCode": "JVGL08500001813590386271",
"routingCode": "2LIC12342+04000001",
"userId": "6bfc7561-4b41-4cb7-a1c3-dc31faf860db",
"organizationId": "a40933de-bd17-4944-b7e9-23fc7ee9c835",
"orderReference": "393d649c-fdf4-4e16-b329-40c36e8cff48",
"pdf": "<base64-encoded pdf-label>"
}
3.4.3 Testing
These test cases with positive outcomes are merely suggestions and it is not an extensive test
set, e.g. test with negative outcome should also be taken into scope. Please extend with test
cases which are suitable for your line of business or wishes.
The Parcel shop finder endpoint makes it possible to find parcel shops or DHL Servicepoints in a
country based on address information and or a wildcard.
Preconditions
So in order to get a list of parcel shops the country code is required and at least one of these
fields: free format location description, postal code, city.
Field Description
free format location description, where multiple
keywords can be entered. For example country
code 'NL' and keywords 'Tabak' and '1055' will
return a parcel shop in Amsterdam (postal code
q with 1055 in it) and that has 'Tabak' in its name.
The more specific the address is the less DHL Servicepoints will be returned and the more
accurate the result is. A query based on just the street name will not suffice. There is the option
to limit the result with the inputfield 'limit'.
The result is ordered ascending based on the geo location, meaning the nearest DHL
ServicePoint is at the top.
In the response the identification is given of a DHL ServicePoint. This id serves as extra input in
the shipment option as explained in 3.3.1 Create Label when sending a shipment to a DHL
ServicePoint.
Description URL
6.1.1 Examples
cURL
[
{
"id": "5017-ES-0000104",
"harmonisedId": "101",
"psfKey": "ES-0000104",
"shopType": "parcelShop",
"name": "FOLDER PLAZA DEL ANGEL",
"keyword": "DHL ServicePoint",
"address": {
"countryCode": "ES",
"zipCode": "28012",
"postalCode": "28012",
"city": "MADRID",
"street": "C/ PLAZA DEL ANGEL",
"number": "16",
"isBusiness": true
},
"geoLocation": {
"latitude": 40.414381,
"longitude": -3.702893
},
"distance": 284,
"openingTimes": [
{
"timeFrom": "10:00:00.000",
"timeTo": "14:00:00.000",
"weekDay": 1
},
{
{
"id": "5017-ES-0000104",
"harmonisedId": "101",
"psfKey": "ES-0000104",
"shopType": "parcelShop",
"name": "FOLDER PLAZA DEL ANGEL",
"keyword": "DHL ServicePoint",
"address": {
"countryCode": "ES",
"zipCode": "28012",
"postalCode": "28012",
"city": "MADRID",
"street": "C/ PLAZA DEL ANGEL",
"number": "16",
"isBusiness": true
},
"geoLocation": {
"latitude": 40.414381,
"longitude": -3.702893
},
"openingTimes": [
{
"timeFrom": "10:00:00.000",
"timeTo": "14:00:00.000",
"weekDay": 1
},
{
"timeFrom": "17:00:00.000",
"timeTo": "20:30:00.000",
"weekDay": 1
Place a request limit to 3 for Three parcel shops are returned in the given place by the
specific country code and place Find the nearest parcel shop location endpoint
Place a request with the ID of a The given parcel shop is returned by the Find the
parcel shop information for a specific parcel shop location endpoint.
With the Track & Trace endpoint a shipment can be tracked throughout the delivery process.
Preconditions
A token is only needed if you need to retrieve the tracker code through the label service.
See documentation on Labels endpoints.
The tracker code and optional the postal code of the receiver.
The tracker code is a return value when creating the label. See documentation on Labels
endpoints.
A call to the T&T endpoint will result in a chain of events (technically an array), where each
event falls into a category of the whereabouts of a shipment. A category holds a status which
gives a more detailed description of what might be the exact current state of the shipment.
Endpoints for the translation of these statusfields can be found in the API gateway under
Translations.
For more extensive information (shipment details) in the track & trace response the postal code
of the receiver can be added in the request.
https://api-gw.dhlparcel.nl/track-trace?key=3SBPB0000094346+9999BB
Delivery date
Initially there is no planned delivery date, but it can be calculated by deriving the transit time
set for the country of origin and destination through the Transit-times endpoint.
Based on the country codes of origin, destination and the postal code, the transit time in days is
given as a result by the endpoint. To calculate the planned delivery date simply add the transit
time days to the shipment date.
As soon as a parcel has left the sorting center the planned delivery timeframe
('plannedDeliveryTimeframe') should be available in the next event.
The fact that, and when, a parcel actually is delivered is communicated through the attribute
'deliveredAt' (at top level in the json response).
Enviroments
Description URL
Response 200:
Response 200:
[
{
"barcode": "3SBPB0000094346",
"date": "2017-11-28T23:00:00.000Z",
"events": [
{
"category": "LEG",
"leg": {
"accountId": "5880133",
"debtorNumber": "5880133",
"destinationFacility": "ARM",
"destinationServiceArea": "ARM",
"number": "7451930615",
"network": "DAY_DEFINITE",
"originFacility": "MAA",
"originServiceArea": "MAA",
"reference": "60832634"
},
"localTimestamp": "2017-11-29T00:00:00.000+01:00",
"status": "LEG_CREATED",
"timestamp": "2017-11-28T23:00:00.000Z",
"type": "LEG_EVENT"
},
{
"category": "LEG",
7.2.3 Testing
These test cases with positive outcomes are merely suggestions and it is not an extensive test
set, e.g. tests with a negative outcome should also be taken into scope. Please extend with test
cases which are suitable for your line of business or wishes.
Place a request with Track and trace info is shown for given tracker code
tracker code
Place a request with Track and trace info is shown for given tracker code and the
tracker code and zipCode of the address details
receiver
In de API documentation you will see the option 'model' next to 'Example Value'. When clicked
on the type, a description per field is shown and if required (red asterisk).
A shipment can be traced through the tracker code (response field in the Create label endpoint)
and the receiver's postal code.
The Track & trace service is something that DHL can provide. In your correspondence to your
clients a URL can be communicated that a shipment is ready. For example, this Dutch shipment:
An example for the label service when posting a label could be like this in PHP:
curl_setopt($ch, CURLOPT_HTTPHEADER, [
Example in cURL
A package can be sent to a mailbox by adding the shipment option with key "BP" to the post
label request.
See directions on context and syntax in 3.3.1 Create label, Adding shipment options.
A package for express delivery can be created by adding the shipment option key "EXP" in the
post label request.
See directions on context and syntax in 3.3.1 Create label, Adding shipment options.
With the Find the nearest parcel shop location the id (as input) of the DHL ServicePoint can be
derived. In the request you then need to define the shipment option key 'PS', like:
{
"key": "PS",
"input": "8004-NL-272403"
}
See directions on context and syntax in 3.3.1 Create label, Adding shipment options.
Same day delivery is a product that is not automatically available for all customers. If you want
this enabled, please place your request at: CIM Parcel BNL.
Same day has the shipment option key 'SDD' and is used like :
{
"key": "SDD"
}
See directions on context and syntax in 3.3.1 Create label, Adding shipment options.
In the situation that a parcel is to be delivered at a postbox in a German PackStation, the syntax
is first the id of the parcel station delimited by ‘|’ and then the recipient’s postnummer:
{
"key": "PS",
"input": "8003-4125530|12345"
}
See directions on context and syntax in 3.3.1 Create label, Adding shipment options.
This is the current (at time of writing) list of shipment options. For up-to-date information,
including a basic description, please use the ‘Shipment options’ endpoint of our API.
EA Extra Assurance
EXP Expresser
EXW Ex Works. The recipient pays for the transportation from factory to
destination
ADD_RETURN_LABELPrint extra label for return shipment (for MDP Business app only)
S Saturday delivery