Fetch Banking Data
Fetch data aggregation associated with loan request.
HTTPS Request
POST https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/
This endpoint receives loan_request_id and returns the data_aggregation associated with this loan_request.
Headers
Accept
String
The content type of the response.
X-API-KEY*
String
The API key that gives the user the authentication to perform this request.
X-Timestamp*
String
The timestamp of the request.
X-HMAC*
String
The HMAC generated for the request.
Request Body
loan_request_id*
Long
loan request id for the needed aggregation to fetch
Sample Request
curl -X POST "https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-Timestamp: REQUEST_TIMESTAMP" \
-H "X-HMAC: REQUEST_HMAC" \
-d "{\"loan_request_id\": 1}"import requests
import json
url = 'https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/'
headers = {
'Accept': 'application/json',
'Content-Type: application/json',
'X-API-KEY': 'YOUR_API_KEY',
'X-Timestamp': 'REQUEST_TIMESTAMP',
'X-HMAC': 'REQUEST_HMAC'
}
body = {'loan_request_id': 1}
r = requests.post(url, json=body, headers=headers)
print(r.text)import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
String urlString = "https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/";
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("X-API-KEY", "YOUR_API_KEY");
connection.setRequestProperty("X-Timestamp", "REQUEST_TIMESTAMP");
connection.setRequestProperty("X-HMAC", "REQUEST_HMAC");
connection.setDoOutput(true);
String jsonInputString = "{\"loan_request_id\": 1}";
try (OutputStream os = connection.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["X-API-KEY"] = "YOUR_API_KEY"
request["X-Timestamp"] = "REQUEST_TIMESTAMP"
request["X-HMAC"] = "REQUEST_HMAC"
request.body = { loan_request_id: 1 }.to_json
response = http.request(request)
puts response.body
const fetch = require('node-fetch');
const url = 'https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/';
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY",
"X-Timestamp": "REQUEST_TIMESTAMP",
"X-HMAC": "REQUEST_HMAC",
};
const body = {
loan_request_id: 1
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = "https://api.lenmo.app/api/v3/data_marketplace/data_aggregation/fetch_loan_request_data_aggs/";
$headers = [
"Accept: application/json",
"Content-Type: application/json",
"X-API-KEY: YOUR_API_KEY",
"X-Timestamp: REQUEST_TIMESTAMP",
"X-HMAC: REQUEST_HMAC"
];
$body = json_encode([
"loan_request_id" => 1
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
Sample Response
{
"created": "2022-05-27T10:37:14.658672Z",
"borrower_bank_name_at_loan_request": "SANDBOX TEST BANK",
"borrower_bank_balance": "0.00",
"data_aggregation": {
"Status": {
"Severity": "Info",
"StatusCode": 0,
"StatusDesc": "Success"
},
"DepAcctTrns": {
"FIAcctId": {
"AcctId": 6161846,
"AcctType": "DDA",
"ExtAcctType": "DDA"
},
"BankAcctTrnRec": [
{
"Memo": "BOB'S DISCOUNT F DES:PAYROLL ID **003624X INDN:Smith, Jane CO ID:9006",
"TrnID": 25835773,
"CurAmt": {
"Amt": 250.17,
"CurCode": "USD"
},
"TrnType": "Credit",
"Category": "Earned Income",
"PostedDt": "2022-05-27",
"CreatedOnDt": "2022-05-27T11:27:28-07:00",
"SubCategory": "Wages & Salary"
},
{
"Memo": "BOB'S DISCOUNT F DES:PAYROLL ID **016227X INDN:Smith, Jane CO ID:9006",
"TrnID": 25835774,
"CurAmt": {
"Amt": 359.94,
"CurCode": "USD"
},
"TrnType": "Credit",
"Category": "Earned Income",
"PostedDt": "2023-12-12",
"CreatedOnDt": "2024-06-07T11:27:28-07:00",
"SubCategory": "Wages & Salary"
}
],
"SelectionCriterion": {
"SelRangeDt": {
"EndDt": "2022-05-27",
"StartDt": "2021-05-27"
}
}
}
},
"agg_90": {
"avg_credit": 0,
"avg_debit": 0,
"credit_30": 0,
"debit_30": 0,
"credit_60": 0,
"debit_60": 0,
"credit_90": 0,
"debit_90": 0,
"total_credit": 0,
"total_debit": 0,
"misc_spending_last90": 0,
"entertainment_spending_last90": 0,
"lifestyle_spending_last90": 0,
"education_spending_last90": 0,
"bank_fees_spending_last90": 0,
"donations_spending_last90": 0,
"goods_and_merch_spending_last90": 0,
"home_expense_spending_last90": 0,
"services_spending_last90": 0,
"utilities_spending_last90": 0,
"credit_payment_spending_last90": 0,
"transportation_spending_last_90": 0,
"food_spending_last90": 0,
"cash_advance_last90": 0,
"misc_spending_percentage_from_total": 0,
"entertainment_spending_percentage_from_total": 0,
"lifestyle_spending_percentage_from_total": 0,
"education_spending_percentage_from_total": 0,
"bank_fees_spending_percentage_from_total": 0,
"donations_spending_percentage_from_total": 0,
"goods_and_merch_spending_percentage_from_total": 0,
"home_expense_spending_percentage_from_total": 0,
"services_spending_percentage_from_total": 0,
"utilities_spending_percentage_from_total": 0,
"credit_payment_spending_percentage_from_total": 0,
"transportation_spending_percentage_from_total": 0,
"food_spending_percentage_from_total": 0,
"cash_advance_percentage_from_total": 0,
"negative_balance_count": 0
}
}{
'message': 'Please provide a valid loan_request id'
}{
"detail": "Authentication credentials were not provided."
}{
'message': 'wrong loan_request id or loan_request does not have any data aggs associated with it.'
}Response Parameters
created
Date
UTC time of data aggregation saved in the database.
borrower_bank_name_at_loan_request
String
Name of the borrower bank from which aggregation is fetched
borrower_bank_balance
String
Borrower balance in the bank provided the aggregation
data_aggregation
JSON
JSON object containing the data aggregation from the borrower's bank. It contains aggregation data provided by fiserv. Please, refer to DepAcctTrnInqRsentry in fiserv client's response.
agg_90
JSON
A JSON object containing aggregated data from the borrower's bank transactions in the last 90 days from the date of the loan request creation.
avg_credit
Float
Average income in the last 90 days.
avg_debit
Float
Average spending in the last 90 days.
credit_30
Float
Total income in the last 30 days.
debit_30
Float
Total spending in the last 30 days.
credit_60
Float
Total income in the last 30-60 days.
debit_60
Float
Total spending in the last 30-60 days.
credit_90
Float
Total income in the last 60-90 days.
debit_90
Float
Total spending in the last 60-90 days.
total_credit
Float
Total income in last 90 days.
total_debit
Float
Total spending in last 90 days.
misc_spending_last90
Float
Total amount spent in the miscellaneous expenses category in the last 90 days.
entertainment_spending_last90
Float
Total amount spent in the entertainment category in the last 90 days.
lifestyle_spending_last90
Float
Total amount spent in the Health & Lifestyle category in the last 90 days.
education_spending_last90
Float
Total amount spent in the Education category in the last 90 days.
bank_fees_spending_last90
Float
Total amount spent in the Bank Fees & Charges category in the last 90 days.
donations_spending_last90
Float
Total amount spent in the Donations category in the last 90 days.
goods_and_merch_spending_last90
Float
Total amount spent in the Goods & Merchandise category in the last 90 days.
home_expense_spending_last90
Float
Total amount spent in the Home Expenses category in the last 90 days.
services_spending_last90
Float
Total amount spent in the Services category in the last 90 days.
utilities_spending_last90
Float
Total amount spent in the Utilities category in the last 90 days.
credit_payment_spending_last90
Float
Total Amount spent in the Transfers & Adjustments category in the last 90 days.
transportation_spending_last_90
Float
Total Amount spent in the Travel & Transportation category in the last 90 days.
food_spending_last90
Float
Total Amount spent in the Food & Dining category in the last 90 days.
cash_advance_last90
Float
Total Amount spent in the Cash Advance subcategory in the last 90 days.
misc_spending_percentage_from_total
Float
Percentage spent on Miscellaneous expenses category from the total.
entertainment_spending_percentage_from_total
Float
Percentage spent on Entertainment category from the total.
lifestyle_spending_percentage_from_total
Float
Percentage spent on Health & Lifestyle category from the total.
education_spending_percentage_from_total
Float
Percentage spent on Education category from the total.
bank_fees_spending_percentage_from_total
Float
Percentage spent on Bank Fees & Charges category from the total.
donations_spending_percentage_from_total
Float
Percentage spent on Donations category from the total.
goods_and_merch_spending_percentage_from_total
Float
Percentage spent on Goods & Merchandise category from the total.
home_expense_spending_percentage_from_total
Float
Percentage spent on Home Expenses category from the total.
services_spending_percentage_from_total
Float
Percentage spent on Services category from the total.
utilities_spending_percentage_from_total
Float
Percentage spent on Utilities category from the total.
credit_payment_spending_percentage_from_total
Float
Percentage spent on Transfers & Adjustments category from the total.
transportation_spending_percentage_from_total
Float
Percentage spent on Travel & Transportation category from the total.
food_spending_percentage_from_total
Float
Percentage spent on Food category from the total.
cash_advance_percentage_from_total
Float
Percentage spent on Cash Advance subcategory from the total.
negative_balance_count
Integer
The number of times the borrower's bank balance went negative
Last updated