# Delete a DNS record

`DELETE https://api.mailmasker.org/api/v1/domains/:domain/dns/records`

Remove every value of one name and type from a domain's DNS zone.

- Who can use it: Site admins
- Area: Domains and DNS
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/dns-record-delete

Deletes the whole record set for that name and type. They go in the body, as when creating a record.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `domain` | path | yes | The domain whose zone it is in. | `example.com` |
| `name` | body | yes | The record's full name. A final dot is optional. | `www.example.com` |
| `type` | body | yes | The record type in capitals. | `A` |

## Good to know

- A domain that isn't listed answers 404.

## Examples

cURL:

```bash
curl -s -X DELETE 'https://api.mailmasker.org/api/v1/domains/example.com/dns/records' \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"name":"www.example.com","type":"A"}'
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->delete('https://api.mailmasker.org/api/v1/domains/example.com/dns/records',
    { Authorization => "Bearer $ENV{TOKEN}" },
    json => { name => 'www.example.com', type => 'A' })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli dns records delete example.com --name www.example.com --type A
```

## Response

200 OK:

```json
{ "ok": true, "restart_pending": true }
```
