Skip to main content

Loans (/api/v1/loans)

Endpoints for creating, managing, extracting, and predicting risk for Consumer Loan Applications.


1. Create a Loan

Creates a new loan application.

  • Method: POST
  • Endpoint: /api/v1/loans/
  • Authentication: Required (Bearer Token)

Request Body

{
"amount": 50000,
"term": 36,
"interestRate": 5.5,
"purpose": "Home Improvement"
}

Response

{
"success": true,
"data": {
"id": "loan_123",
"status": "PENDING"
}
}

2. Predict Risk (Consumer Loan)

Execute the risk prediction algorithm on a consumer loan.

  • Method: POST
  • Endpoint: /api/v1/loans/predict
  • Authentication: Required (Bearer Token)

Request Body

{
"loanId": "loan_123",
"dataPointOverride": { ... } // Optional overrides for prediction
}

Response

{
"success": true,
"data": {
"predictionScore": 85,
"riskLevel": "LOW_RISK",
"recommendation": "APPROVE"
}
}

3. Generate Reports (Consumer & Commercial)

These endpoints trigger report generation based on the loan's extracted data.

Consumer Report

  • Method: POST
  • Endpoint: /api/v1/loans/report/consumer
  • Body: { "loanId": "loan_123" }

Commercial Report

  • Method: POST
  • Endpoint: /api/v1/loans/report/commercial
  • Body: { "loanId": "loan_123" }

4. Get Extracted Data

Retrieves parsed extraction data derived from associated documents (e.g., W2s, Statements).

  • Method: GET
  • Endpoint: /api/v1/loans/extracted-data
  • Query Params: loanId

Response

{
"success": true,
"data": {
"income": 120000,
"liabilities": 25000,
"employer": "Tech Corp"
}
}

5. Get, Update, or Delete Loan

Basic CRUD operations on a single loan application.

Get Loan by ID

  • Method: GET
  • Endpoint: /api/v1/loans/:id

Update Loan

  • Method: PUT
  • Endpoint: /api/v1/loans/:id
  • Body: Form fields to update.

Delete Loan

  • Method: DELETE
  • Endpoint: /api/v1/loans/:id

6. Composite Operations

Shorthand endpoints for creating a loan and executing an immediate follow-up task.

Create & Predict

  • Method: POST
  • Endpoint: /api/v1/loans/create-predict
  • Purpose: Creates the loan and immediately returns a risk prediction.

Create & Generate Report

  • Method: POST
  • Endpoint: /api/v1/loans/create-report
  • Purpose: Creates the loan and generates a consumer/commercial report.