---
title: "Get Access New Token"
method: GET
path: "/dpi/v1/auth/accesstoken"
tags: ["Authentication"]
---

# Get Access New Token

`GET /dpi/v1/auth/accesstoken`

## Request

- Base URL: `https://api-sandbox.dhl.com`
- URL: `https://api-sandbox.dhl.com/dpi/v1/auth/accesstoken`
- Auth: none declared. Required headers: `Authorization`, `Accept`

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/>

## Headers

- `Authorization` string, required
- `Accept` string, required

## Response `200`

Success

- GetAccessTokenResponse
  - `access_token` string, required
  - `token_type` string, required
  - `expires_in` integer, required

---

[API](https://skmtc.dev/dhl/apis/deutsche-post-international-shipping-api.md) - [All operations](https://skmtc.dev/dhl/apis/deutsche-post-international-shipping-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dhl/apis/deutsche-post-international-shipping-api/revisions/33ba987e477f?raw)
