Authentication

Get Access New Token

The Get access_token API call provides OAuth 2.0 Bearer token, assigned to your Consumer_key and Consumer_secret, which will grants you an access to the Deutsche Post International Shipping APIs.<br/><br/> If you already received credentials for the old gateway these remain valid until further notice.<br/><br/> The API operation is secured by HTTP Basic authentication, therefore you have to provide Consumer_key and Consumer_secret as an username and password, when calling the API..<br/><br/> Example:

  1. You will receive Consumer_key and Consumer_secret from Deutsche Post International representative in following format.<br/> Credentials below are exemplary and can NOT be used in this Sandbox environment to get the access_token.

    Consumer_key: 5qsFCFLzeoz4C6PKJ7yH3NDQHgBEJLt7
    Consumer_secret: P6mEGGaAZ2TdkLpD
    
  2. When passing the Consumer_key and Consumer_secret via HTTPS request, using HTTP Basic authentication, you have to populate HTTP Header Authorization in following format.

    Note: Consumer_key and Consumer_secret has to be encoded in base64-encoding. There is a space characeter between Basic and the base64-encoded string. There is a : character between the Consumer_key and Consumer_secret, when encoded in base64-encoding.

    Authorization: Basic base64-encoded(Consumer_key:Consumer_secret)
    Authorization: Basic NXFzRkNGTHplb3o0QzZQS0o3eUgzTkRRSGdCRUpMdDc6UDZtRUdHYUFaMlRka0xwRA==
    

    Note: You can test the Get access_token API directly from the documentation page. The Authorization HTTP Header was populated for you in the Console View on the right side of the screen.

  3. You will receive following response in the JSON format.

      {
            "access_token": "8CyAkmSppbfG5KAQ4AinTZ8RVJnD",
            "token_type": "Bearer",
            "expires_in": 17999
       }
    

Understanding of the response fields: access_token: Contains access_token string for the Shipping / Tracking API authentication and authorization.<br/><br/> token_type: Type of the OAuth 2.0 access_token. Default value is "Bearer".<br/><br/> expires_in: Time to live of the access_token. Default value is 18000 seconds / 5 hours. After this time the token expires. <br/><br/>

get/dpi/v1/auth/accesstoken

Request

  • Base URL
    https://api-sandbox.dhl.com
  • Auth
    none declared. Required headers: Authorization, Accept

Headers

Authorizationstring required

HTTP Basic Authorization string (base 64 encoded)

Acceptstring required

Response

Success

access_tokenstring required
token_typestring required
expires_ininteger required

Example response

{
  "access_token": "vzoJsASlFm0rfz3HsZEWC69lgQcytQQqWJvk9eBL3cMF8j7W4ny4Dh",
  "token_type": "Bearer",
  "expires_in": 18000
}

Changes

No recorded changes to this operation across all 1 revision of this API.