Replace the scopes on one of the bot's API keys
Replaces a key's scope set in place, so a long-lived bot credential can be brought up to date without being reissued everywhere it is configured. It is needed because a key's scopes are a snapshot taken when it was minted, and the registry grows: a key created before a scope existed cannot hold it. Rotation is not a substitute — `rotate-key` copies the old scope set onto the replacement, so a stale key stays stale through every rotation. This bites hardest on keys minted with `scopes` omitted, which means "the full registry" *as it stood that day* — so a deliberate "give it everything" silently decays into a partial set as new scopes are added. `scopes` is the complete new set, not a delta, matching `POST .../keys`. Granting a scope never widens what the bot can reach: scopes are a ceiling and the permission check is still the floor, so the key reaches exactly what the bot's project roles allow. Requires `canManageBots` — the workspace admin rescopes the key, never the bot holding it. Delegated credentials are refused on this whole router, so a bot cannot call this with its own key to widen itself.
Replaces a key's scope set in place, so a long-lived bot credential can be brought up to date without being reissued everywhere it is configured.
It is needed because a key's scopes are a snapshot taken when it was minted, and the registry grows: a key created before a scope existed cannot hold it. Rotation is not a substitute — rotate-key copies the old scope set onto the replacement, so a stale key stays stale through every rotation.
This bites hardest on keys minted with scopes omitted, which means "the full registry" as it stood that day — so a deliberate "give it everything" silently decays into a partial set as new scopes are added.
scopes is the complete new set, not a delta, matching POST .../keys. Granting a scope never widens what the bot can reach: scopes are a ceiling and the permission check is still the floor, so the key reaches exactly what the bot's project roles allow.
Requires canManageBots — the workspace admin rescopes the key, never the bot holding it. Delegated credentials are refused on this whole router, so a bot cannot call this with its own key to widen itself.
Authorization
bearerAuth In: header
Path Parameters
uuiduuiduuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X PATCH "https://example.com/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/bots/497f6eca-6276-4993-bfeb-53cbbbba6f08/keys/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Content-Type: application/json" \ -d '{ "scopes": [ "string" ] }'{ "id": "string", "keyPrefix": "string", "name": "string", "kind": "string", "scopes": [ "string" ], "createdAt": "2019-08-24T14:15:22Z"}