Change an API key
Rename a key, change its expiry, its grant or its conditions, or suspend it. Any change needs the person's own access to cover the key's access now (an owner covers every key); otherwise 403 grant_forbidden, details.reason target_not_covered. A grant change is a new version of the key and is held to the same rules as creating one (a custom grant that does not say which mail it reaches is refused with details.reason mail_scope_required), so it takes the same step-up. The Primitive CLI's token is refused, even with a step-up. Needs the organization's credential features to be enabled; while they are not, this answers 404 feature_disabled.
Person only: a dashboard session, or the person's own OAuth token with a step-up token for purpose keys.create in the Primitive-Step-Up header. Without one an OAuth token is answered 403 step_up_required, whose details carry the dashboard URL that issues it (or 403 grant_forbidden when the person's role could not do it anyway). The person's role must hold keys:manage. API keys and agent connection keys are refused. An agent acting for the person is refused unless it carries a step-up token the person issued in the dashboard.
Request
- Base URLhttps://api.primitive.dev/v1
- URLhttps://api.primitive.dev/v1/keys/{id}
- AuthHTTP bearer
Path parameters
The id of the object this operation acts on.
Headers
A single-use step-up token the person issued in the dashboard for this operation's purpose (valid five minutes). Needed only when calling with an OAuth token; a dashboard session does not send it. Accepted only with a token of the client it was confirmed for; refused with a token issued for MCP and with any API key.
Request body
Response
Success
Changes
No operation changes recorded.