# Generate Token API

The Generate Token API facilitates the subsequent process by providing the necessary token for the Upload File API.

## Endpoint

<table><thead><tr><th width="241">Type</th><th>Value</th></tr></thead><tbody><tr><td><strong>HTTP Method</strong></td><td>POST</td></tr><tr><td><strong>API endpoint (Test Mode)</strong></td><td><code>https://api-uat.doku.com/adv-core-api/partner/v1.0/token</code></td></tr><tr><td><strong>API endpoint (Production)</strong></td><td><code>https://api.doku.com/adv-core-api/partner/v1.0/token</code></td></tr></tbody></table>

## Request  Header

```
Client-Id: BRN-0001-10791114622547
Request-Id: fdb69f47-96da-499d-acec-7cdc318ab2fe
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=
```

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>client-id</code></strong></td><td>Client ID (Brand ID) will be shared by DOKU Account Manager</td></tr><tr><td><strong><code>request-id</code></strong></td><td>Unique random string (max 128 characters) generated from merchant side to protect duplicate request</td></tr><tr><td><strong><code>request-timestamp</code></strong></td><td>Timestamp request on UTC time in ISO8601 UTC+0 format. It means to proceed transaction on UTC+7 (WIB), merchant need to subtract time with 7. Ex: to proceed transaction on September 22th 2020 at 08:51:00 WIB, the timestamp should be 2020-09-22T01:51:00Z</td></tr><tr><td><strong><code>signature</code></strong></td><td>Security parameter that needs to be generated on merchant Backend and placed to the header request to ensure that the request is coming from valid merchant. Please refer to <a href="../../get-started-with-doku-api/signature-component/non-snap/signature-component-from-request-header">this section</a> to generate the signature</td></tr></tbody></table>

## Request Body

```json
{
  "grant_type": "client_credentials",
  "valid_time": "360"
}
```

<table><thead><tr><th>Parameter</th><th width="128">Type</th><th width="146">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>grant_type</code></td><td><code>string</code></td><td>Mandatory</td><td>value <code>client_credentials</code></td></tr><tr><td><code>valid_time</code></td><td><code>string</code></td><td>Optional</td><td>in minutes</td></tr></tbody></table>

## Response

```json
{
    "token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJwYXlsb2FkIiwiZXhwIjoxNzA0ODY2MTkxLCJ1c2VyIjp7ImJ1c2luZXNzU2VydmljZUNsaWVudElkIjoiQlJOLTAyNDktMTY5NzUzNzM5Njc4MyJ9LCJpYXQiOjE3MDQ4NDQ1OTF9.F5HtcC4qmzTdvfSNow1mHneHKDQ4OYJl1bLghlKbEDJaIwFpIhKcbh93qEyGbTlAZsX2Akwz6idlpqd2acM4hq07jIbw5w_JbeGtB56P9bNIJJBAFEuf84ijGUOd3UPetwn0oXRnC1mvt3aCufcAqCnaR86gW8Mxs-GCA5XvkIfyc2OTnuuH5qI4ozhyYrInW3iJxs-s7CI81hPaAxfo6kC075Ub8eYcWxbtOygxthPcoSVI28OCiWGlBoBDq27DCYT3CbSlsljhEJIDMLBEkkaAMSt8RbxVi9RS2VvNwTxYLfcLiJG9UgCoKjtGCMg7M81mcD8VxkrHh5ftekbrKw"
}
```
