Loans
Loan instruments, payments, and modifications
Authentication
Requires session cookie (web app) or API key (x-api-key header). All endpoints are tenant-scoped via entityId.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/loans?entityId= | List loan instruments |
| POST | /api/loans | Create loan or actions: record-payment, modify |
| PUT | /api/loans | Update loan |
| DELETE | /api/loans | Delete loan |
List loans
GET /api/loans?entityId={entityId}
Returns an array of loan instruments for the entity.
[
{
"id": "loan_abc123",
"principal": 100000,
"interestRate": 0.05,
"termMonths": 36,
"status": "active"
}
]Create / actions
POST /api/loans
Create loan — body: { "entityId", "principal", "interestRate", "termMonths", ... }
Actions — body: { "entityId", "action": "record-payment" | "modify", "loanId", ... }
record-payment:{ "amount", "date", "memo?" }modify:{ "principal?", "interestRate?", "termMonths?" }
Update / Delete
PUT /api/loans — body: { "entityId", "loanId", ...fields }
DELETE /api/loans — body: { "entityId", "loanId" }