- Qubitara Synapse
- Developer guide
- API keys
API keys
An API key lets a machine — a build pipeline, a sync script, a monitoring job — call the API without a person's session. Keys are scoped: each one says exactly what it may do, and nothing else.
Scopes#
Scope | Allows |
|---|---|
| Read pages, their content, versions and attachments |
| Create, change, move and delete pages — including publish |
| List spaces and read their settings |
| Create spaces and change their settings |
| Read the organization's audit log |
GET /admin/api-keys/scopes lists them with their descriptions. The default is closed: an endpoint that does not declare a scope cannot be reached with a key at all, however broad the key — people-only things such as billing, identity and administration stay people-only.
Create a key#
curl -X POST https://<host>/api/v1/admin/api-keys \
-H "Authorization: Bearer <administrator session token>" -H "Content-Type: application/json" \
-d '{ "name": "Release pipeline", "scopes": ["pages:read", "pages:write"], "expiresInDays": 180 }'Field | Notes |
|---|---|
| What it is for; shown in the list and in the audit log |
| One or more from the table |
| 1–730. Optional, but set one: a key that never expires is a key nobody rotates |
| Optional: limit the key to one space group |
The answer contains the key itself — syn_<prefix>.<secret> — once. Store it in your secret manager immediately; Synapse keeps only a hash and cannot show it again. The prefix part is also returned on its own so you can tell keys apart later.
Use a key#
Send it in the Authorization header with the ApiKey scheme — not Bearer, which is for session tokens:
curl https://<host>/api/v1/projects \
-H "Authorization: ApiKey syn_abc123.…"A header rather than a query parameter on purpose: query strings end up in logs and browser histories; headers do not.
The key acts for the organization it was created in, with its scopes and nothing more. Actions it performs are written to the audit log under the key's name.
List, rotate, revoke#
GET /admin/api-keys— every key with its name, prefix, scopes, expiry and when it was last used. Never the secret.Rotate by creating a new key, switching the integration to it, then deleting the old one — the two can overlap for as long as the switch takes.
DELETE /admin/api-keys/:id— revoke at once. Requests with that key answer 401 from then on.
Good practice#
One key per integration, named for it. When something misbehaves, the audit log says which.
The smallest scopes that work. A reporting script needs
pages:read, notpages:write.Expiry on every key, and a calendar reminder a week before.
Never in source control, never in a browser. Keys belong on servers.