# Delete a domain

> DELETE /domains/:id — remove a domain and its sending identity.

`DELETE /domains/:id`

Deletes a domain and removes its sending identity. Requires a key with full access.

> **Warning:** Deletion is blocked while a **scheduled** email still depends on this domain — the request returns a `validation_error` telling you to cancel that email first.

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.domains.remove('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e');
console.log({ data, error });
```

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

SendDart::Domains.delete("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

$senddart->domains->remove('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e');
```

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

senddart.Domains.remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e")
```

**Go**

```go
import "github.com/shekhu10/senddart-sdks/senddart-go"

client := senddart.NewClient("mb_xxxxxxxxx")

removed, err := client.Domains.Remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e")
```

**Rust**

```rust
use senddart::SendDart;

let mb = SendDart::new("mb_xxxxxxxxx");

let _removed = mb.domains.remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e").await?;
```

**Java**

```java
import com.senddart.SendDart;
import com.senddart.SendDartResponse;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

SendDartResponse response = senddart.domains().remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e");
```

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

var resp = await senddart.DomainDeleteAsync("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e");
```

**cURL**

```bash
curl -X DELETE 'https://www.senddart.com/api/domains/d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
senddart domains delete d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e
```

Response:

```json
{
  "object": "domain",
  "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e",
  "deleted": true
}
```

Errors: `not_found` if the domain does not exist or is not yours, `validation_error` if a scheduled email still uses it, `restricted_api_key` if the key lacks full access. See [Errors](https://www.senddart.com/docs/api/errors).
