# 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 { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use sendping::SendPing;

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

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

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

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

**cURL**

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

**CLI**

```bash
sendping 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.sendping.co/docs/api/errors).
