Developers
Menu

Authentication

Every request carries an API key. There are two kinds:

Personal key Workspace key
Starts with pk_ pkw_
Made by anyone, for themselves an owner or admin, for the workspace
Where Profile → Advanced → API keys Workspace settings → Integrations → API keys
Reaches every workspace you belong to one workspace
Can do whatever you can do what its scopes allow, as an admin
When its maker leaves loses that workspace keeps working until revoked
Best for your own scripts and tools HR, payroll, BI and other systems that belong to the company

For an integration the company relies on — an HR system importing clock-ins, a payroll run, a dashboard — use a workspace key, read-only unless it has to write. It won't break the day the person who set it up moves on.

Sending the key

Either header works, for both kinds; use whichever your HTTP client makes easier.

bash
curl https://api.punchly.work/v1/me/workspaces -H "X-Api-Key: pkw_…"
bash
curl https://api.punchly.work/v1/me/workspaces -H "Authorization: Bearer pkw_…"

X-Api-Key is the header Clockify uses, so a client written for Clockify needs only its base URL changed to talk to Punchly. Always use HTTPS, and never put a key in a URL: addresses end up in logs.

Every key is shown once. Punchly stores only a fingerprint of it; if it's lost, revoke it and make another. Each key shows when it was last used, which is how a forgotten one is spotted, and revoking one stops it at once.

Personal keys

A personal key acts as the person who made it.

Workspace keys

A workspace key belongs to one workspace. Owners and admins make them in Workspace settings → Integrations → API keys, and choose what each may do.

When you create a key you choose Read-only (every :read scope; the right choice for HR and payroll), Full access, or Custom.

Scopes

Scope Lets the key
workspace:read read the workspace and its settings
people:read, people:write read members; add, change and deactivate them
projects:read, projects:write read and change projects, clients, tasks and tags
time:read, time:write read and change time entries, the timer and timesheets
reports:read run reports (summary, detailed, weekly, attendance, assignments) and exports
reports:write manage shared reports
approvals:read, approvals:write read, submit, approve and reject timesheets
time_off:read, time_off:write read and change time off: policies, balances, requests, holidays
expenses:read, expenses:write read and change expenses
invoices:read, invoices:write read and change invoices
schedule:read, schedule:write read and change the schedule
kiosks:read read kiosks and who is clocked in
audit:read read the audit log
webhooks:manage manage webhooks

A few actions stay out of the API whatever the scope: workspace-wide settings switches (approvals, time off, expenses, scheduling), sending reminder emails, and kiosk PINs, QR codes and devices.

What no key can do

A key reaches only the public API: the endpoints in the API reference. Anything else — billing, security settings, making or revoking API keys — needs a person signed in to Punchly.

A few actions stay with a person even inside the public API, because a script's mistake there can't be undone. Transferring workspace ownership is one of them.

When a request is refused

Status code Meaning What to do
401 UNAUTHENTICATED No key, or a key that is wrong, revoked or expired Check the header and the key; make a new key if it was revoked
403 FORBIDDEN, details.reason: "insufficient_scope" A workspace key without the scope this endpoint needs. details.requiredScope names it Make a key with that scope
403 FORBIDDEN, details.reason: "personal_key_only" An endpoint about the person holding the key, such as /auth/me Use a personal key
403 FORBIDDEN, details.reason: "not_public_api" The key is fine; the endpoint isn't part of the public API Use an endpoint from the reference
403 FORBIDDEN, details.reason: "not_with_api_key" This action needs a person signed in Do it in Punchly
403 FORBIDDEN (no reason) The key isn't allowed to do this Use a key whose maker, or whose role, may
404 NOT_FOUND The record doesn't exist, or a workspace key asked about another workspace Check the ids
429 RATE_LIMITED Too many requests this minute Wait for Retry-After seconds — see Rate limits
json
{
  "code": "FORBIDDEN",
  "message": "This key can’t do that: it needs the time:write scope.",
  "details": { "reason": "insufficient_scope", "requiredScope": "time:write" }
}

Keeping keys safe