---
title: "Custom domains"
description: "Receive and send on a domain of your own — a root or a subdomain, its DNS records, verification and sending."
url: "https://docs.yoagent.dev/email/custom-domains"
---

# Custom domains

Every project receives on its own subdomain of `yoagent.email` from the start. Add a domain of yours, and its addresses — `support@yourcompany.com` — become inboxes of that project, with the same API, tools and webhooks. Custom domains an organization may have: 1 on Free, 10 on Pro.

## A root or a subdomain

YoAgent receives all the mail of the domain you add: its MX record points to us, and to us alone.

- **A domain with no mail yet** — add it as it is: `yourcompany.com`.
- **A domain that already gets mail** at Google Workspace, Microsoft 365 or another provider — add a subdomain, such as `mail.yourcompany.com` or `test.yourcompany.com`. Your existing mail stays where it is. A domain whose MX records also point elsewhere is never verified: the dashboard says another MX record is there beside ours (`mx_foreign`).

## Add a domain

1. **Add it** in the dashboard (**Domains → Add domain**), with `POST /v0/domains` or with the MCP tool `create_domain`:

   ```bash
   curl -s https://api.yoagent.dev/v0/domains \
     -H "Authorization: Bearer $YOAGENT_KEY" \
     -H "Content-Type: application/json" \
     -d '{"name": "mail.yourcompany.com", "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq"}'
   ```

   The domain belongs to that project for good (without `project_id`, the first project the key may add domains to).

2. **Add its DNS records** at your DNS provider. The answer’s `records` and the domain’s page in the dashboard list them; **Download zone file** gives them all as a BIND zone file to import.

   | Record       | Type | Name                | Value                                    |
   | ------------ | ---- | ------------------- | ---------------------------------------- |
   | Verification | TXT  | `_yoagent.<domain>` | `yoagent-verification=…`                 |
   | Mail         | MX   | `<domain>`          | YoAgent’s mail server, with its priority |

3. **Wait for the check.** YoAgent reads the records at once, then after 1 minute, 5 minutes and 15 minutes, then checks every hour for 3 days. **Verify now** (`POST /v0/domains/{domain_id}/verify`, `verify_domain`) reads them right away, at most once every 30 seconds. Once both records are found, the domain is `verified` and its mail arrives.

![A custom domain’s page in the dashboard: its status and the DNS records to add, each found or not](https://docs.yoagent.dev/_astro/domain.jrut9KkD_Z1oS5QX.webp)

The domain’s `status` is `pending` while YoAgent waits for its records, `verified` once mail is accepted, and `failed` when the records were not found in 3 days (or another organization verified the domain first). A failed claim is deleted a while later; add the domain again to start over. A verified domain is read again every day: records missing for 3 days fail it — mail to it is refused and sending stops, but its inboxes and mail are kept, and it is verified again when the records come back. Sending stays off then: turn it on again, with new DKIM records. A `domain.verified` webhook event tells your code when a domain is ready, and again when its sending is verified.

When a domain is verified, it gets a catch-all inbox `*@<domain>`, and you create its inboxes like any other, with `"domain": "mail.yourcompany.com"` ([Inboxes and addresses](https://docs.yoagent.dev/email/inboxes-and-addresses)).

## Send from your domain

Sending is a separate switch, so a domain that only receives needs no more records:

1. **Turn sending on** — **Turn on sending** on the domain’s page, `PATCH /v0/domains/{domain_id}` with `{"sending": true}`, or `update_domain(domain_id=…, sending=true)`. The domain must be verified first.

2. **Add the new records** the domain then lists:

   | Record                | Type  | Name                          | Value                                  |
   | --------------------- | ----- | ----------------------------- | -------------------------------------- |
   | DKIM (three records)  | CNAME | `<token>._domainkey.<domain>` | `<token>.dkim.amazonses.com`           |
   | Bounces (recommended) | MX    | `bounce.<domain>`             | `feedback-smtp.<region>.amazonses.com` |
   | SPF (recommended)     | TXT   | `bounce.<domain>`             | `v=spf1 include:amazonses.com ~all`    |
   | DMARC (recommended)   | TXT   | `_dmarc.<domain>`             | `v=DMARC1; p=none`                     |

3. **Wait for the DKIM records** to be found: the domain’s sending status goes from `pending` to `verified`, and its inboxes send. The DKIM records are required; the recommended ones make your mail more likely to reach the inbox rather than spam.

Until then a send from the domain’s inboxes is `400 invalid`, naming what is missing. Turning sending off and on again gives new DKIM records.

## Good to know

- An address on a domain whose mail YoAgent receives — `yoagent.email` or any verified domain of yours — cannot sign in to YoAgent or be invited: people use their own email for their account.
- Mail to a domain that is not verified is refused (`550 5.1.1 No such user here`).
- Deleting a domain (`DELETE /v0/domains/{domain_id}`, `delete_domain`) deletes all its inboxes and their mail. A project’s own `yoagent.email` subdomain goes only with the project.
