On this page
keys.revoke
Revoke an API key; queued effects of its runs are denied
Request
DELETE /api/v1/keys/{key_id}
- MCP:
keys_revoke - SDK:
client.keys.revoke(SDK path arguments usepath; MCP usesparams). - Minimum API key role: admin.
- Idempotency: natural.
Use the request schema below. Read IDs from earlier operation results.
Input schema
json
{
"parameters": [
{
"name": "key_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": null
}
Responses
json
{
"200": {
"description": "Revoke an API key; queued effects of its runs are denied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiKey"
}
}
}
},
"4XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"5XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
Referenced schemas
json
{
"components": {
"schemas": {
"ApiKey": {
"type": "object",
"properties": {
"key_id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"role": {
"type": "string",
"enum": [
"admin",
"member",
"viewer"
]
},
"can_dial": {
"type": "boolean"
},
"prefix": {
"type": "string",
"minLength": 4,
"maxLength": 32
},
"created_at": {
"type": "string",
"format": "date-time"
},
"last_used_at": {
"allOf": [
{
"type": "string",
"format": "date-time"
}
],
"nullable": true
},
"expires_at": {
"allOf": [
{
"type": "string",
"format": "date-time"
}
],
"nullable": true
},
"revoked_at": {
"allOf": [
{
"type": "string",
"format": "date-time"
}
],
"nullable": true
}
},
"required": [
"key_id",
"name",
"role",
"can_dial",
"prefix",
"created_at",
"last_used_at",
"expires_at",
"revoked_at"
],
"additionalProperties": false
},
"ApiError": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"unauthenticated",
"forbidden",
"not_found",
"conflict",
"invalid_request",
"idempotency_conflict",
"policy_denied",
"capability_unavailable",
"provider_unavailable",
"knowledge_unavailable",
"publication_invalid",
"run_not_active",
"rate_limited",
"outcome_unknown",
"internal"
]
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
},
"outcome": {
"type": "string",
"enum": [
"none",
"unknown"
]
},
"details": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"code",
"message",
"retryable",
"outcome"
],
"additionalProperties": false
}
},
"required": [
"error"
],
"additionalProperties": false
}
}
}
}
Errors and recovery
See API error handling and Troubleshooting.
Related guides
Content version 86c11c0dMarkdown source