Skip to main content

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 -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
}'

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/pdf binary 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/pdf binary stream.
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

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 -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
}
]'

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 -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

Response

  • Content-Type: application/pdf
  • Returns: A binary PDF stream representing the completed 1003 form.