Getting Data

Overview

Now that you've got your hands on the entity_uuid, let's get some data!

We've made retrieving financial data as easy as possible for you by packing all the functionality into 4 easy endpoints:

  1. /identity → Information about your user that was submitted to the bank.
  2. /accounts → Your user may have multiple accounts at the bank e.g. a savings and a checking account. This endpoint gives you information about all these accounts and importantly gives you an identifier for each account to use with the next two endpoints — /balance and /transactions — which retrieves data specific to one of these accounts.
  3. /balance → Specific to a single account. Tells you how much balance this account has.
  4. /transactions → Specific to a single account. Gives you information about all the transactions made for this account.

Identity

Lean's identity endpoint allows you to retrieve an end user's identity data held by the financial institution.

POST https://sandbox.leantech.me/v1/identity

Request

Headers

HeaderDescription
lean-app-tokenThe first method Lean uses to identify your application. Can be found on your Application page

Body

FieldDescription
entity_uuidThe identifier for your user’s bank entity. The string you spent that whole last section trying to get.

Example

curl -X POST 'https://sandbox.leantech.me/v1/identity' \
--header 'Content-Type: application/json' \
--header 'lean-app-token: 40289089716ab818017178bc1cff0005' \
--data-raw '{
"entity_uuid": "f08fb010-878f-407a-9ac2-a7840fb56185"
}'

Response

Example

{
"full_name": "Sandbox user",
"mobile_number": "07849720842",
"gender": "male",
"national_identity_number": "123456789",
"birth_date": "1990-09-15",
"email_address": "sandboxuser1@leantech.me",
"address": "140 Tabernacle Street, Shoreditch EC2A 4SD"
}

Body

FieldDescription
full_nameAccount holder's full name
mobile_numberAccount holder's mobile number as reported to the financial institution
genderAccount holder's gender
national_identity_numberAccount holder's national identifier number as reported to the financial institution
birth_dateAccount holder’s date of birth. Format: YYYY-MM-DD
email_addressAccount holder's email address as reported to the financial institution
addressAccount holder's home address as reported to the financial institution

Accounts

Lean's accounts endpoint allows you to retrieve a list of all the accounts your customer holds within the financial institution along with their respective information

POST https://sandbox.leantech.me/v1/accounts

Request

Headers

HeaderDescription
lean-app-tokenThe first method Lean uses to identify your application. Can be found on your Application page

Body

FieldDescription
entity_uuidThe identifier for your user’s bank entity. The string you spent that whole last section trying to get.

Example

curl -X POST 'https://sandbox.leantech.me/v1/accounts' \
--header 'Content-Type: application/json' \
--header 'lean-app-token: 40289089716ab818017178bc1cff0005' \
--data-raw '{
"entity_uuid": "f08fb010-878f-407a-9ac2-a7840fb56185"
}'

Response

Example

[
{
"account_uuid": "3d586d40-04d9-4657-80b7-65bb8cce1e9a",
"name": "Mockbank1 Checkings Account",
"currency_code": "SAR",
"type": "Checkings",
"iban": "SA03 8000 0000 6080 1016 7519",
"bank_identifier": "LEANMB1"
},
{
"account_uuid": "3e9e4289-9e4f-480f-af68-3181cb35218e",
"name": "Mockbank1 Savings Account",
"currency_code": "SAR",
"type": "Savings",
"iban": "SA03 8000 0000 6080 1635 2788",
"bank_identifier": "LEANMB1"
}
]
Body
FieldDescription
account_uuidIdentifier for the account, to be used with API calls that retreive information for a specific account as the account_uuid parameter
nameThe name of the account within the financial instituition
currency_codeISO 4217 currency code representing the currency of the balance
typeType of bank account (e.g. Checking, savings, credit, loan etc.)
ibanInternational Bank Account Number (iban) for the account, if available.
bank_identifierHow Lean internally refers to the bank. Can be used with the upcoming /bank endpoint

Balance

The balance endpoint, as the name suggests, gives you real time balance information of a specific account within the user’s bank entity

POST https://sandbox.leantech.me/v1/balance

Request

Headers

HeaderDescription
lean-app-tokenThe first method Lean uses to identify your application. Can be found on your Application page

