# Delete a domain

> Remove a sending domain from your project.

`DELETE https://api-connect.nxiom.com/api/v1/emails/domains/{domainId}`

## Authorization

Requires `email.full_access`.

## Path parameters

| Field | Type | Description |
| --- | --- | --- |
| `domainId` | string · required | The domain identifier in the URL path. |

> Deleting a sending domain affects future sends that use it. Confirm the domain ID before making this request.

## Request

### cURL

```shell
curl -X DELETE "https://api-connect.nxiom.com/api/v1/emails/domains/YOUR_DOMAIN_ID" \
  -H "Authorization: Bearer $NEXIOM_API_KEY"
```

### Node.js

```typescript
import { NexiomConnect } from '@nexiom/connect';

const apiKey = process.env.NEXIOM_API_KEY;
if (!apiKey) throw new Error('Set NEXIOM_API_KEY');

const nexiom = new NexiomConnect({ apiKey });

const { error } = await nexiom.domains.delete('YOUR_DOMAIN_ID');

if (error) throw new Error(`${error.code}: ${error.message}`);
console.log('Domain deleted');
```

### PHP

```php
<?php

use Nexiom\Connect\NexiomConnect;

$apiKey = getenv('NEXIOM_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set NEXIOM_API_KEY');
}

$nexiom = new NexiomConnect($apiKey);

$nexiom->domains->delete('YOUR_DOMAIN_ID');
```

## Response

HTTP `200` on success.

### 200 OK

Example successful response.

```json
{
  "success": true
}
```

### 401 Unauthorized

The API key is missing, malformed, revoked, or expired.

```json
{
  "error": "unauthorized",
  "message": "Invalid API key",
  "correlationId": "req_example"
}
```

### 403 Forbidden

The API key lacks a required permission, or its domain restriction does not allow this sender.

```json
{
  "error": "not_allowed",
  "message": "Missing required API key permissions: email.full_access",
  "correlationId": "req_example"
}
```

### 404 Not Found

No resource with this ID exists in the API key’s project.

```json
{
  "error": "not_found",
  "code": "resource_not_found",
  "message": "Resource not found",
  "correlationId": "req_example"
}
```

---

Source: https://connect.nxiom.com/docs/api/email-domains/delete
