Developers
Menu

Getting started

Five minutes from nothing to reading and writing time. Every example uses curl; anything that speaks HTTPS and JSON works the same way.

1. Make an API key

  1. Sign in to Punchly.
  2. Open Profile → Advanced → API keys.
  3. Give the key a name that says where it will live (for example, Payroll sync) and choose Create key.
  4. Copy the key. It starts with pk_, and it is shown once: Punchly keeps only a fingerprint of it, so nobody can read it back later, us included. Lose it, and you make a new one.

Keep it somewhere safe, such as an environment variable:

bash
export PUNCHLY_API_KEY="pk_…"

A key acts as you: it sees what you see and can do what you can do, in every workspace you belong to. See Authentication.

Connecting a company system, such as an HR or payroll tool? Use a workspace key instead: an owner or admin makes one under Workspace settings → Integrations → API keys, read-only unless it has to write, and it keeps working when people come and go. Every step below works the same with it.

2. Find your workspace

Almost every path starts with a workspace. Ask which ones your key reaches:

bash
curl https://api.punchly.work/v1/me/workspaces \
  -H "X-Api-Key: $PUNCHLY_API_KEY"
json
{
  "items": [
    {
      "workspaceId": "01928f3e-7a1c-7d2e-9b1a-3c4d5e6f7a8b",
      "name": "Acme Ltd",
      "memberId": "01928f3e-8b2d-7e3f-8c2b-4d5e6f7a8b9c",
      "role": "admin",
      "status": "active",
      "isProjectManager": false,
      "isTeamManager": false,
      "logoUrl": null,
      "invitationId": null,
      "subscription": { "planName": "Standard", "status": "active", "trialPlanName": null, "trialEndsAt": null }
    }
  ]
}

Keep workspaceId; the examples below call it $WID. memberId is you, inside that workspace.

3. Read time entries

Everything tracked in September, grouped by day:

bash
curl "https://api.punchly.work/v1/workspaces/$WID/time-entries?from=2026-09-01&to=2026-09-30" \
  -H "X-Api-Key: $PUNCHLY_API_KEY"
json
{
  "days": [
    {
      "date": "2026-09-30",
      "totalSeconds": 27000,
      "entries": [
        {
          "id": "01929a4b-…",
          "memberId": "01928f3e-8b2d-…",
          "description": "Quarterly payroll run",
          "projectId": "01929000-…",
          "taskId": null,
          "tagIds": [],
          "billable": true,
          "type": "regular",
          "source": "timer",
          "startAt": "2026-09-30T03:30:00.000Z",
          "endAt": "2026-09-30T08:00:00.000Z",
          "durationS": 16200,
          "localStartDate": "2026-09-30",
          "version": 3
        }
      ]
    }
  ],
  "weekTotals": [{ "weekStart": "2026-09-28", "totalSeconds": 27000 }],
  "nextCursor": null
}

4. Start and stop the timer

Most workspaces require a project on every entry; new workspaces do by default. List the projects and keep one's id (called $PID below):

bash
curl https://api.punchly.work/v1/workspaces/$WID/projects   -H "X-Api-Key: $PUNCHLY_API_KEY"

No project yet? Make one, as its manager:

bash
curl -X POST https://api.punchly.work/v1/workspaces/$WID/projects   -H "X-Api-Key: $PUNCHLY_API_KEY"   -H "Content-Type: application/json"   -d '{ "name": "Acme website", "makeMeManager": true }'

Then start the timer on it:

bash
curl -X POST https://api.punchly.work/v1/workspaces/$WID/timer/start   -H "X-Api-Key: $PUNCHLY_API_KEY"   -H "Content-Type: application/json"   -d '{ "description": "Client call", "projectId": "'"$PID"'", "billable": true }'

The answer (201) holds the new running entry (its endAt is null). If another timer was running, it is stopped first and returned as stopped. To stop:

bash
curl -X POST https://api.punchly.work/v1/workspaces/$WID/timer/stop   -H "X-Api-Key: $PUNCHLY_API_KEY"   -H "Content-Type: application/json"   -d '{}'

GET /workspaces/$WID/timer tells you what is running right now, if anything.

Required fields. A workspace can require a project, task, tag or description on every entry. A timer may start without them — the answer lists what's still missing in missingRequiredFields — but it can't stop, and a finished entry can't be saved, until they're filled in: the answer is 422 REQUIRED_FIELD_MISSING, with the missing ones in details.fields.

5. Write a finished entry

bash
curl -X POST https://api.punchly.work/v1/workspaces/$WID/time-entries \
  -H "X-Api-Key: $PUNCHLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "startAt": "2026-09-29T09:00:00+05:30",
        "endAt": "2026-09-29T11:30:00+05:30",
        "description": "Design review",
        "projectId": "01929000-…"
      }'

The answer (201) holds the saved entry, plus any warnings — for example OVERLAP when it overlaps another entry. Warnings never block the write; errors do. See Errors.

To change an entry later, PATCH /workspaces/$WID/time-entries/{id} with the fields to change and the version you last read. If someone changed it in between, you get 409 VERSION_CONFLICT rather than silently overwriting their change.

6. Pull an attendance report

First in, last out, breaks and overtime, per person and per day:

bash
curl -X POST https://api.punchly.work/v1/workspaces/$WID/reports/attendance \
  -H "X-Api-Key: $PUNCHLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "range": { "from": "2026-09-01", "to": "2026-09-30" }, "tz": "Asia/Kolkata" }'

Each row in days has the member, the date, startAt (first in), endAt (last out), and workS, breakS, overtimeS, undertimeS and balanceS in seconds. stillClockedIn is true for a day that hasn't ended yet. The Summary, Detailed and Weekly reports work the same way.

Next