Skip to main content
API Developer Portal

Main navigation

  • APIs
    • API Service Types
    • Tracking APIs
    • Shipping APIs
    • Browse all services
  • Documentation
  • Help Center
  • EN
    • DE
    • EN
    • JA
    • KO
    • TH
    • ZH-HANS
    • ZH-HANT
  • Register
  • Login
  • Register
  • Login
Authentication (DHL eCommerce Americas)
Get Access!
Navigation Menu
Authentication (DHL eCommerce Americas)
v 4.0.0
Division: DHL eCommerce

Best for:

Access Token

  • Getting an access token
Region: United States
Used for: Authentication
Scope

The following operations are allowed in the Authentication API:

OperationPathTypeDescriptionAvailability
Acccess Token/auth/v4/accesstokenPOSTProvide client credentials and obtain an access tokenAll customers
Important

An access token is valid for a certain amount of time before it expires. This limit is currently set to 60 minutes. When it expires, the requested resource will throw the following error: 'Access token expired'. At this time a new access token should be requested. A new access token is not needed for each request.

We recommend that you refresh the access token periodically (~15 mins to 30 mins) so that none of the resource requests receive an error due to an expired access token. We will inform clients if the access token expiry is changed to less than 30 minutes.

Workflow

  • The following fields needs to be sent as form parameters -

    client_id,

    client_secret and

    grant_type

  • Sending the request will return an access_token in the response

The access token is a Bearer token hence it must be sent with every resource request using the Bearer preprended to the token itself and separated by a space.

  • For example, if the access token value is edEB6SlC8wafnWgAlgqxagATPF0F, then the token must be passed in all resource requests as a header as follows -
Header name: Authorization
Header value: Bearer edEB6SlC8jdfnAgAlgqxagATPF0F
Request

Here is a sample request

POST /auth/v4/accesstoken HTTP/1.1 
Host: api-sandbox.dhlecs.com 
Content-Type: application/x-www-form-urlencoded 
grant_type=client_credentials 
client_id=<your client id here> 
client_secret=<your client secret here>

Note that the request contains a field called grant_type with a value of client_credentials. The grant_type is sent in the body with the Content-Type of application/x-www-form-urlencoded. This is mandatory for successful authentication and getting an access_token. Please refer here for more information on grant types.

Response
NodeData TypeDescription
access_tokenstringaccess token. Store this value for all resource requests.
client_idstringclient id (username) of the client app
token_typestringtype of token. We use BearerToken
expires_innumberexpiry time in seconds

Here is a sample good response

{
   "access_token": "OGH0T5hPVJ2oL0DYhRfYJgJMJYhC",
   "client_id": "G8PaGaNdIg5CS5q5mAibmJ9jywTFiO97",
   "token_type": "Bearer",
   "expires_in": 3600
}

Here is a sample bad response

{
   "type": "https://api-sandbox.dhlecs.com/docs/errors/400.0000005",
   "title": "Invalid credentials"
}

Find Content

APIs of our divisions

  • DHL eCommerce
  • DHL Express
  • DHL Global Forwarding
  • DHL Freight
  • DHL Supply Chain
  • Post & Parcel Germany

Developers

  • API Catalog
  • Documentation
  • API Status

Footer menu

  • Imprint
  • Privacy Notice
  • Terms of Use
  • Cookie Settings
2025 © DHL International GmbH. All rights reserved.