Body

FieldDescription
entity_uuidThe identifier for your user’s bank entity. The string you spent that whole last section trying to get.
account_uuidThe identifier to the account within the user’s bank entity retrieved using the /accounts endpoint.

Example

curl -X POST 'https://sandbox.leantech.me/v1/balance' \
--header 'Content-Type: application/json' \
--header 'lean-app-token: 40289089716ab818017178bc1cff0005' \
--data-raw '{
"entity_uuid": "f08fb010-878f-407a-9ac2-a7840fb56185",
"account_uuid": "01bb8b3f-8462-470b-b2ed-14eb15b95fa2"
}'

Response

Example

{
"balance": 15035.85,
"currency_code": "SAR",
"account_uuid": "01bb8b3f-8462-470b-b2ed-14eb15b95fa2",
"account_name": "Mockbank1 Checkings Account",
"account_type": "Checkings"
}

Body

FieldDescription
balanceThe real time balance remaining within the account
currency_codeISO 4217 currency code representing the currency of the balance.
account_uuidIdentifier for the account, how you reference the account when making data calls
account_nameThe name of the account within the financial instituition, for your convenience.
account_typeType of bank account (e.g. Checking, savings, loan etc.)

Transactions

Lean's transactions endpoint allows you to retrieve an end user's transactions data held by the financial institution.

POST https://sandbox.leantech.me/v1/transactions

Request

Headers

HeaderDescription
lean-app-tokenThe first method Lean uses to identify your application. Can be found on your Application page

Body

FieldDescription
entity_uuidThe identifier for your user’s bank entity. The string you spent that whole last section trying to get.
account_uuidThe identifier to the account within the user’s bank entity retrieved using the /accounts endpoint.
start_date (optional)The start of the time range you want to acces transaction data from. Format: YYYY-MM-DD
end_date (optional)The end of the time range you want to acces transaction data from. Format: YYYY-MM-DD
Example
curl -X POST 'https://sandbox.leantech.me/v1/transactions' \
--header 'Content-Type: application/json' \
--header 'lean-app-token: 40289089716ab818017178bc1cff0005' \
--data-raw '{
"entity_uuid": "f08fb010-878f-407a-9ac2-a7840fb56185",
"account_uuid": "01bb8b3f-8462-470b-b2ed-14eb15b95fa2",
"start_date": "2020-03-01",
"end_date": "2020-03-15"
}'

Response

Example

[
{
"description": "Al Ghunaim Stationery",
"amount": -43.0,
"currency_code": "SAR",
"category": "Education",
"type": "Card Purchase",
"pending": false,
"timestamp": "2020-03-12T10:32:12Z"
},
{
"description": "Leanbank ATM Deposit",
"amount": 650.0,
"currency_code": "SAR",
"category": "ATM",
"type": "Cash Transfer",
"pending": false,
"timestamp": "2020-03-12T02:44:13Z"
},
{
"description": "Assaraya Turkish Restaurant",
"amount": -74.0,
"currency_code": "SAR",
"category": "Restaurant",
"type": "Card Purchase",
"pending": false,
"timestamp": "2020-03-10T08:01:35Z"
},
{
"description": "McDonalds - Sultanah, Riyadh",
"amount": -22.0,
"currency_code": "SAR",
"category": "Restaurant",
"type": "Contactless",
"pending": false,
"timestamp": "2020-03-08T11:02:41Z"
},
{
"description": "LuLu Hypermarket, Murabba",
"amount": -289.96,
"currency_code": "SAR",
"category": "Groceries",
"type": "Card Purchase",
"pending": false,
"timestamp": "2020-03-02T05:44:02Z"
}
]

Body

FieldDescription
descriptionDescription of the transaction, usually the merchant
amountThe amount of the transaction. Positive indicates money coming in to the account (income), negative is money going out (spending).
currency_codeISO 4217 currency code representing the currency of the amount.
categoryThe category of the transaction.
typeType of transaction, how was the money transfered? E.g. bank transfer, card purchase, contactless etc.
pendingBoolean. Is the transaction pending or it is complete
timestampThe time the transaction was made in the format: YYYY-MM-DDThh:mm:ss in the time zone of the bank

Last updated on