# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acymailing.com/acymailer/domains/delete-domain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
