# Revoke an API key

Revokes the key, so the next request presenting it is rejected. The record is kept with `revokedAt` set and `enabled` false, and revocation cannot be undone: create a new key to restore access.

## DELETE `/v1/api-keys/{apiKeyId}`

### Authorization

`Authorization` Bearer token · header required

`Authorization: Bearer <token>` with an API key (`sfa_` prefix), an OAuth access token, a session token, or a Space machine credential (`sfm_` prefix).

or

`Authorization` OAuth2 access token · header required

OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.

**Scopes:** `teams:create`

### Path parameters

`apiKeyId` string required

min length 1

### Responses

204 The key is revoked.

## Try it

### Server

Base URL: https://api.spacefast.com

Custom base URL: Overrides the selected server when set.

### Authorization

Bearer token

Remember on this device

### Parameters

`apiKeyId` path*

### Request

#### cURL

```bash
curl -X DELETE "https://api.spacefast.com/v1/api-keys/string" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

#### JavaScript

```javascript
const response = await fetch("https://api.spacefast.com/v1/api-keys/string", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  }
});
```

#### Python

```python
import requests

response = requests.delete(
    "https://api.spacefast.com/v1/api-keys/string",
    headers={
        "Authorization": "Bearer YOUR_TOKEN"
    },
)
```

### Response

204 The key is revoked.
