# Delete a domain

Deletes the domain together with its zone, records, and registration history. Fails while the domain is assigned to a Space, while a registration or transfer is active, while a DNS operation is queued or running, or while a connected provider zone is attached.

## DELETE `/v1/domains/{domainId}`

### Authorization

`Authorization` Bearer token · header required

\`Authorization: Bearer <key>\` with the Space key (\`sfc\_\` prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's \`/\_\_/<key>\` sign-in URL.

or

`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: `domains:write`

### Path parameters

`domainId` string required

### Responses

**204** The domain and its DNS data are deleted.

## 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 Include my values in samples

### Parameters

`domainId` path *

### Request examples

**cURL**

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

**JavaScript**

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

**Python**

```python
import requests

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

### Response

**204**

The domain and its DNS data are deleted.
