BNI Digital Service Starter Guide
Getting Started Quickly and Easily.
What is the BNI API?
The BNI API is a set of interfaces and protocols that allows you to interact with BNI's API services programmatically. By using
the BNI API, you can access a wide range of functionalities, such as retrieving account information, processing transactions,
and more.
Who is this guide for?
This guide is intended for developers who want to learn how to connect to BNI's API and integrate it into their applications.
Prior knowledge of programming languages and concepts such as RESTful API is recommended.
What will you learn from this guide?
By following this guide, you will learn how to:
Create an account , create application and obtain API credentials
Authenticate your requests to the BNI API
Process transactions, such as transfers and bill payments through our sandbox
How to test our sandbox with our postman collection
Prerequisites
Before you begin, make sure you have:
Basic knowledge of programming languages such as JavaScript, Python, or Ruby
A RESTful client such as Postman or Insomnia
An internet connection
Let's get started!
Now that you know what the BNI API is and what you'll learn from this guide, let's get started by creating an account and
obtaining your API credentials.
Getting Started
Environment
BNI API has two environments, production and production sandbox. The production environment is used for applications that
are ready for live/production use, while the sandbox environment is used for development or testing purposes before the
application is ready for production. The production environment uses the URL https://api.bni.co.id . Meanwhile, the production
sandbox environment uses the URL https://sandbox.bni.co.id .The data available in the sandbox environment is simulated data
and will not affect real accounts. Users can choose the environment that suits their needs, depending on the development
stage or the needs of their application. Make sure to check and use the appropriate endpoint for the desired environment when
making API requests.
Creating an Account
Before you can start using the BNI API, you need to create an account and obtain your API credentials. Here are the steps to
create an account:
BNI Digital Service Starter Guide 1
1. Go to the BNI API portal at https://digitalservices.bni.co.id/ and click Register/Login , and Register Here
2. Fill all the information and click Sign Up , and continue to email verification
3. After email is verified, click Application from menu and click Create Application
4. Fill the Application form, enable application and click next
5. Choose API Products , you might tick all the services and click next
6. Go back to Application page, edit your application , click Authentication , generate your API Key system will generate
API_KEY along with the API_SECRET_KEY
7. Generate OAuth Credentials , in the pop up for example you can tick Application type as public and click Save Changes ,
system will generate CLIENT_ID and CLIENT_SECRET
8. Take a note of your API Key with the secret key, also the Client ID with the secret key.
Authenticating Your Request
To access BNI's API, you need to authenticate your requests using an access token. Here are the steps to obtain an access
token from BNI production sandbox :
1. Open a terminal or command prompt, and run the following command to get the AUTHORIZATION_CODE:
echo -n 'CLIENT_ID:CLIENT_SECRET' | base64
Sample result :
2. Running below command
BNI Digital Service Starter Guide 2
curl -X POST \
https://sandbox.bni.co.id/api/oauth/token \
-H 'Authorization: Basic <AUTHORIZATION_CODE>' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials'
Sample
3. Save it as your ACCESS_TOKEN
Get your first hit!
To start with, we would like to explain how to make an initial API call. For more information on our API products, please visit
https://digitalservices.bni.co.id/ and select the API Product option in the menu. You can also access a complete Postman
collection example in the Resource under Documentation menu. However, in this document, we will focus on one of the examples
of using the One Gate Payment service, specifically the "Get Balance" endpoint.
One Gate Payment - Get Balance
Information
Hostname https://sandbox.bni.co.id
HTTP Method POST
Path /H2H/v2/getbalance
Format JSON
Authentication OAuth 2.0 (client credential)
HTTP Headers
Name Format Description
X-API-Key String Value of API_KEY
Content-Type String Value : “application/json"
Request Body
Field Data Type Description
signature String JWT of your request body
accountno String Sample value : “0115476117”
clientId String "IDBNI" + BASE64(Application Name)
Full URL
https://sandbox.bni.co.id/H2H/v2/getbalance?access_token=[ACCESS_TOKEN]
Get Client ID
Open https://www.base64encode.org/ and encode your application name
Application Name BNI PORTAL
BNI Digital Service Starter Guide 3
Base64(Application Name) Qk5JIFBPUlRBTA==
clientId IDBNIQk5JIFBPUlRBTA==
Get Signature Value
1. Open https://jwt.io/
2. Fill payload data with :
{
"clientId": "<Your clientId>",
"accountNo": "0115476117"
}
Sample
3. In verify signature path, Fill your-256-bit-secret with your API_SECRET_KEY
4. Copy your signature
5. Full body request
{
"clientId": "IDBNIQk5JIFBPUlRBTA==",
"accountNo": "0115476117",
"signature": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6IklEQk5JUWs1SklGQlBVbFJCVEE9PSIsImFjY291bnRObyI6IjAxMTU0NzYxM
}
6. You can curl the request
curl -X POST \
'{{URLSandbox}}/H2H/v2/getbalance?access_token={{access_token}}' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{apikey}}' \
-d '{
"clientId": "{{clientId}}",
"accountNo": "0115476117",
"signature": "{{signature}}"
}'
7. Sample Response
BNI Digital Service Starter Guide 4
Congratulations on your first successful API call to BNI sandbox environment! You have taken the first step towards
building great products with BNI's APIs. Keep exploring the API product documentation to unleash the full potential of our
APIs.
Try Our Sandbox via Postman Collection
1. Download our postman collection in
https://digitalservices.bni.co.id/documentation/miscellaneous-resources?lang=en
2. Import in Postman , open the variables tab and change the current value of
a. APIKey
b. APISecret
c. clientID
d. clientSecret
Click Save
BNI Digital Service Starter Guide 5
3. Hit our utility → Request Token to get your access_token
4. Copy your access_token and paste to variables tab, click Save
BNI Digital Service Starter Guide 6
5. You can explore by running other services to hit our sandbox
BNI Digital Service Starter Guide 7