Developers
Menu

Syncing data

Most integrations keep a copy of something: an HR system keeps hours, a payroll run keeps a period's totals, a warehouse keeps everything. The API is built so that copy can be kept with a handful of requests, not one per person per day.

Time entries: one search across people

GET /workspaces/{wid}/time-entries/search returns finished entries for everyone the key may see, flat, up to 1,000 a page. Use it one of two ways.

A period

For a pay period, a month, a week: give start and end (instants; at most a year apart). Entries come in start order.

bash
curl "https://api.punchly.work/v1/workspaces/$WID/time-entries/search?start=2026-09-01T00:00:00Z&end=2026-10-01T00:00:00Z&limit=1000" \
  -H "X-Api-Key: $PUNCHLY_API_KEY"
json
{
  "items": [
    {
      "id": "01929a4b-…",
      "memberId": "01928f3e-8b2d-…",
      "projectId": "01929000-…",
      "startAt": "2026-09-01T03:30:00.000Z",
      "endAt": "2026-09-01T12:00:00.000Z",
      "durationS": 30600,
      "type": "regular",
      "source": "kiosk",
      "kioskId": "01929b10-…",
      "updatedAt": "2026-09-01T12:00:02.000Z",
      "deletedAt": null
    }
  ],
  "nextCursor": "WyIyMDI2LTA5LTAxVDAzOjMwOjAwLjAwMFoiLCIwMTkyOWE0Yi0uLi4iXQ"
}

Follow nextCursor until it is null (Paging). Narrow it down with memberIds, projectIds (comma-separated), type (regular, break, time_off, holiday), source (for example kiosk) and kioskId.

A sync

To keep a copy current, ask for what changed since your last run with updatedSince. Entries then come in the order they last changed, and includeDeleted=true adds entries deleted since, with deletedAt set, so you can remove them on your side.

bash
curl "https://api.punchly.work/v1/workspaces/$WID/time-entries/search?updatedSince=2026-09-30T18:00:00Z&includeDeleted=true" \
  -H "X-Api-Key: $PUNCHLY_API_KEY"

A reliable loop:

  1. Start from a saved since (the first time, the date your copy begins).
  2. Page through search?updatedSince={since}&includeDeleted=true.
  3. For each entry: if deletedAt is set, delete your copy; otherwise insert or replace it by id.
  4. Save the updatedAt of the last entry you received as the next since. Not your own clock: times in Punchly are recorded to the second, and your clock and ours differ. Starting from the last updatedAt you saw means the next run repeats at most a few entries, which replacing by id makes harmless.

An entry's updatedAt moves whenever anything the API shows about it changes: edited, approved, invoiced, released from an invoice, deleted or restored.

Who is clocked in right now

GET /workspaces/{wid}/time-entries/in-progress lists every running timer the key may see: one row per person on the clock, with startAt, the project and, for a kiosk, kioskId. Filter with memberIds or kioskId.

The search returns finished entries only, so a sync never imports half a shift; the in-progress list is where running time lives.

Everything else: updatedSince on the lists

Members, projects, clients, tasks and tags take updatedSince too. Add status=all for projects, clients and tags, so archived ones come as well: archiving is a change your copy should see.

bash
curl "https://api.punchly.work/v1/workspaces/$WID/members?updatedSince=2026-09-30T18:00:00Z&status=all" \
  -H "X-Api-Key: $PUNCHLY_API_KEY"

Hours rather than entries

If you need totals rather than the entries themselves — hours per person per day, first in and last out, overtime — the reports have done the arithmetic: POST /reports/attendance, /reports/summary, /reports/weekly. See Getting started.

Rather be told than ask?

Webhooks send each change as it happens. Most integrations use both: webhooks for speed, and a periodic updatedSince sync to catch anything a webhook missed while your server was down. See Webhooks.