Request Loan Approval
Overview
Submits a loan for approval workflow when all documentation is complete.
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": "RequestLoanApprovalCommand",
"data": {
"accountEncodedKey": "LN-2024-001234",
"comment": "All documentation complete"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "RequestLoanApprovalCommand" |
| data | object | Yes | Approval request data |
| ↳ accountEncodedKey | string | Yes | Loan account identifier (EncodedKey or AccountNumber) |
| ↳ comment | string | No | Notes for approver |
Response
Success Response (200 OK)
{
"success": true,
"message": "Loan approval request submitted successfully",
"data": {
"loanId": "LA-2024-00001",
"status": "PendingApproval",
"requestedAt": "2024-01-12T10:00:00Z",
"requestedBy": "officer@bank.com",
"approvalLevel": "Level1",
"assignedTo": "manager@bank.com",
"estimatedApprovalTime": "24 hours"
}
}
Status Codes
| Code | Description |
|---|---|
| 200 | Approval request submitted successfully |
| 400 | Loan not ready for approval |
| 401 | Unauthorized |
| 404 | Loan not found |
| 409 | Loan already in approval workflow |
| 500 | Internal server error |
Business Rules
- All required fields must be completed
- Guarantors must be in place
- Documentation must be complete
- Loan automatically routed to appropriate approver based on amount
- Approver notified automatically
Code Examples
C# Example
public async Task<ApprovalRequestResponse> RequestLoanApprovalAsync(string loanId, string notes = null)
{
var request = new { loanId, notes };
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("/api/administration/loan/request-approval", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<ApprovalRequestResponse>>(result).Data;
}
TypeScript Example
async function requestLoanApproval(loanId: string, notes?: string): Promise<ApprovalRequestResponse> {
const response = await fetch('/api/administration/loan/request-approval', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, notes })
});
const result = await response.json();
return result.data;
}
Notes
- Validates all prerequisites before submission
- Routes to appropriate approval level based on amount
- Tracks approval request in workflow system
- Notifications sent to approvers