runs_write to send runs or usage_read to read usage. Every protected route demands a scope, and a credential without it gets 403 scope_denied. This page lists the routes behind each scope and the scopes behind each role, so you can give every key the least it needs. For the reasoning behind these choices, see Scopes and roles.
The nine scopes
Scope names are snake_case strings on the wire, and the same string appears in error messages.GET /healthz, GET /readyz and GET /openapi.json need no credential and no scope.
Scopes by role
Each member of an organization has a role. A console session holds the scopes of its role, and a person can only give a key scopes they hold themselves.
What that means in practice:
- Sending runs needs
owner,adminormember. - Buying credits and changing auto-recharge needs
owner,adminorbilling. - Creating service-account keys needs
owneroradmin, because only they holdmembers_write. - A role outside this table grants nothing. Every scoped route answers
403 scope_denied.
Scopes on an API key
You choose a key’s scopes when you create it. Three rules apply:- At least one scope. An empty list is refused with
400 empty_scopes. - Only scopes you hold. Asking for a scope your own role or key lacks is refused with
403 scope_exceeds_creator, and the message names the scope. - Frozen at creation. A key keeps the scopes it was created with, even if the person who created it later moves to a role with fewer scopes. To narrow a key, create a new one with fewer scopes and revoke the old one.
Suggested sets
The console’s API keys page offers the first three as presets (Send requests, Read only, Manage keys) plus Custom.
Create a key with two scopes
When a scope is missing
A credential that authenticates but lacks the route’s scope gets a 403. The message names the missing scope in its wire form:Related
- Scopes and roles - least privilege, and which role to give whom.
- API keys in the console - create keys with a scope preset.
- Key rotation - replace a key without widening its scopes.
- scope_denied - the full page for the most common scope error.