Skip to main content

Access Token B2B

Specification

The Following tabel is spesification for this API :

API NameAccess Token B2B
FunctionThis API is used to retrieves authorization token based on client_id and client_secret. The resulting token can be used in the HTTP header Authorization
Service Code73
MethodPOST
URL/snap/v1.0/access-token/b2b
Acceptapplication/json
Content Typeapplication/json
Related ServiceAuthorization Token Request

Request

The following part will be describe about parameter of request in this API:

Request Parameter

The following table is a list of request parameter in this API:

The following table is Header of Request Parameters :

NoNameTypeLengthRequiredConditionRemarks
1Content-TypeStringVariable, 127 maxMandatory-Content type, value always application/json*
2X-TIMESTAMPStringFixed, 25 maxMandatory-Transaction date time, in format YYYY-MM-DDTHH:mm:ss+07:00. Time must be in GMT+7 (Jakarta time)
3X-CLIENT-KEYStringVariable, 36 maxMandatory-Client ID given by the API provider
4X-SIGNATUREStringVariableMandatory-Signature need to be generated with Asymmetric Signature method

Body

The following table is a body of request parameter:

NoNameTypeLengthRequiredConditionRemarks
1grantTypeStringFixed, 18 maxMandatory-Always have value of client_credentials

Request Sample

The following script is a request sample of this API:

POST /snap/v1.0/access-token/b2b
X-TIMESTAMP: 2024-08-01T07:07:21+07:00
X-CLIENT-KEY: 35d1a1127182a65e4fe0256242a40a6d
X-SIGNATURE: COq1k1ZRPHx8PVDmsbEPywJGY2limDddpwqqiMWDvP2FVjYZl37F9YsyKvWv83ROk8TZKPZg1mwjzAm5wSrkS5W+5MdcJzHbYbdg280PXqYx2ieKP1sRcTD09Ha7SWnnGAbj/dyanKJbBttvCKkVmiOZhWVhh465Id/BBcvuE18BHlBZAmTP8IO5qukEICyGrS63GrdMsa2vyws+tufI1C70LGtFaiEI07TpEGlpxXkMuqW2+5jCChm0NMMo1ynHdWz/yW+vmOhiAVLeG+Z1OQTTRYXYEVKjwPDQAf1N26xbQq1vWua1b8QL9yUF7x2FwyAhNJ2AkG5q6MEuoqCnQA==
Content-Type: application/json

{
"grantType": "client_credentials"
}

Response

The following part will be describe about parameter of response in this API:

Response Parameter

The following table is a list of response parameter in this API:

Body

The following table is a body of response parameter:

NoNameTypeLengthRequiredConditionRemarks
1responseCodeStringFixed, 7 maxMandatory-Refer to response code list
2responseMessageStringVariable, 150 maxMandatory-Refer to response code list
3accessTokenStringVariable, 2048 maxMandatory-Access token
4tokenTypeStringFixed, 6 maxMandatory-Type of authorization token. Always have value of Bearer
5expiresInStringVariable, 8 maxMandatory-Session expiry in seconds: 900 (15 mins)

Response Sample

The following script is a response sample of this API:

{
"responseCode": "2007300",
"responseMessage": "Successful",
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJQYXlkaWEiLCJpYXQiOjE3MjI0OTYxMDAsImV4cCI6MTcyMjU4MjUwMCwiZGF0YSI6eyJlbnYiOiJkZXZlbG9wbWVudCJ9fQ.krcHPsQMh_cAzw5_5z7MXyDm89yOMhNd-mGkAARXxAU",
"tokenType": "Bearer",
"expiresIn": "900"
}

Response Code and Message

The following table is the list response code and message of Authorization Token Request API:

NoResponse CodeResponse MessageRemarks
12007300SuccessfulSuccess to be processed
24007301Invalid Field FormatInvalid format for certain field
34007302Invalid Mandatory FieldMissing or invalid format on mandatory field
44017300Unauthorized. [reason]General unauthorized error