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.
curl https://api.punchly.work/v1/me/workspaces -H "X-Api-Key: pkw_…"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.
- Same permissions. It sees exactly what you see and may do exactly what you may do, in every workspace you belong to. A member's key reads that member's time; an admin's key reads the workspace's. When your role changes, the key's reach changes with it.
- Same rules. Locked periods, approvals, required fields and every other workspace setting apply to a key just as they do in the app.
- Up to 20 per person: one per integration makes it easy to revoke one without breaking the others.
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.
- One workspace. Any other workspace answers
404, even one its maker belongs to.GET /me/workspaceslists just its own. - Scopes. Each key has a list of scopes, and each endpoint needs one: reading time needs
time:read, changing it needstime:write. The API reference names the scope on every endpoint. - An admin, never the owner. Within its scopes, a key may do what an admin may do. Actions only the owner can take stay closed to every key.
- Recorded as its maker, via the key. A change a key makes is recorded as made by the person who created it, and the audit log adds via workspace key "Payroll sync", so you can always tell a key's work from a person's.
- Outlives its maker. If that person is deactivated or leaves, the key keeps working until an owner or admin revokes it.
- Up to 50 per workspace.
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 |
{
"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
- One key per integration, named after it, with the fewest scopes it needs.
- Keep keys in a secret store or environment variables, never in source control, an email, or code a browser downloads.
- Revoke a key the moment you think it has leaked. Nothing else is needed: the old key simply stops working.
- A personal key belongs to a person: when they're removed from a workspace, their key loses it. Move a company integration to a workspace key before that happens.