Skip to main content
PUT
/
api
/
loans
/
:id
curl -X PUT "https://api.example.com/api/loans/cm4newloan1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "principalAmount": 75000,
    "termCount": 12,
    "notes": "Increased loan amount after review"
  }'
{
  "success": true,
  "message": "Loan updated successfully",
  "data": {
    "id": "cm4newloan1",
    "loanNumber": "LN00000042",
    "unionMemberId": "cm4xyz789",
    "unionId": "cm4union1",
    "loanTypeId": "cm4type1",
    "principalAmount": 75000.00,
    "currencyCode": "NGN",
    "termCount": 12,
    "termUnit": "MONTH",
    "startDate": "2026-03-15T00:00:00.000Z",
    "endDate": "2027-03-15T00:00:00.000Z",
    "processingFeeAmount": 1000.00,
    "processingFeeCollected": false,
    "penaltyFeePerDayAmount": 100.00,
    "status": "PENDING_APPROVAL",
    "notes": "Increased loan amount after review",
    "unionMember": {
      "id": "cm4xyz789",
      "firstName": "John",
      "lastName": "Doe"
    },
    "union": {
      "id": "cm4union1",
      "name": "Lagos Central Union"
    },
    "loanType": {
      "id": "cm4type1",
      "name": "Business Loan"
    },
    "createdAt": "2026-03-11T14:30:00.000Z",
    "updatedAt": "2026-03-11T15:45:00.000Z"
  }
}

Authentication

Requires authentication. Available to: ADMIN, CREDIT_OFFICER

Path Parameters

id
string
required
Loan ID

Request Body

All fields are optional. Only include fields you want to update.
loanTypeId
string
ID of the loan type
principalAmount
number
Principal loan amount (must be positive)
termCount
integer
Number of repayment terms (must be positive)
termUnit
string
Unit of the repayment term:
  • DAY
  • WEEK
  • MONTH
startDate
datetime
Loan start date (ISO 8601 format)
processingFeeAmount
number
Processing fee amount (minimum: 0)
penaltyFeePerDayAmount
number
Penalty fee per day (minimum: 0)
notes
string
Additional notes

Response

success
boolean
Indicates if the request was successful
message
string
Response message (“Loan updated successfully”)
data
object
Updated loan object

Restrictions

Status Restrictions

Loans can only be updated if their status is:
  • DRAFT
  • PENDING_APPROVAL
Once a loan reaches APPROVED, ACTIVE, or any other status, it cannot be edited.

Permission Model

  • ADMIN: Can update any loan (subject to status restrictions)
  • CREDIT_OFFICER: Can only update loans in unions they manage
  • SUPERVISOR: Cannot edit loans (view-only access)

Schedule Regeneration

If any of the following fields are updated, the repayment schedule is automatically regenerated:
  • principalAmount
  • termCount
  • termUnit
  • startDate
The old schedule items are deleted and new ones are created based on the updated loan parameters.

Validation

  • If loanTypeId is changed, the principal amount must be within the new loan type’s limits
  • If startDate is changed, the endDate is automatically recalculated
  • Loan type must exist and be active
curl -X PUT "https://api.example.com/api/loans/cm4newloan1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "principalAmount": 75000,
    "termCount": 12,
    "notes": "Increased loan amount after review"
  }'
{
  "success": true,
  "message": "Loan updated successfully",
  "data": {
    "id": "cm4newloan1",
    "loanNumber": "LN00000042",
    "unionMemberId": "cm4xyz789",
    "unionId": "cm4union1",
    "loanTypeId": "cm4type1",
    "principalAmount": 75000.00,
    "currencyCode": "NGN",
    "termCount": 12,
    "termUnit": "MONTH",
    "startDate": "2026-03-15T00:00:00.000Z",
    "endDate": "2027-03-15T00:00:00.000Z",
    "processingFeeAmount": 1000.00,
    "processingFeeCollected": false,
    "penaltyFeePerDayAmount": 100.00,
    "status": "PENDING_APPROVAL",
    "notes": "Increased loan amount after review",
    "unionMember": {
      "id": "cm4xyz789",
      "firstName": "John",
      "lastName": "Doe"
    },
    "union": {
      "id": "cm4union1",
      "name": "Lagos Central Union"
    },
    "loanType": {
      "id": "cm4type1",
      "name": "Business Loan"
    },
    "createdAt": "2026-03-11T14:30:00.000Z",
    "updatedAt": "2026-03-11T15:45:00.000Z"
  }
}

Build docs developers (and LLMs) love