# Delete a domain

Delete a domain that no endpoint uses, with its certificate.

**Important:**
The certificate is deleted with the domain. To use the domain again, add it and prove it again.

## Prerequisites

- Permission for `domains:DeleteDomain` on the domain. In the console, also
  `domains:ListDomains` to open **Domains** and `domains:GetDomain` to open the domain.
- No endpoint serves a name of the domain any more (see
  [Use a domain on an endpoint](use-a-domain-on-an-endpoint.md)). Otherwise the delete is refused
  with `409` "… is in use (…); remove it there first", naming up to five of the names.

## Delete it

**Console**
1. Open **Domains** and choose the domain.
2. Choose the **⋯** menu, then **Delete domain**.
3. Enter the domain's name and choose **Delete**.

**CLI**
```sh
dcloud domains domains delete apps.example.com
```

**API**
```http
DELETE /domains/api/domains/apps.example.com
```

**Terraform**
Remove the `dcloud_domain` resource from the configuration and apply.

## Result

The domain is gone from **Domains**. Remove the `_acme-challenge` `CNAME` record at your DNS
provider: it proves nothing for anyone else, since every domain gets its own target.

## Related

- [Add and verify a domain](add-and-verify-a-domain.md)
