Keys and scopes
Watchtower has five kinds of key. They differ in who holds them, what they can reach and how scopes apply.
Kind | Prefix | Created with | Who it acts as | Scopes |
|---|---|---|---|---|
Personal access token (PAT) |
|
| You, optionally narrowed | Optional list; omit for your full role |
Org API key |
|
| A role in the org or one project | None: a |
Service account key |
|
| The service account's role | Required, non-empty |
Ingest key |
|
| One project and environment | Required, |
Publishable key |
|
| The browser SDK of listed origins | Always |
Scope table
A cell with a mark means the kind can carry that scope.
Scope | PAT | Org API key | Service account key | Ingest key | Publishable key |
|---|---|---|---|---|---|
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes (fixed) | |||
| yes | ||||
| yes | ||||
| yes | ||||
| yes | ||||
| yes | ||||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
| yes | yes | |||
(no scopes: role decides) | yes |
Notes:
A PAT accepts the same list as a service account key, but only the
query:*,admin:*andci:writescopes do anything on the API. Omitscopesto keep your whole role.The
ingest:*scopes are for the telemetry endpoints (ingest.<host>); an API-scope key cannot send telemetry and an ingest key cannot call the API. A key without the scope for a route gets 403 only for resources it can see; resources it cannot see stay 404.ingest:rumcredentials andagent:fleetkeys are never browser keys; the publishable key is the only one meant to be public (it is bound to an origin allowlist).A project-scoped org API key with
read_onlyanswers 403read_only_keyto anything but GET and HEAD.
ci:write
ci:write is the scope for a CI job. It is deliberately narrow: it covers only these routes under /v1/projects/{prj}/:
Methods | Path prefix | Use |
|---|---|---|
|
| Read back what CI tools check before they write |
|
| Create and update releases, attach commits |
|
| Deploy markers |
|
| Test visibility results |
|
| Source map and other build artifact uploads |
|
| Sentry-CLI compatible release and source map uploads |
Everything else is refused: no reads of telemetry, no DELETE (so a CI key cannot delete a release), no audit routes, no other configuration. This is the scope to put in WT_API_KEY for wtctl release, the deploy-marker call, and the source map upload of the bundler plugins and withWatchtower.
Create a service account key
All three fields are required; a request that misses some answers one 422 that lists every missing field.
curl -sS -X POST "$WT_API/v1/orgs/$ORG/service-accounts/$SA/keys" \
-H "Authorization: Bearer $WT_PAT" -H "Content-Type: application/json" \
-d '{"name":"storefront-ci","expires_in_days":365,"scopes":["ci:write"]}'The response carries the key once (wta_...); only its SHA-256 hash is stored. Scope presets for the common cases (ci, ingest-all, read-only, query-readonly, sql-analyst) are listed by GET /v1/orgs/{org}/key-presets.