Consumer Loans (/api/v1/loans)
Endpoints for creating, managing, extracting, and predicting risk for Consumer Loan Applications.
1. Predict Risk (Consumer Loan)
Execute the risk prediction algorithm on a consumer loan based on JSON input.
- Method:
POST - Endpoint:
/api/v1/loans/predict - Authentication: Required (
API Key) - Headers:
X-API-Key: <your_api_key>Content-Type: application/json
Request Body
{
"loan_amnt": 15000,
"int_rate": 10.5,
"annual_inc": 85000,
"dti": 12.5,
"open_acc": 10,
"total_acc": 25,
...
}
- cURL
- Python
- JavaScript
curl -X POST https://api.riskinmind.ai/api/v1/loans/predict \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"loan_amnt": 15000,
"int_rate": 10.5,
"annual_inc": 85000,
"dti": 12.5,
"open_acc": 10,
"total_acc": 25
}'
import requests
url = "https://api.riskinmind.ai/api/v1/loans/predict"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"loan_amnt": 15000,
"int_rate": 10.5,
"annual_inc": 85000,
"dti": 12.5,
"open_acc": 10,
"total_acc": 25
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://api.riskinmind.ai/api/v1/loans/predict', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
loan_amnt: 15000,
int_rate: 10.5,
annual_inc: 85000,
dti: 12.5,
open_acc: 10,
total_acc: 25
})
});
const data = await response.json();
console.log(data);
Response
- Content-Type:
application/json
{
"probability": 0.85,
"rejection_probability": 0.15
}
2. Generate Reports (Consumer & Commercial)
These endpoints trigger report generation based on the loan's extracted data and return a PDF binary stream.
Consumer Report
- Method:
POST - Endpoint:
/api/v1/loans/report/consumer - Authentication: Required (
API Key) - Headers:
X-API-Key: <your_api_key>Content-Type: application/json
- Body: Contains the same parameters used for
/predict. - Response Format:
application/pdfbinary stream.
Commercial Report
- Method:
POST - Endpoint:
/api/v1/loans/report/commercial - Authentication: Required (
API Key) - Headers:
X-API-Key: <your_api_key>Content-Type: application/json
- Body: Contains the same parameters used for
/predict. - Response Format:
application/pdfbinary stream.
- cURL
- Python
- JavaScript
curl -X POST https://api.riskinmind.ai/api/v1/loans/report/consumer \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"loan_amnt": 15000,
"int_rate": 10.5,
"annual_inc": 85000
}' --output consumer_report.pdf
import requests
url = "https://api.riskinmind.ai/api/v1/loans/report/consumer"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"loan_amnt": 15000,
"int_rate": 10.5,
"annual_inc": 85000
}
response = requests.post(url, headers=headers, json=data)
with open("consumer_report.pdf", "wb") as f:
f.write(response.content)
const response = await fetch('https://api.riskinmind.ai/api/v1/loans/report/consumer', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
loan_amnt: 15000,
int_rate: 10.5,
annual_inc: 85000
})
});
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = 'consumer_report.pdf';
document.body.appendChild(link);
link.click();
3. CECL Prediction Engine
Calculate Current Expected Credit Losses (CECL) using the RiskInMind financial math engine.
- Method:
POST - Endpoint:
/api/v1/loans/cecl - Authentication: Required (
API Key) - Headers:
X-API-Key: <your_api_key>Content-Type: application/json
Request Body
[
{
"loanId": "loan_123",
"exposureAtDefault": 50000,
"probabilityOfDefault": 0.02,
"lossGivenDefault": 0.45
}
]
- cURL
- Python
- JavaScript
curl -X POST https://api.riskinmind.ai/api/v1/loans/cecl \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{
"loanId": "loan_123",
"exposureAtDefault": 50000,
"probabilityOfDefault": 0.02,
"lossGivenDefault": 0.45
}
]'
import requests
url = "https://api.riskinmind.ai/api/v1/loans/cecl"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = [
{
"loanId": "loan_123",
"exposureAtDefault": 50000,
"probabilityOfDefault": 0.02,
"lossGivenDefault": 0.45
}
]
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://api.riskinmind.ai/api/v1/loans/cecl', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify([
{
loanId: "loan_123",
exposureAtDefault: 50000,
probabilityOfDefault: 0.02,
lossGivenDefault: 0.45
}
])
});
const data = await response.json();
console.log(data);
Response
- Content-Type:
application/json
{
"totalExpectedLoss": 450.00,
"breakdown": [ ]
}
4. 1003 Loan Application Generation
Generate a standardized Uniform Residential Loan Application (Form 1003) PDF. This endpoint synthesizes data from the borrower's profile, extracted documents, and the current loan application.
- Method:
POST - Endpoint:
/api/v1/loans/1003 - Authentication: Required (
API Key) - Headers:
X-API-Key: <your_api_key>Content-Type: application/json
- cURL
- Python
- JavaScript
curl -X POST https://api.riskinmind.ai/api/v1/loans/1003 \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"userId": "user_456",
"orgId": "org_789",
"borrower": {
"ssn": "XXX-XX-XXXX",
"marital_status": "Married"
}
}' --output form_1003.pdf
import requests
url = "https://api.riskinmind.ai/api/v1/loans/1003"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"userId": "user_456",
"orgId": "org_789",
"borrower": {
"ssn": "XXX-XX-XXXX",
"marital_status": "Married"
}
}
response = requests.post(url, headers=headers, json=data)
with open("form_1003.pdf", "wb") as f:
f.write(response.content)
const response = await fetch('https://api.riskinmind.ai/api/v1/loans/1003', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
userId: "user_456",
orgId: "org_789",
borrower: {
ssn: "XXX-XX-XXXX",
marital_status: "Married"
}
})
});
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = 'form_1003.pdf';
document.body.appendChild(link);
link.click();
Response
- Content-Type:
application/pdf - Returns: A binary PDF stream representing the completed 1003 form.