List History
Retrieve a comprehensive audit log of all changes made to records in the system. The history endpoint provides full traceability for compliance, debugging, and accountability purposes.
Every significant action in the system is logged, including:
- Record Creation: When bookings, vehicles, or users are created
- Updates: Field-level changes with before/after values
- Deletions: When records are removed
- Status Changes: Booking status transitions, vehicle availability changes
Each history entry includes:
- What changed (model type and specific fields)
- Who made the change (user info or "system" for automated changes)
- When the change occurred
- Where the request came from (IP address and user agent)
This audit trail is essential for regulatory compliance, dispute resolution, and understanding system behavior.
Endpoint
INFO
GET /api/v1/dashboard/histories
Headers
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model_type | string | - | Filter: booking, vehicle, client, user |
model_id | integer | - | Filter by specific model ID |
user_id | integer | - | Filter by user who made changes |
action | string | - | Filter: created, updated, deleted |
start_date | date | - | Filter from date |
end_date | date | - | Filter to date |
page | integer | 1 | Page number |
per_page | integer | 15 | Items per page |
Example Request
bash
curl -X GET "https://api.daakey.com/api/v1/dashboard/histories?model_type=booking&page=1" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}"Response
Success (200)
json
{
"success": true,
"message": "History retrieved",
"data": [
{
"id": 100,
"model_type": "booking",
"model_id": 50,
"model_reference": "BK-2024-00050",
"action": "updated",
"changes": {
"status": {
"old": "upcoming",
"new": "active"
}
},
"user": {
"id": 1,
"name": "System",
"type": "system"
},
"ip_address": null,
"user_agent": null,
"created_at": "2024-01-15T10:05:00Z"
},
{
"id": 99,
"model_type": "vehicle",
"model_id": 1,
"model_reference": "ABC-123",
"action": "updated",
"changes": {
"status": {
"old": "available",
"new": "in_use"
}
},
"user": {
"id": 1,
"name": "System",
"type": "system"
},
"ip_address": null,
"user_agent": null,
"created_at": "2024-01-15T10:05:00Z"
},
{
"id": 98,
"model_type": "booking",
"model_id": 50,
"model_reference": "BK-2024-00050",
"action": "created",
"changes": {
"client_id": 1,
"vehicle_id": 1,
"start_date": "2024-01-15T10:00:00Z",
"end_date": "2024-01-15T18:00:00Z"
},
"user": {
"id": 10,
"name": "John Doe",
"type": "client"
},
"ip_address": "192.168.1.1",
"user_agent": "Daakey/1.0 iOS",
"created_at": "2024-01-10T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"last_page": 50,
"per_page": 15,
"total": 750
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Notes
- History is scoped based on user permissions
- System actions are logged without user context
- IP addresses are logged for audit purposes