post
https://{URL}/v1/open-api/access-token
This method retrieves a credential that an application can use to access an API.
A. Request Header
| Field | Format | Mandatory | Example |
|---|---|---|---|
| Content-Type | string | Y | application/json |
| Open-Api Timestamp | yyyy-mm-dd 'T'hh:mm:ss+07:00 | Y | 2022-03-21T10:11:40+07:00 |
| Open-Api-Signature | Auth Signature | Y | awEsV5A5cwq+L9vYkcCxy9HJRjtL lmep9p7s10ik1TdDMNzMz4QKjKDyZ ziJdbc7X4uHHOmPfz0jWOkUgkVluA== |
-
Custom headers are not using “X-” prefix following suggestions in RFC6648 . However, we’re still using a custom “Open-Api-“prefix that should be understood as headers belonging to Klikoo B2B OpenAPI to differentiate them from standard HTTP headers.
B. Request Body
| Field | Type | Mandatory | Length | Example |
|---|---|---|---|---|
| grant_type | string | Y | “client_credentials” | |
| additional_info | object | |||
client_id | string, UUID v4 | Y | 36 | “3f9c8962-4c4b-4bb6-b3c1-8fc883519c02” |
client_secret | string | Y | 32 | “9ec999e21a3be41064c52bb3f37554a2 |
C. Sample Request
{
"grant_type": "client_credentials",
"additional_info": {
"client_id": "{{B2B_CLIENT_ID}}",
"client_secret": "{{B2B_CLIENT_SECRET}}"
}
}
D. Response Body
| Field | Type | Description | Example |
|---|---|---|---|
| response_code | string | A combination of HTTP code and Klikoo B2B internal code. See page documentation API's Response Code . | “200012000” |
| response_message | string | An explanation of response code | “Sukses” |
| data | object | Contains additional data related to the response. | |
access_token | string | A json web token | “user_access_token" |
token_type | string | The type of Authorization to use with the access_token | “Bearer” |
expires_in | int | The duration of access_token validity in seconds. The default value is 15 minutes. | 900 |
E. Sample Response
{
"response_code": "200012000",
"response_message": "Sukses",
"data": {
"access_token": "user_access_token",
"token_type": "Bearer",
"expires_in": 900
}
}
Try It Here (Form)
To try the following endpoint, enter the example request data you want to use in the following form