---
title: "Order domains and mailboxes for sending"
url: "https://coldagentai.com/docs/guides/order-domains-and-mailboxes.md"
canonical_url: "https://coldagentai.com/docs/guides/order-domains-and-mailboxes"
last_updated: "2026-10-18"
type: "how-to"
summary: "Read capabilities, search and order a domain, order mailboxes on it and follow each order until the mailboxes are connected."
related: ["https://coldagentai.com/docs/capabilities.md", "https://coldagentai.com/docs/api/capabilities.md", "https://coldagentai.com/docs/api/domains.md", "https://coldagentai.com/docs/api/mailboxes.md", "https://coldagentai.com/docs/webhooks.md", "https://coldagentai.com/docs/errors.md"]
install: "claude mcp add --transport http coldagentai-free https://coldagentai.com/api/mcp"
---

# Order domains and mailboxes for sending

> **For AI agents:** the complete index of ColdAgentAI pages is [llms.txt](https://coldagentai.com/llms.txt). Every page is also served as markdown at its URL plus .md.

Read capabilities, search and order a domain, order mailboxes on it and follow each order until the mailboxes are connected.

Search for a domain, order it, order mailboxes on it and follow the order until the mailboxes are connected.

## Read capabilities first

Whether these routes can run depends on the server. Domain ordering needs a domain registrar to be switched on for the server, and mailbox ordering needs a mailbox provisioner. `GET /v1/capabilities` shows the `registrars` and `provisioners` slots for the server you are calling. If customer billing for these orders is not set up, the order routes answer `503 provider_unavailable` and the message names the blocker; the capability list does not show it. Read the `registrars` and `provisioners` slots before you start.

cURL:

```
curl https://api.coldagentai.com/v1/capabilities \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"
```

Node:

```
const base = 'https://api.coldagentai.com';
const res = await fetch(base + '/v1/capabilities', {
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}` },
});
const { capabilities } = await res.json();
for (const slot of ['registrars', 'provisioners']) {
  const row = capabilities.find((c) => c.slot === slot);
  console.log(slot, row?.available, row?.blocked_by, row?.reason);
}
```

When a slot is not available, its `blocked_by` and `reason` say why. The routes that need it answer `503` with [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable) and `retryable` false: sending the same request again does not help until the capability is switched on for the server. Nothing blocked is simulated, and nothing is charged.

See [Capabilities](https://coldagentai.com/docs/capabilities.md) for the full list of slots.

## What you need

- A key with write scope for the order routes. Search and reading orders need only a read key. See [Authentication](https://coldagentai.com/docs/authentication.md).
- A name to try. Only `.com` and `.org` domains can be ordered. Search checks a name without a dot as both; ordering needs the full domain.
- For a domain order, a registrant contact if your registrar needs one. The `contact` object takes `first_name`, `last_name`, `email`, `phone` (E.164), `address1`, `city`, `region`, `postal_code` and a two-letter `country`.

> An order is final and spends money. Both order routes require `confirmed: true` and a `max_price_cents` ceiling. The order is refused, and nothing is charged, if the live price is above the ceiling.

## Search and order a domain

`GET /v1/domains/search?name=acme` checks availability and returns `domain`, `available`, `price_cents` (first year), `renewal_price_cents`, `currency` and `premium` for each candidate. It is free and reserves nothing.

`POST /v1/domains/orders` registers the domain for one year. The order is checked against the live price, charged to the account, then placed with the registrar. The response is the order, with status `connected` or `failed`. A domain you already ordered is refused with a pointer to the existing order.

cURL:

```
curl "https://api.coldagentai.com/v1/domains/search?name=acme" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"

# MAX_PRICE_CENTS is the most you accept, taken from price_cents in the search result
curl -X POST https://api.coldagentai.com/v1/domains/orders \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{ \"domain\": \"acme.com\", \"confirmed\": true, \"max_price_cents\": $MAX_PRICE_CENTS }"
```

Node:

```
const base = 'https://api.coldagentai.com';
const headers = { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' };

async function call(method, path, body) {
  const res = await fetch(base + path, { method, headers, body: body === undefined ? undefined : JSON.stringify(body) });
  const json = await res.json();
  if (!res.ok) throw new Error(`${json.error.code}: ${json.error.fix}`);
  return json;
}

const { results } = await call('GET', '/v1/domains/search?name=acme');
const pick = results.find((r) => r.available && r.price_cents !== null);
if (!pick) throw new Error('No available domain for that name.');

const order = await call('POST', '/v1/domains/orders', {
  domain: pick.domain,
  confirmed: true,
  max_price_cents: pick.price_cents,
});
console.log(order.id, order.status, order.failure_reason);
```

## Order mailboxes on the domain

`POST /v1/mailbox-orders` orders 1 to 10 mailboxes on a domain. Each mailbox is a `local_part` (the text before the @) with a `first_name` and `last_name`. The ceiling covers setup plus the first month.

There is no separate quote route. Send the ceiling you accept. If the live quote is higher, the order is refused with [`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), the message states the quote, and nothing is charged.

