Getting Started
This API is used to obtain an access_token, which should be included in the Authorization header as a Bearer token. This token is required for accessing APIs that need authentication.
Basic Authentication automatically generates a string encoded in Base64 format.
This process involves combining the client_id as the username and the client_secret as the password
using a colon (:) separator, then converting the result into a Base64-encoded string.
This Base64 value is then sent in the Authorization header.
The Basic Authentication format is as follows:
Authorization: Basic <base64(client_id:client_secret)>
Title | API Get Access Token |
---|---|
Version | v1.0 |
URL Sandbox | https://stg-pg.singapay.id |
URL Production | - |
Doc Version | API Version | Date | Document Link | Description |
---|---|---|---|---|
v1.0 | v1.0 | 17 June 2025 | - | - |
HTTP method | POST |
---|---|
Path | /api/v1.0/access-token/b2b |
Type Format | JSON |
Key | Value | Format | M/O/C | Length |
---|---|---|---|---|
grant_type | client_credentials | String | M | - |
Key | Value | Format | M/O/C | Length | Description |
---|---|---|---|---|---|
X-PARTNER-ID | <api_key> | String | M | - | - |
Authorization | <base64(client_id:client_secret)> | String | M | - | |
Content-Type | Application/json | M | - | Give back response with JSON format |
{
"grant_type": "client_credentials"
}
Success: Here’s an example of a successful response.
{
"status": 200,
"success": true,
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3BheW1lbnQtZ2F0ZXdheS1kYXNoYm9hcmQudGVzdC9hcGkvdjEuMC9hY2Nlc3MtdG9rZW4vYjJiIiwiaWF0IjoxNzQ4NDE1MTA4LCJleHAiOjE3NDg0MTg3MDgsIm5iZiI6MTc0ODQxNTEwOCwianRpIjoiZHRlZWhkd2FleGZtQjJYeiIsInN1YiI6IjEiLCJwcnYiOiI5M2JkY2M1OGRkMDFjZTM2ZWM1NmUzMmI1YmI1ODBkODMwMzJmZDE4In0.8yyp0v5p5BsGAanm6unKmYhknuGW9_wwPwjnN6zG8u4",
"token_type": "Bearer",
"expires_in": "3600"
}
}
Failed: Here’s an example of a error response.
{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Invalid credentials"
}
}