scope parameter, or build them with the SDK.
resource:action, and the action is always read or write.
Reference
Build scopes with the SDK
Typing scope strings by hand is where the mistakes happen, and a wrong one fails as a403
long after the request that caused it. build_scopes validates as it builds, so a bad
resource or action throws immediately.
Scope[] in canonical order.
Scope[]
One resource.
enabled: false returns an empty array, which makes a conditional scope a
one liner rather than a branch.Scope[]
A map of resources. A value of
true means every action the resource supports. You can
also pass "read", ["read", "write"], or { read: true, write: false }.Scope[]
Validate scope strings you already have, or bare resource names, which expand to every
action the resource supports.
authorize_url accepts every one of these directly, so calling build_scopes first is
optional.
scopes is the resolved list that was actually sent.
Aliases
The SDK accepts a few aliases for the names that differ from the resource they guard. They resolve to the canonical scope, sobuild_scopes("user", "read") returns ["profile:read"].
Helpers
Read the profile
profile:read is the scope that answers “who approved access”. With it, a token can call
GET /api/v1/user and read the account.
Scopes that cover more than their name
A few scopes grant access to a resource you would not guess from the name.
Two more gaps worth knowing before you design around them.
workspaces:write covers create
and update but not delete, so DELETE /api/v1/workspaces/{id} cannot be reached by an
OAuth token alone. keys:write covers create and update, but not delete.
Sensitive scopes
How scopes are enforced
A request must satisfy two checks. The token must carry the scope, and the account must have permission for the action. If either fails the API returns403. If the token is missing or
expired the API returns 401.
The token is limited to the intersection of the scopes the user approved and the scopes the
application currently holds. Narrowing an application’s scopes narrows every token it issued.