Request
Request
Note: For testing purpose, Client Id and Password are read-only
OVERVIEW
OVERVIEW
AUTHENTICATION
AUTHENTICATION
ENDPOINTS
Shipping Label
Shipping Label Edit
Shipment Delete/Cancel
Shipment Creation
Close-Out
Manifest
Domestic Manifest
Reprint Shipping Label
Pickup
Pickup Label
Tracking
ENDPOINTS
Shipping Label
Shipping Label
Manifest
Manifest
Close-Out
Close-Out
Tracking
Tracking
APPENDIX
APPENDIX
English
Thai
Chinese
AUTHENTICATION ENDPOINT - ACCESS TOKEN
To access any of DHL eCommerce's resources an access token may be required. This call is used for retrieving the authentication token required to invoke the API/s authorized to user for access. The user is assigned a client ID / user ID and password during subscription, and these are required parameters when making a call. The following information will help guide you through obtaining an access token.
/rest/v1/OAuth/AccessToken
GET
REQUEST
The request has to conform with the below specifications:
ENVIRONMENT
PROTOCOL
FORMAT
HOST
RESOURCE PATH
Production
https
api.dhlecommerce.dhl.com
json(default)
xml
/rest/v1/OAuth/AccessToken
PreProd
https
apitest.dhlecommerce.asia
json(default)
xml
/rest/v1/OAuth/AccessToken
QUERY STRING PARAMETERS
The API user will send a request, which conforms to following parameters, to the query component of the authorization format:
NAME
REQUIRED
DESCRIPTION
clientId
Yes
Client identification is assigned when the user/client subscribes to the API
returnFormat
No
Return message format. Option of
json (default)
xml
Case sensitive.
password
Yes
Password is assigned when the user/client subscribes to the API
Sample Request
cURL
curl -X GET -H "Cache-Control: no-cache" "https://apitest.dhlecommerce.asia/rest/v1/OAuth/AccessToken?clientId=LTExMTgwNTI4MTY=&password=APITest1&returnFormat=json"
RESPONSE
If the authentication request is valid and authorized, the authorization server will issue an access token, and add the following parameters to the entity body.
NAME | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
![]() |
|||
token | Yes | String | Access token issued by authorization server |
![]() |
|||
token_type | Yes | String | HTTP Authentication type |
![]() |
|||
expire_in_seconds | Yes | String | The lifetime of the access token in seconds. |
![]() |
|||
client_id | Yes | String | Client identification provided in the request. |
![]() |
|||
responseStatus |
Yes | Group | Response status returned by the service. |
![]() |
|||
code |
Yes | Integer | Status Code - A unique code that identifies successful or failure in the processing |
![]() |
|||
message |
Yes | String | Short description indicating successful or failure in the processing |
![]() |
|||
messageDetails |
Yes | String | Additional description indicating successful or failure in the processing |
RESPONSE STATUS CODES
STATUS CODE | STATUS MESSAGE | STATUS MESSAGE DETAILS | |
---|---|---|---|
![]() |
|||
100000 | Service operation completed successfully | Access token assigned. | |
![]() |
|||
100099 | Exception occured when assigning token. | Make sure valid scope and clientId are provided. |
Sample Response
Response
Access Token Expiration
A new token will be generated for the clientID requested every 12 hours. All generated tokens last for 24 hours. The system will return the same access token when
receiving multiple requests for the access token from the same user (same clientId) within 12 hours, after which a new token is generated, however the old token
is still valid for remainder of the validity period. When it expires, the requested resource will throw the following error: "Access token authentication failed."
At this time, a new access token needs to be requested. A new access token is not needed for each request.