Skip to main content
POST
JavaScript
Disabling stops a key’s token from authenticating anywhere, while the key itself (name, scopes, history) stays put. It is the move for a suspected leak or an offboarded integration: instant, reversible, and nothing to re-provision if you were wrong.
The action is idempotent: disabling a disabled key returns 200 and changes nothing.

Disable, rotate, or delete

Three ways to take a token out of service, three different blast radii: A caller presenting a disabled key’s token gets an authentication failure, not a scope denial. The difference in the error body is covered in reading a denial.

Enable an API key

The other half of the switch.

Disable the global API key

The same switch on the account-wide key.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspaceId
string
required

The workspace the API key belongs to (path).

Example:

"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"

id
string
required

The API key to disable.

Example:

"apikey_01HXKD2E5NQM3T9AYWCFCSPNQY"

Body

application/json

The body is of type object.

Response

OK

An API key. Every key belongs to exactly one workspace and is managed via the workspace-scoped API key routes. The only exception is the system-managed global account key, which spans all workspaces and is managed via the account global_api_key routes.

metadata
object
required

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

spec
object
required

Configuration for an API key.

state
enum<string>
required
read-only

The current lifecycle state of the API key. Output only. Keys are created STATE_ENABLED; use the :disable and :enable actions to transition between states.

Available options:
STATE_UNSPECIFIED,
STATE_ENABLED,
STATE_DISABLED
info
object