# List a domain's DNS records

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

Every record in 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-records-list

One item per name and type, with all of its values in `content`. Names are full names ending in a dot, and TXT values keep their quotes.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `domain` | path | yes | The domain name. | `example.com` |

## Good to know

- A domain that isn't listed, or has no DNS zone here, answers 404.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/domains/example.com/dns/records' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

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

my $ua  = Mojo::UserAgent->new;
my $res = $ua->get('https://api.mailmasker.org/api/v1/domains/example.com/dns/records',
    { Authorization => "Bearer $ENV{TOKEN}" })->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 list example.com
```

## Response

200 OK:

```json
[
  { "name": "example.com.", "type": "MX", "ttl": 3600, "content": ["10 mail.example.com."] },
  { "name": "example.com.", "type": "TXT", "ttl": 3600, "content": ["\"v=spf1 mx ~all\""] },
  { "name": "www.example.com.", "type": "A", "ttl": 3600, "content": ["203.0.113.10"] }
]
```
