# Revoke an API key

`DELETE /api/v1/api-keys/{id}`

Soft revoke: sets `revoked_at`. The row is retained for the audit trail and is never hard-deleted. Idempotent.

No API key can call this route: it needs a signed-in dashboard user with the right role. A key answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | required |  |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | `manual` or `rolled` | optional | `rolled` ends a rolled key’s 24-hour overlap early. Default `manual`. |

## Responses

### 200

The revoked key.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "name": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "test",
            "live"
          ]
        },
        "keyPrefix": {
          "type": "string",
          "enum": [
            "gpy_",
            "agk_",
            "pk_"
          ]
        },
        "keyHint": {
          "type": "string",
          "description": "Last 4 characters of the key. The only fragment of the secret ever stored.",
          "example": "aB3x"
        },
        "keyType": {
          "type": "string",
          "enum": [
            "developer",
            "agent",
            "publishable"
          ],
          "example": "developer"
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastUsedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "revokedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "revokedReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "manual",
            "rolled",
            null
          ],
          "description": "Why the key was revoked: `manual` (DELETE), or `rolled` (its overlap was ended early). Null while live, and on keys revoked before this field existed."
        },
        "replacedBy": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "description": "The key that replaced this one when it was rolled. A key with a replacement cannot be rolled again."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "name",
        "mode",
        "keyPrefix",
        "keyHint",
        "keyType",
        "scopes",
        "createdAt"
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```
