Get Approval History API
Overview
Retrieves the complete approval history (audit trail) for a specific booking request, including manager actions, escalation events, timestamps, and comments. Results are sorted from newest to oldest (createdAt desc).
- Endpoint:
/api/approval-policies/history - Method:
POST - Access: Manager / Corporate Admin
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
requestId | String (UUID) | Yes | The ID of the Booking Request to fetch the history for |
Request Body Example
{
"requestId": "br123456-789a-bcde-f012-3456789abcde"
}
Success Response (200 OK)
{
"success": true,
"message": "Approval history retrieved successfully",
"data": [
{
"id": "ah987654-...",
"journeyId": "aj123456-...",
"level": 2,
"approverId": "u9876543-...",
"status": "PENDING",
"comments": "Auto-escalated to Manager 2 (u9876543-...)",
"escalatedAt": null,
"actionAt": null,
"rateAtDecision": null,
"createdAt": "2026-10-09T10:00:00.000Z",
"approver": {
"id": "u9876543-...",
"firstName": "Jane",
"lastName": "Smith",
"email": "jane.smith@example.com"
}
},
{
"id": "ah123456-...",
"journeyId": "aj123456-...",
"level": 1,
"approverId": "u1234567-...",
"status": "AUTO_ESCALATED",
"comments": "Auto-escalated due to manager timeout (Level 1)",
"escalatedAt": "2026-10-09T10:00:00.000Z",
"actionAt": "2026-10-09T09:40:00.000Z",
"rateAtDecision": "15000.00",
"createdAt": "2026-10-09T09:40:00.000Z",
"approver": {
"id": "u1234567-...",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com"
}
}
]
}
Database Impact
- Tables:
booking_requests,approval_journeys,approval_histories,users - Operations: Nested
SELECTquery joining theApprovalHistoryrecords to their respectiveUser(approver) records.