---
title: Revoke API Key
protocol: rest
method: DELETE
endpoint: /v1/projects/{projectId}/api-keys/{keyId}
description: "Permanently revoke an API key."
---

# Revoke API Key

Permanently revokes a key. Requests using it fail with `401` immediately. Revocation cannot be undone — create a new key if needed.

<Endpoint method="DELETE" path="/v1/projects/{projectId}/api-keys/{keyId}" />

## Path Parameters

<ParamField path="projectId" type="string" required>
  The project ID.
</ParamField>

<ParamField path="keyId" type="string" required>
  The ID of the key to revoke.
</ParamField>

## Example

<CodeGroup>
```bash cURL
curl -X DELETE https://api.syntext.dev/v1/projects/prj_abc123/api-keys/key_789 \
  -H "Authorization: Bearer stx_abc12345_..."
```

```typescript SDK
await client.apiKeys.revoke('prj_abc123', 'key_789')
```
</CodeGroup>

### Response

```json
{
  "data": { "id": "key_789", "revoked": true }
}
```

### 404 Not Found

Returned if the key doesn't exist or was already revoked.
