Retrieving a Customer's Credit Insights
Guide as to how customer insights can be retrieved
Inscribe Credit Insights are sets of statistics and predictions around a customer or a customer's bank
account. These statistics are based on the transactions retrieved from the uploaded customer documents and/or open banking data.
This guide will focus on retrieving the following six types of insights:
- General Insights: Returns general summary statistics about creditworthiness.
- Income Insights: Returns in-depth information about income/revenue.
- Cashflow Insights: Returns in-depth information about cashflow and balance statistics.
- Expenditure Insights: Returns in-depth information about expenditure.
- Loan Insights: Returns in-depth information about loans and existing credit lines.
- Risk Insights: Returns in-depth information about risk indicators.
Prerequisite(s)
- Retrieve your API key as detailed here .
Get Credit Insights Flow
- Create Customer.
- Associated financial data with the Customer. Financial data in this scenario can be in the form of bank statement documents or Open Banking data. Both forms of financial data can be submitted simultaneously and the transactions will be returned with the data source identified.
- Verify Customer hasn’t uploaded fraudulent documents.
- Retrieve Credit Insights.
Step by Step
1. Create Customer
To begin, we must create a customer whose transactions we want to view. Additional information on creating a customer can be viewed here.
sts
URL = "<https://api.inscribe.ai/api/v2>"
API_KEY = "Inscribe ..."
headers = {
"Authorization": API_KEY,
"accept": "application/json",
"content-type": "application/json"
}
payload = {"name": "John Smith"}
response = requests.post(f"{URL}/customers", json=payload, headers=headers)
customer = response.json()
2. Associate Financial Data with the Customer
Once the customer has been created, we must associate transactional data with the customer. This data can be in the form of bank statements or open banking data. Both forms can also be associated with the one customer.
To Submit a Document:
customer_id = customer["id"]
with open("DOCUMENT_FILE_PATH", "rb+") as document:
filename = os.path.basename(document.name)
files = {"file": (filename, document, "application/octet-stream")}
response = requests.post(
f"{URL}/customers/{customer_id}/documents",
files=files,
headers=headers
)
To Submit Open Banking Data:
customer_id = customer["id"]
with open("PLAID_ASSET_FILE_PATH", "r") as asset_report:
data = asset_report.read()
response = requests.post(
f"{URL}/customers/{customer_id}/plaid_assets",
headers=headers,
data=data
)
Check Fraud Statuses
Before ingesting any insights, it is highly recommended to inspect the returned document Trust Scores. This value is a measure of how much Inscribe trusts a document.
3a. Retrieve Credit Insights for a Customer
After the customer data has been uploaded and processed, the Credit Insights endpoints are ready to be queried. To retrieve general credit insights, run the following:
url = f"https://api.inscribe.ai/api/v2/customers/{customer_id}/credit_analysis"
response = requests.request("GET", url, headers=headers)
general_credit_insights = response.json()
To retrieve credit insights specific to any of the following topics, add one of the insight names at the end of the above URL:
- income_insights
- risk_insights
- expenditure_insights
- loan_insights
- cashflow_insights
For example:
url = f"https://api.inscribe.ai/api/v2/customers/{customer_id}/credit_analysis/income_insights"
response = requests.request("GET", url, headers=headers)
income_insights = response.json()
3a. Retrieve Credit Insights for a Specific Customer Bank Account
To get all bank accounts relevant to the customer, run the following:
url = f"https://api.inscribe.ai/api/v2/customers/{customer_id}/bank_accounts"
headers = {"accept": "application/json"}
bank_accounts = requests.get(url, headers=headers)
Then, updating the URL to contain one of above bank accounts, follow the instructions in step 3a to get credit insights. For example:
url = f"https://api.inscribe.ai/api/v2/customers/{customer_id}/bank_accounts/{bank_account_id}/credit_analysis"
response = requests.request("GET", url, headers=headers)
general_credit_insights = response.json()
Updated over 1 year ago