Approve Loan Account
Overview
Approves a loan application allowing it to proceed to disbursement.
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": "ApproveLoanCommand",
"data": {
"accountEncodedKey": "LN-2024-001234",
"comment": "Approved - All documentation verified"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "ApproveLoanCommand" |
| data | object | Yes | Approval data |
| ↳ accountEncodedKey | string | Yes | Loan account identifier (EncodedKey or AccountNumber) |
| ↳ comment | string | No | Approval comments or notes |
Response
Success Response (200 OK)
{
"success": true,
"message": "Loan approved successfully",
"data": {
"loanId": "LA-2024-00001",
"status": "Approved",
"approvalDate": "2024-01-15T14:00:00Z",
"approvedBy": "manager@bank.com",
"approvalComments": "Approved - All documentation complete",
"readyForDisbursement": true
}
}
Status Codes
| Code | Description |
|---|---|
| 200 | Loan approved successfully |
| 400 | Invalid request or loan not eligible for approval |
| 401 | Unauthorized |
| 403 | Insufficient approval authority |
| 404 | Loan not found |
| 409 | Loan already approved or in wrong status |
| 500 | Internal server error |
Business Rules
- Loan must be in PendingApproval status
- Approver must have sufficient authority for loan amount
- All required documentation must be complete
- Credit checks must pass
- Approval logged in audit trail
Code Examples
C# Example
public async Task<ApprovalResponse> ApproveLoanAsync(long loanAccountId, string comments = null)
{
var commandRequest = new
{
cmd = "ApproveLoanCommand",
data = new { loanAccountId, comments }
};
var json = JsonSerializer.Serialize(commandRequest);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("/api/bpm/cmd", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApprovalResponse>(result);
}
TypeScript/JavaScript Example
async function approveLoan(loanAccountId: number, comments?: string): Promise<any> {
const commandRequest = {
cmd: 'ApproveLoanCommand',
data: { loanAccountId, comments }
};
const response = await fetch('/api/bpm/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, approvalComments: comments })
});
const result = await response.json();
return result.data;
}
Notes
- Approval may trigger multiple approval levels
- System validates approver authority automatically
- Notifications sent to relevant parties
- Loan becomes eligible for disbursement
- Repayment schedule generated automatically