api.*.update_key(to update keys in any API)api.<api_id>.update_key(to update keys in a specific API)
See the API reference for the full HTTP endpoint documentation.
Usage
Flags
string
required
The key ID to set roles on. This is the database identifier returned from key creation (e.g.,
key_2cGKbMxRyIzhCxo1Idjz8q), not the actual API key string that users include in requests.string[]
required
Comma-separated list of roles. Replaces all existing roles on the key with this exact set. All roles must already exist in your workspace — invalid role references cause the entire operation to fail atomically. Providing an empty value removes all role assignments from the key.
Global Flags
Examples
Output
Default output shows the request ID, followed by the roles now assigned to the key:--output=json, the full response envelope is returned: