Getting Started with the Lending API
Use this tutorial to learn how to:
- Get your API credentials
- Connect to our API
- Request access tokens to authenticate with the API
- Use our API by requesting pricing for financing an invoice
Step 1 - Get Your Credentials
To get your API credentials contact [email protected].
You will be granted a client_id
, client_secret
. You will need to use these in the next step.
Step 2 - Request an Access Token
To be able to use the Lending API operations, you will need a temporary bearer access token. To get yours, you need to send your credentials with the Get Access Token operation:
- Send a POST request to https://api.bnkbl.io/auth/token.
- Add the Content-Type header set to the application/x-www-form-urlencoded value.
- Add a HTTP body containing the
client_id
andclient_secret
.
curl --request POST \
--url https://api.bnkbl.io/auth/token \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data client_id=YOUR_CLIENT_ID_HERE \
--data client_secret=YOUR_CLIENT_SECRET_HERE
You will get a response with your token, valid for 24 hours:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"token_type": "Bearer",
"expires_in": 86400
}
You can now use your token to make requests to other endpoints in the Lending API.
Step 3 - Get Pricing for Financing an Invoice
Now that you can authenticate with the API, you can try to request pricing for financing an invoice. You can use the Get Invoice Finance Price Breakdown operation for this.
You can use the example below to test the operation. Make sure that:
- The invoice date is in YYYY-MM-DD format
- The invoice date is 5 or more days and less than 120 days from today
- Your API call includes the access token you have just generated
curl --request GET \
--location 'https://api.bnkbl.io/partner/invoice/price-breakdown?debtor_crn=22969621&debtor_country_code=FI&due_date=INOVOICE_DATE_HERE&face_value=900&issuer_crn=16444335&issuer_country_code=FI' \
--header 'accept: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE'
You will get a response with the estimated price breakdown:
{
"debtor_grade": "b",
"currency": "EUR",
"financed_percentage": 1,
"financed_value": 4712,
"financing_duration": 17,
"fees_amount": 121.17,
"overdue_deposit_days": 60,
"overdue_deposit_percentage": 0.07,
"overdue_deposit_amount": 329.84,
"overdue_deposit_daily_amount": 5.5,
"proceeds_amount": 4260.99
}
Congratulations! You made your first API call to the Bankable API.
Summary
- You obtained your API Credentials by emailing [email protected]
- You learned to authenticate with the API using your credentials with the Get Access Token operation
- You performed your first API call and got pricing for financing an invoice using the Get Invoice Finance Price Breakdown operation
What’s next?
You can browse all the available operations in the Lending API in the API Reference.