Get Token API

This method retrieves a credential that an application can use to access an API.


A. Request Header

FieldFormatMandatoryExample
Content-Typestring Yapplication/json
Open-Api Timestampyyyy-mm-dd
'T'hh:mm:ss+07:00
Y2022-03-21T10:11:40+07:00
Open-Api-SignatureAuth SignatureYawEsV5A5cwq+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

FieldTypeMandatoryLengthExample
grant_typestringY“client_credentials”
additional_infoobject
client_idstring, UUID v4Y36“3f9c8962-4c4b-4bb6-b3c1-8fc883519c02”
client_secretstringY32“9ec999e21a3be41064c52bb3f37554a2

C. Sample Request

{
    "grant_type": "client_credentials",
    "additional_info": {
        "client_id": "{{B2B_CLIENT_ID}}",
        "client_secret": "{{B2B_CLIENT_SECRET}}"
    }
}

D. Response Body

FieldTypeDescriptionExample
response_codestringA combination of HTTP code and Klikoo B2B internal code.
See page documentation API's Response Code .
“200012000”
response_messagestringAn explanation of response code“Sukses”
dataobjectContains additional data related to the response.
access_tokenstringA json web token“user_access_token"
token_typestringThe type of Authorization to use with the access_token“Bearer”
expires_inintThe 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

Body Params
string
additional_info
object
Headers
string
date-time
Responses

Language
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json