Close Loan Account
Overview
Closes a loan account after all obligations have been fully satisfied.
Endpoint
POST /api/bpm/cmd
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token for authentication |
| Content-Type | string | Yes | Must be application/json |
| X-Tenant-Id | string | Yes | Tenant identifier |
Request Body
{
"cmd": "CloseLoanCommand",
"data": {
"accountEncodedKey": "LN-2024-001234",
"comment": "Loan fully repaid ahead of schedule"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "CloseLoanCommand" |
| data | object | Yes | Closure data |
| ↳ accountEncodedKey | string | Yes | Loan account identifier (EncodedKey or AccountNumber) |
| ↳ comment | string | No | Closure notes |
Response
Success Response (200 OK)
{
"success": true,
"message": "Loan closed successfully",
"data": {
"loanId": "LA-2024-00001",
"loanAccountNumber": "3001234567890",
"status": "Closed",
"closureDate": "2024-12-15T10:00:00Z",
"closureType": "FullRepayment",
"totalPrincipalRepaid": 50000.00,
"totalInterestRepaid": 6850.00,
"totalAmountRepaid": 56850.00,
"outstandingBalance": 0.00,
"closedBy": "system@bank.com"
}
}
Status Codes
| Code | Description |
|---|---|
| 200 | Loan closed successfully |
| 400 | Loan has outstanding balance or cannot be closed |
| 401 | Unauthorized |
| 403 | Insufficient authority |
| 404 | Loan not found |
| 409 | Loan already closed |
| 500 | Internal server error |
Business Rules
- All principal and interest must be fully paid
- Outstanding fees can be waived with authorization
- Guarantor releases processed automatically
- Collateral release initiated
- Customer receives closure confirmation
- Historical data retained for reporting
Code Examples
C# Example
public async Task<ClosureResponse> CloseLoanAsync(string loanId, string closureType, bool waiveFees = false)
{
var request = new { loanId, closureType, waiveFees };
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("/api/administration/loan/close", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<ClosureResponse>>(result).Data;
}
TypeScript Example
async function closeLoan(loanId: string, closureType: string, waiveFees: boolean = false): Promise<ClosureResponse> {
const response = await fetch('/api/administration/loan/close', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, closureType, waiveFees })
});
const result = await response.json();
return result.data;
}
Notes
- Validates all outstanding balances before closure
- Releases guarantors and collateral
- Generates closure certificate for customer
- Updates customer credit profile
- Archived for regulatory retention
- Cannot be reopened once closed