# List domains

`GET https://api.mailmasker.org/api/v1/domains`

Every domain on the system, alphabetically, and whether it takes mail.

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

Mail to a domain is accepted only while both `mail_enabled` and `active` are on. `dns_managed` means its DNS zone is kept here.

## Good to know

- Yes-or-no fields come back as 1 or 0.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/domains' \
  -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',
    { 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 domains list
```

## Response

200 OK:

```json
[
  {
    "id": 1,
    "domain_name": "example.com",
    "mail_enabled": 1,
    "dns_managed": 1,
    "active": 1,
    "created_by": "you@example.com",
    "created_at": "2026-11-03 21:42:10.123456-06",
    "updated_at": "2026-11-03 21:42:10.123456-06"
  },
  {
    "id": 2,
    "domain_name": "example.org",
    "mail_enabled": 0,
    "dns_managed": 1,
    "active": 1,
    "created_by": "you@example.com",
    "created_at": "2026-11-03 21:42:10.123456-06",
    "updated_at": "2026-11-03 21:42:10.123456-06"
  }
]
```
