Skip to main content

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 ID
  • in_time (optional): Punch-in time. Defaults to current server time
  • note (optional): Note for the punch-in
  • latitude, longitude (optional): GPS coordinates
  • work_from_home (optional): Set true for remote work, false for office (default false)

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 ID
  • date: Date in YYYY-MM-DD format or the literal string today

Response: 200 OK

Returns null in data if no open punch-in exists.

Attendance Fields Reference

  • id: Record ID
  • employee: Employee ID
  • in_time, out_time: Punch-in/out timestamps
  • note: Free-text note
  • work_from_home: true for remote work, false for office
  • map_lat, map_lng: Punch-in GPS coordinates
  • map_out_lat, map_out_lng: Punch-out GPS coordinates
  • in_ip, out_ip: IP addresses captured at punch-in/out