> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encrata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke or Delete API Key

> Revoke an API key (soft disable) or permanently delete it.

## Authentication

Requires an API key in the `Authorization` header.

```bash theme={"dark"}
Authorization: Bearer YOUR_API_KEY
```

## Request

<ParamField query="id" type="string" required>
  The ID of the API key to revoke or delete.
</ParamField>

<ParamField query="permanent" type="string">
  Set to `true` to permanently delete the key instead of revoking it.
</ParamField>

### Revoke (soft disable)

```bash theme={"dark"}
curl -X DELETE "https://encrata.com/api/keys?id=key_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Delete (permanent removal)

```bash theme={"dark"}
curl -X DELETE "https://encrata.com/api/keys?id=key_abc123&permanent=true" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

```json theme={"dark"}
{
  "message": "API key revoked"
}
```

Or for permanent deletion:

```json theme={"dark"}
{
  "message": "API key deleted"
}
```

<Warning>
  Revocation is immediate — any requests using the key will return 401. Permanent deletion removes the key record entirely and cannot be undone.
</Warning>

<ResponseExample>
  ```json 200 theme={"dark"}
  {
    "message": "Key revoked successfully"
  }
  ```

  ```json 400 theme={"dark"}
  {
    "error": "id is required"
  }
  ```

  ```json 401 theme={"dark"}
  {
    "error": "Unauthorized"
  }
  ```

  ```json 404 theme={"dark"}
  {
    "error": "Key not found"
  }
  ```
</ResponseExample>
