# Delete domain

{% tabs %}
{% tab title="Shell" %}

```sh
 curl https://api.acymailer.com/api/deleteDomainIdentity \
 -X DELETE \
 -H 'Content-Type: application/json' \
 -H 'API-KEY: your-license-key' \
 -H 'Version: external' \
 -d '{"domain": "example.com","siteUrl": "https://example.com"}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
  
$acymailer = new AcyMailer\SendingService('your-license-key');

$domain = $acymailer->deleteDomain('example.com');
```

{% endtab %}

{% tab title="Node" %}

```javascript
import {AcyMailer} from '@acymailing/sending-service';

const mailer = new AcyMailer('your-license-key');

await mailer.deleteDomain({name: 'example.com'});
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">`POST`</mark> `/api/deleteDomainIdentity`

Delete a domain registered on our API

**Headers**

| Name         | Value                |
| ------------ | -------------------- |
| Content-Type | `application/json`   |
| API-KEY      | `<license-key>`      |
| Version      | `Must be "external"` |

**Body**

```json
{
    "domain": "example.com",
    "siteUrl": "https://example.com"
}
```

* **domain** must your domain that you've registered
* **siteUrl** must be the same value that you've added when you've registered the domain

**Response**

{% tabs %}
{% tab title="204" %}

```json
{
    "code": 17,
    "message": "Missing arguments"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}

{% tab title="403" %}

```json
{
    "code": 4,
    "message": "You are not allowed to delete this domain"
}
```

{% endtab %}

{% tab title="404" %}

```json
{
    "code": 5,
    "message": "This domain doesn't exist"
}

{
    "code": 3,
    "message": "This domain is not attached to this site"
}
```

{% endtab %}

{% tab title="422" %}

```json
{
    "code": 0,
    "message": "<details>"
}
```

{% endtab %}
{% endtabs %}
