Skip to main content

Undo Loan Approval

Overview

Reverses a loan approval before disbursement has occurred.

Endpoint

POST /api/bpm/cmd

Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesMust be application/json
X-Tenant-IdstringYesTenant identifier

Request Body

{
"cmd": "UndoLoanApprovalCommand",
"data": {
"loanAccountId": 12345,
"reason": "Incorrect information discovered",
"comments": "Need to reverify credit history"
}
}

Parameters

ParameterTypeRequiredDescription
cmdstringYesMust be "UndoLoanApprovalCommand"
dataobjectYesUndo approval data
↳ loanAccountIdintegerYesLoan account ID to undo approval for
↳ reasonstringYesReason for undoing approval
↳ commentsstringNoAdditional comments

Response

Success Response (200 OK)

{
"success": true,
"message": "Loan approval undone successfully",
"data": {
"loanId": "LA-2024-00001",
"status": "Draft",
"approvalUndoneAt": "2024-01-16T09:00:00Z",
"undoneBy": "manager@bank.com",
"reason": "Additional documentation required"
}
}

Status Codes

CodeDescription
200Approval undone successfully
400Cannot undo approval (loan disbursed)
401Unauthorized
403Insufficient authority
404Loan not found
409Loan not in approved status
500Internal server error

Business Rules

  • Can only undo before disbursement
  • Requires supervisory authority
  • Reason is mandatory
  • Loan returns to draft status
  • Re-approval required before disbursement

Code Examples

C# Example

public async Task<UndoApprovalResponse> UndoLoanApprovalAsync(string loanId, string reason)
{
var request = new { loanId, reason };
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");

var response = await _httpClient.PostAsync("/api/administration/loan/undo-approval", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<UndoApprovalResponse>>(result).Data;
}

TypeScript Example

async function undoLoanApproval(loanId: string, reason: string): Promise<UndoApprovalResponse> {
const response = await fetch('/api/administration/loan/undo-approval', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, reason })
});

const result = await response.json();
return result.data;
}

Notes

  • Cannot undo after disbursement
  • Requires higher authority than original approval
  • All approval history maintained in audit trail
  • Loan officer and customer notified
  • Loan must go through approval again