# List domains

> Find sending domains in your project, with search and pagination.

`GET https://api-connect.nxiom.com/api/v1/emails/domains`

## Authorization

Requires `email.full_access`.

## Query parameters

| Field | Type | Description |
| --- | --- | --- |
| `page` | number · optional | Default `1`. |
| `limit` | number · optional | Default `50`, maximum `100`. |
| `status` | string · optional | `pending`, `verified`, or `failed`. |
| `search` | string · optional | Filter by domain name. |

## Request

### cURL

```shell
curl "https://api-connect.nxiom.com/api/v1/emails/domains?page=1&limit=50" \
  -H "Authorization: Bearer $NEXIOM_API_KEY"
```

### Node.js

```typescript
import { NexiomConnect } from '@nexiom/connect';

const apiKey = process.env.NEXIOM_API_KEY;
if (!apiKey) throw new Error('Set NEXIOM_API_KEY');

const nexiom = new NexiomConnect({ apiKey });

const { data, error } = await nexiom.domains.list({ page: 1, limit: 50 });

if (error) throw new Error(`${error.code}: ${error.message}`);
for (const domain of data.items) {
  console.log(domain.domain, domain.status);
}
```

### PHP

```php
<?php

use Nexiom\Connect\NexiomConnect;

$apiKey = getenv('NEXIOM_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set NEXIOM_API_KEY');
}

$nexiom = new NexiomConnect($apiKey);

$page = $nexiom->domains->list(['page' => 1, 'limit' => 50]);

foreach ($page['items'] as $domain) {
    echo $domain['domain'], ' ', $domain['status'], PHP_EOL;
}
```

## Response

HTTP `200`. `data` contains `items`, `total`, `page`, and `limit`. Each item is a domain.

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Domain identifier. |
| `domain` | string | Sending subdomain. |
| `status` | string | `pending`, `verified`, or `failed`. |
| `region` | string | Sending region. |
| `open_tracking` | boolean | Whether open tracking is enabled. |
| `verification_error` | string or null | What still needs attention when the domain is not verified. |
| `verification_attempts` | number | How many verification checks ran. |
| `verification_attempted_at` | string or null | When the last verification check ran. |
| `dns_records` | array | DNS records to publish, each with `id`, `purpose`, `record_type`, `name`, `value`, `priority`, `status`, `required_for_sending`, `last_checked_at`, `error_code`, and `error_message`. |
| `last_verified_at` | string or null | Last successful verification timestamp. |
| `created_at` | string | Creation timestamp. |
| `updated_at` | string | Last change timestamp. |

See [Pagination](/docs/api/pagination) for the next page.

### 200 OK

Example response. Domain and DNS fields shown are illustrative; use the records returned for your own domain.

```json
{
  "message": "Email domains fetched",
  "data": {
    "items": [
      {
        "id": "domain_example",
        "domain": "mail.example.com",
        "status": "pending",
        "region": "global",
        "open_tracking": true,
        "last_verified_at": null
      }
    ],
    "total": 1,
    "page": 1,
    "limit": 50
  }
}
```

### 400 Bad Request

The request is invalid. Correct it before retrying; `details` lists the failing fields.

```json
{
  "error": "invalid_argument",
  "message": "Request doesn't match the schema",
  "correlationId": "req_example",
  "details": {
    "context": "body",
    "issues": []
  }
}
```

### 401 Unauthorized

The API key is missing, malformed, revoked, or expired.

```json
{
  "error": "unauthorized",
  "message": "Invalid API key",
  "correlationId": "req_example"
}
```

### 403 Forbidden

The API key lacks a required permission, or its domain restriction does not allow this sender.

```json
{
  "error": "not_allowed",
  "message": "Missing required API key permissions: email.full_access",
  "correlationId": "req_example"
}
```

---

Source: https://connect.nxiom.com/docs/api/email-domains/list