cURL:

```
curl -X POST https://api.coldagentai.com/v1/mailbox-orders \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"domain\": \"acme.com\",
    \"mailboxes\": [
      { \"local_part\": \"ada\", \"first_name\": \"Ada\", \"last_name\": \"Lovelace\" },
      { \"local_part\": \"grace\", \"first_name\": \"Grace\", \"last_name\": \"Hopper\" }
    ],
    \"confirmed\": true,
    \"max_price_cents\": $MAX_PRICE_CENTS
  }"
```

Node:

```
const base = 'https://api.coldagentai.com';
const headers = { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' };

async function call(method, path, body) {
  const res = await fetch(base + path, { method, headers, body: body === undefined ? undefined : JSON.stringify(body) });
  const json = await res.json();
  if (!res.ok) throw new Error(`${json.error.code}: ${json.error.fix}`);
  return json;
}

const mailboxOrder = await call('POST', '/v1/mailbox-orders', {
  domain: 'acme.com',
  mailboxes: [
    { local_part: 'ada', first_name: 'Ada', last_name: 'Lovelace' },
    { local_part: 'grace', first_name: 'Grace', last_name: 'Hopper' },
  ],
  confirmed: true,
  max_price_cents: Number(process.env.MAX_PRICE_CENTS),
});
console.log(mailboxOrder.id, mailboxOrder.status);
```

## Follow the order

An order moves through `requested`, `provisioning` and then ends as `connected` or `failed`. A domain order usually answers already finished. A mailbox order stays `provisioning` until the vendor hands over the mailboxes.

`GET /v1/orders/{id}` reads one order, and `GET /v1/orders` lists them oldest first, a page at a time. Reading a mailbox order that is still `provisioning` asks the vendor for its state first, and connects the mailboxes into your account when the vendor hands them over. Poll with these reads; there is no other call that advances an order. A `DfyOrderCompleted` [webhook](https://coldagentai.com/docs/webhooks.md) event is also sent when an order ends.

Node:

```
const base = 'https://api.coldagentai.com';
const headers = { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' };

async function call(method, path, body) {
  const res = await fetch(base + path, { method, headers, body: body === undefined ? undefined : JSON.stringify(body) });
  const json = await res.json();
  if (!res.ok) throw new Error(`${json.error.code}: ${json.error.fix}`);
  return json;
}

let order = await call('GET', `/v1/orders/${process.env.ORDER_ID}`);
while (order.status === 'requested' || order.status === 'provisioning') {
  await new Promise((r) => setTimeout(r, 30_000));
  order = await call('GET', `/v1/orders/${order.id}`);
}
console.log(order.status, order.failure_reason, order.detail);
```

| Order field | Meaning |
| --- | --- |
| `status` | `requested`, `provisioning`, `connected` or `failed`. |
| `quoted_cents` and `charged_cents` | The price quoted and the amount charged, in cents. |
| `failure_reason` | Why a `failed` order failed. It also says when the account had already been charged. |
| `detail` | Vendor information. For a mailbox order that is waiting on credentials it lists the addresses still waiting. |

## What can go wrong

| Code | Cause | Fix |
| --- | --- | --- |
| [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable) | No registrar or provisioner is switched on for the server, or billing for done-for-you orders is not set up. `retryable` is false. | Read `GET /v1/capabilities` and the error message. Do not retry until it changes. |
| [`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input) | The domain is not `.com` or `.org`, is not available, costs more than `max_price_cents`, or already has an open order. | Read `error.fix`. Search again, raise the ceiling to a price you accept, or read the existing order with `GET /v1/orders`. |
| [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden) | The key has read scope. | Use a write key for the order routes. |
| [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited) | Too many requests for this key. | Wait `Retry-After` seconds. |

## Next steps

- Run a health check on each new mailbox. See the guide on checking mailbox health.
- Add the mailboxes to a campaign with `mailbox_ids` on `POST /v1/campaigns` or `PATCH /v1/campaigns/{id}`. See [Campaigns](https://coldagentai.com/docs/api/campaigns.md).
- Read the full domain and order routes in [Domains and orders](https://coldagentai.com/docs/api/domains.md), and the mailbox routes in [Mailboxes](https://coldagentai.com/docs/api/mailboxes.md).

## Related

- [Capabilities](https://coldagentai.com/docs/capabilities.md)
- [Capabilities API reference](https://coldagentai.com/docs/api/capabilities.md)
- [Domains API reference](https://coldagentai.com/docs/api/domains.md)
- [Mailboxes API reference](https://coldagentai.com/docs/api/mailboxes.md)
- [Webhooks](https://coldagentai.com/docs/webhooks.md)
- [API errors](https://coldagentai.com/docs/errors.md)
