Fetching data
Once you have an entity_id you can now make calls to the identity and accounts endpoints. The identity endpoint provided identity details about the person that has provided consent in the SDK. The accounts endpoint provides the list of accounts the user has consented to share for an entity.
To understand how to make calls to each of these endpoints please review the API reference (Accounts and Identity)
When a user is redirected to their bank during the connection stage of the bank account, they will be able to select which accounts within their bank account they want to share (e.g.: they might have a current and savings account but only share their current). The
accountsendpoint will only return the accounts the user has decided to share with you.
After making an /accounts call you should save the account_id field from the response, as this will be used to make API calls on the associated accounts for all the other resources. Once you have the account_id for a specific account, you can now also make calls to all the remaining resources: identities, scheduled payments, direct debits, balances, transactions, beneficiaries, standing_orders. Please refer to the Data API reference to understand the requests and responses for these resources.
Data workflow
More details about the flow of fetching data from bank here.
Lean's Data APIs
Once the customer is connected to his bank, you will be able to query a list of Financial Data & Insights APIs, analyze & utilize them accordingly:
Raw data APIs | Verification & Data enrichment APIs |
|---|---|
| Get Accounts | |
| Get current user's identity | |
| Get Balances | Get IncomeGet Employment (Retail only) |
| Get Transactions | Get Expenses (Retail only) |
| Get Beneficiaries | Get Cashflow |
| Get Cash Balances | |
| Get Identities | |
| Get Scheduled Payments | |
| Get Standing Orders |
Data fields
- All mandatory fields are marked as such in the response for each API in the Data API reference
Making your first API call
With an Entity set up, the first API to call will normally be the data/v2/accounts endpoint. This simple GET request returns a list of the available accounts to query.
Let's look at a simple function to call the Accounts API and store all of the Accounts in a storedAccounts variable.
curl --request GET \
--url 'https://sandbox.sa.leantech.me/data/v2/accounts?entity_id=550e8400-e29b-41d4-a716-446655440000' \
--header 'accept: application/json' \
--header 'Authorization: Bearer YOUR_JWT'Updated 14 days ago
