Attendance API
Endpoints for managing attendance records, punch in/out, and tracking work-from-home status.
List Attendance Records
Retrieves all attendance records. Admin users see all entries; managers see only subordinate entries. Records include the work_from_home flag.
GET /attendance
Response: 200 OK
{
"status": "SUCCESS",
"data": [
{
"id": 1,
"employee": 1,
"in_time": "2026-04-15 09:00:00",
"out_time": "2026-04-15 17:30:00",
"note": "Regular workday",
"work_from_home": false,
"map_lat": 37.7749,
"map_lng": -122.4194
}
]
}
Get Single Attendance Entry
GET /attendance/{id}
Response: 200 OK or 404 Not Found
Create Attendance Entry
Creates a new attendance entry. Admins and managers can add entries for subordinates; employees can add their own entries.
POST /attendance
Request Body:
{
"employee": 1,
"note": "Regular workday"
}
Response: 200 OK
Delete Attendance Entry
Deletes an attendance entry. Admin users only.
DELETE /attendance/{id}
Response: 200 OK
Punch In
Records an employee punching in. Supports GPS coordinates and a work-from-home flag.
POST /attendance/punch-in
Request Body:
{
"employee": 1,
"in_time": "2026-04-15 09:00:00",
"note": "Morning check-in",
"latitude": 37.7749,
"longitude": -122.4194,
"work_from_home": false
}
Request Fields:
employee(required): Employee IDin_time(optional): Punch-in time. Defaults to current server timenote(optional): Note for the punch-inlatitude,longitude(optional): GPS coordinateswork_from_home(optional): Settruefor remote work,falsefor office (defaultfalse)
Response: 201 Created
{
"status": "SUCCESS",
"data": {
"id": 1,
"employee": 1,
"in_time": "2026-04-15 09:00:00",
"out_time": null,
"note": "Morning check-in",
"work_from_home": false,
"map_lat": 37.7749,
"map_lng": -122.4194,
"in_ip": "203.0.113.42"
}
}
Error Response: 400 Bad Request if the employee is already punched in.
Punch Out
Records an employee punching out. Captures GPS and IP at punch-out.
POST /attendance/punch-out
Request Body:
{
"employee": 1,
"note": "End of day"
}
Response: 200 OK
{
"status": "SUCCESS",
"data": {
"id": 1,
"employee": 1,
"in_time": "2026-04-15 09:00:00",
"out_time": "2026-04-15 17:30:00",
"note": "End of day",
"map_out_lat": 37.7749,
"map_out_lng": -122.4194,
"out_ip": "203.0.113.42"
}
}
Error Response: 400 Bad Request if the employee is not currently punched in.
Get Attendance for Specific Employee
GET /employee/{employeeId}/attendance
Response: 200 OK with attendance records for the specified employee, including work_from_home.
Get Open Punch-In
Returns the unclosed attendance entry (punched in but not out) for an employee on a specific date. Use today for the current day.
GET /employee/{employeeId}/open-punch-in/{date}
Path Parameters:
employeeId: Employee IDdate: Date inYYYY-MM-DDformat or the literal stringtoday
Response: 200 OK
Returns null in data if no open punch-in exists.
Attendance Fields Reference
id: Record IDemployee: Employee IDin_time,out_time: Punch-in/out timestampsnote: Free-text notework_from_home:truefor remote work,falsefor officemap_lat,map_lng: Punch-in GPS coordinatesmap_out_lat,map_out_lng: Punch-out GPS coordinatesin_ip,out_ip: IP addresses captured at punch-in/out