Leave API
API endpoints for managing leave requests.
Endpoints
List leave requests
GET /api/v1/leave
Query parameters:
| Parameter | Type | Description |
|-----------|------|------------|
| user_id | string | Filter by user |
| status | string | pending, approved, declined, cancelled |
| start_date | string | Requests starting after this date (YYYY-MM-DD) |
| end_date | string | Requests starting before this date |
Response:
{
"requests": [
{
"id": "lr_abc123",
"user_id": "usr_def456",
"leave_type": "holiday",
"start_date": "2026-06-01",
"end_date": "2026-06-05",
"half_day_start": false,
"half_day_end": false,
"days": 5,
"status": "approved",
"note": "Family holiday",
"created_at": "2026-05-20T09:00:00Z"
}
]
}
Create leave request
POST /api/v1/leave
{
"leave_type": "holiday",
"start_date": "2026-06-01",
"end_date": "2026-06-05",
"note": "Family holiday"
}
Cancel leave request
DELETE /api/v1/leave/{id}
Cancels a leave request. Only the owner or an admin can cancel.
API-created leave requests follow the same approval flow as UI requests. If approval is required, the request will have status: "pending".