Fetching Bank Data

Before you get started

In order to get data from a connected account you first need to have the following:

  • Implemented Authentication to Lean's APIs
  • Created a Customer.
  • Connected an Entity with the correct permissions for the data type you are requesting.

How account data is structured

flowchart TD
%% Nodes
    A("Customer")
    B("Entity (Bank A)")
    C("Entity (Bank B)")
    D("Accounts")
    E("Identity")
    F("Savings Account")
    G("Current Account")
    H("Balance")
    I("Transactions")


%% Edge connections between nodes
    A --> B & C
    B --> D & E
    D --> F & G
    F --> H & I

Making your first API call

With an Entity set up, the first API to call will normally be the /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.leantech.me/data/v2/accounts?entity_id=550e8400-e29b-41d4-a716-446655440000' \
--header 'accept: application/json' \
--header 'Authorization: Bearer YOUR_JWT'