GET /api/time_and_attendance_batches
Get time & attendance batches

List time & attendance batches for the current company.

Access: managers and accountants.

Examples

{
  "collection": [
    {
      "id": 42,
      "company_id": 7,
      "work_time_group_id": 3,
      "period_start": "2026-04-01",
      "period_end": "2026-04-30",
      "state": "reviewing",
      "created_at": "2026-05-01T08:30:00.000Z",
      "updated_at": "2026-05-01T08:30:05.000Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "total_pages": 1,
    "total_count": 1
  }
}

Params

Param name Description
page
optional

Page number.

Validations:

  • Must be a Integer

per_page
optional

Number of records per page. Default: 50.

Validations:

  • Must be a Integer

work_time_group_id
optional

Filter by work time group ID.

Validations:

  • Must be a Integer

state
optional

Filter by state.

Validations:

  • Must be one of: draft, reviewing, reporting, reported.

start_date
optional

Filter by exact period start date, e.g. 2025-01-01 or 01/01/2025.

Validations:

  • Must be a String

end_date
optional

Filter by exact period end date, e.g. 2025-01-31 or 31/01/2025.

Validations:

  • Must be a String

date_range
optional

Filter by overlap with a date range. Format: "DD/MM/YYYY - DD/MM/YYYY" (e.g. 01/01/2025 - 31/01/2025).

Validations:

  • Must be a String

sort_by
optional

Sort by field. Default: period_start.

Validations:

  • Must be a String

order
optional

Sorting order. Default: desc.

Validations:

  • Must be one of: desc, asc.


GET /api/time_and_attendance_batches/:id
Get a specific batch with user summaries and reports

Params

Param name Description
id
required

Batch ID

Validations:

  • Must be a Integer


POST /api/time_and_attendance_batches
Find or create a T&A batch for a period

Returns an existing reviewing batch matching the given (work_time_group_id, start_date, end_date) if one exists; otherwise creates a new one, attaches work time entries and absences, and generates user summaries. draft batches (= prior failed creations) are ignored by the lookup and a new batch is created instead.

Note: no email notification is send with user summaries reports.

Access: managers and accountants.

Examples

{
  "id": 42,
  "company_id": 7,
  "work_time_group_id": 3,
  "work_time_group_name": "paid overtime WTG",
  "period_start": "2026-04-01",
  "period_end": "2026-04-30",
  "state": "reviewing",
  "created_at": "2026-05-01T08:30:00.000Z",
  "updated_at": "2026-05-01T08:30:05.000Z",
  "user_summaries": [
    {
      "id": 101,
      "user_id": 55,
      "user_name": "Jane Doe",
      "expected_hours": 184.0,
      "true_hours": 168.0,
      "vacation_duration": "8:00",
      "sick_leave_duration": "0:00",
      "long_absence_duration": "0:00",
      "missing_hours": 8.0,
      "flex_balance_hours": -8.0,
      "vacation_days": 24.0,
      "comp_time_days": "2.0 (Overtime), 0.5 (On-call)"
    }
  ],
  "reports": []
}

Params

Param name Description
work_time_group_id
optional

Work time group ID. Omit to create a company-wide batch.

Validations:

  • Must be a Integer

start_date
required

Period start date, e.g. 2025-01-01.

Validations:

  • Must be a String

end_date
required

Period end date, e.g. 2025-01-31.

Validations:

  • Must be a String

date_range
optional

Alternative to start_date/end_date. Format: "DD/MM/YYYY - DD/MM/YYYY" (e.g. 01/01/2025 - 31/01/2025).

Validations:

  • Must be a String


PUT /api/time_and_attendance_batches/:id/refresh
Recompute user summaries for the batch

Refreshes the user summaries over the batch period, one user summary row per user.

User summaries are internal working data only; the accounting reports (work_time, vacations, other_absences) remain unchangable once generated.

Returns 400 on a draft batch (corrupted creation; delete it instead).

Params

Param name Description
id
required

Batch ID

Validations:

  • Must be a Integer


PUT /api/time_and_attendance_batches/:id/generate_reports
Generate final reports for the batch

Enqueues a worker that generates the work-time, vacations, and other-absences CSV reports and emails them to the company's time-reporting recipients.

Returns 400 if the batch is in reported state (reports are immutable) or draft state (corrupted creation; delete it instead).

Params

Param name Description
id
required

Batch ID

Validations:

  • Must be a Integer


DELETE /api/time_and_attendance_batches/:id
Delete a draft batch

Deletes a corrupted batch (= state draft, left behind by a failed POST /time_and_attendance_batches). Returns 400 on any other state.

Params

Param name Description
id
required

Batch ID

Validations:

  • Must be a Integer


GET /api/time_and_attendance_batches/:id/download_user_summaries_csv
Download user summaries as CSV

Returns the batch's persisted user summaries as a CSV file (one row per user, plus a header row).

The CSV reflects the current state of the persisted summaries — call PUT /refresh first to recompute against the latest work time entries and absences.

Returns 404 if there are no user summaries to download.

Returns 400 on a draft batch (corrupted creation; delete it instead).

Params

Param name Description
id
required

Batch ID

Validations:

  • Must be a Integer