The custom domains API
One REST API for domain connections, DNS records, record checks, certificates, drift checks and webhooks.
Add a custom domain to your platform with one API call. The request below creates a domain connection. From there, CustomDomain™ finds the DNS provider, writes the records or returns the exact ones, and checks each one until the domain is live. The full reference, with every endpoint, parameter and error code, is at docs.customdomain.ai/docs.
Test mode request and response, from the CustomDomain™ docs quickstart (docs.customdomain.ai/docs/getting-started/quickstart, read October 30, 2026). The docs trim the response to the fields used. Field names are exact.
curl -X POST https://api.customdomain.ai/v1/connections \
-H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"www.acme.test","application_id":"app_..."}'Response, 201
{
"id": "con_…",
"application_id": "app_…",
"domain": "www.acme.test",
"setup_type": "manual",
"status": "pending",
"sandbox": true,
"created_via": "api",
"routing": { "mode": "edge", "set_at": "2026-10-20T12:00:05Z" },
"created_at": "2026-10-20T12:00:05Z",
"records": [
{ "type": "CNAME", "host": "www.acme.test", "value": "edge.customdomain.ai", "ttl": 3600, "applied": false }
]
}A connection moves from pending to propagating to live, or to failed with a reason, and every move fires a webhook. Where the provider allows it, the records are written for your customer. Where it does not, the API returns the exact records, and each one is checked until it resolves.
One API for programmatic custom domains
CustomDomain™ runs as a control plane plus an edge that terminates TLS for connected domains on Growth and up. The REST API is the front door to that control plane, and it covers seven surfaces:
- Connections: create, inspect, and remove customer domains.
- DNS records: read the records behind each connection and what still needs to change.
- Verification: check each record until the domain is
live. - TLS: track issuance and renewal for every certificate.
- Monitoring: drift checks on live domains, once an hour.
- Webhooks: push every state change into your systems.
- Registrar: search for available domain names.
If you would rather not write integration code at all, the embeddable widget and SDK wrap this same API. See features and how it works for the full picture, or follow the walkthrough in add custom domains to your SaaS.
The domain connection API
Connections are the core resource. A connection maps a domain your customer owns, say shop.acme.com, to an application on your platform. You create one with POST /v1/connections, list them with GET /v1/connections, fetch one with GET /v1/connections/:id, and remove one with DELETE. Each connection carries its complete state, covering DNS records, record checks and certificates, so a single GET tells you exactly where a customer's domain stands and what, if anything, is blocking it.
Connections are scoped per tenant. A domain another account serves is never connected to yours, and cross-tenant reads return 404. If you are still weighing build versus buy, custom domains for SaaS lays out what a production integration actually involves.
Endpoints on this page
- POST/v1/connectionsCreate a connection for a customer's domain.
- GET/v1/connectionsList connections.
- GET/v1/connections/:idOne connection with its records, checks and certificate.
- DELETE/v1/connections/:idRemove a connection.
- GET/v1/connections/:id/recordsThe record set the connection needs.
- GET/v1/connections/:id/certificateThe certificate, its renewal and history.
- GET/v1/connections/:id/monitorWhat the last drift check found.
- POST/v1/webhooksRegister a webhook endpoint.
- GET/v1/registrar/searchSearch available names and pricing.
Every endpoint, parameter and error code is in the API reference.
DNS records without support tickets
Most platforms lose customers at the DNS step, so the records API is designed to remove it. The CustomDomain™ census lists 217 DNS providers as of October 31, 2026. 73 have an automatic path (66 with a scoped API key, 6 by signing in with the provider, 1 by one-click setup), and the other 144 get the exact records with that provider's own steps. The API keeps checking each record until it resolves. The DNS provider directory lists each provider and how it connects.
GET /v1/connections/:id/records returns the record set the connection needs, so you can render precise, provider-aware instructions in your own UI instead of pointing customers at a generic help article. Whether a customer should connect an apex domain or a subdomain is its own question. Apex domain vs CNAME covers the tradeoffs.
The domain verification API
A domain goes live when every record resolves to its expected value. There is no extra TXT record to add. Control is proven by the way the records were written: a provider sign-in, a one-click approval in the customer's own provider session, a key only the zone owner can create, or the records appearing in the domain's own DNS. Your customer never hands over nameservers.
Status is queryable at any time with GET /v1/connections/:id, and every transition is pushed to your webhook endpoint, so your dashboard can show propagating and live without polling. For background on the ownership model, see bring your own domain.
TLS lifecycle, from issuance to renewal
On the edge (Growth and up), the certificate is issued on the first HTTPS request and renewed about 30 days before expiry. Certificates terminate at the edge, so you do not generate a CSR or hold a private key for a customer's domain. On Starter and Startup, domains point at your own servers and you serve TLS.
GET /v1/connections/:id/certificate reports the certificate, its renewal and its history, which is useful for compliance reviews and customer support. If you want to understand the machinery, automatic certificates for customer domains covers issuance and renewal, multi-tenant TLS explains how certificates for thousands of unrelated domains coexist safely, and on-demand TLS covers issuing certificates the first time a domain is seen.
Monitoring and webhooks
Live domains drift. Customers migrate providers, delete records they do not recognize, or let registrations lapse. Every live domain is checked once an hour. GET /v1/connections/:id/monitor reports what the drift check last found, and the console shows each domain's drift state.
Register an endpoint with POST /v1/webhooks and subscribe to the events you care about, such as connection.created, connection.live, connection.failed, certificate.issued and certificate.renewed. The full catalog is in the docs.
Registrar search
Some customers arrive without a domain at all. The registrar endpoints let you search availability and pricing from your own flow. Buying a new domain is live in the console, and it arrives connected.
curl "https://api.customdomain.ai/v1/registrar/search?q=acme+coffee" \ -H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY"
It fits site builders and ecommerce platforms, where a domain is part of the product's first-run experience.
The MCP server for AI agents
The same platform is exposed through a hosted MCP server at https://mcp.customdomain.ai/mcp. The hosted MCP server has 23 tools. Agents can find a domain's provider, connect it, check it and fix it over MCP. Buying a domain through MCP is off on the hosted service. No MCP tool accepts DNS records. The server computes them from vetted templates.
If your product is an agent, or your customers work through one, see CustomDomain™ for AI agents and the guide to connecting domains with AI agents.
Start with a free trial
The custom domains API, the widget, the webhooks and the MCP server are all available on Starter. Plans start at $10 a month after a 14 day free trial. HTTPS on our edge starts at $649 a month on Growth. Create an API key at app.customdomain.ai/signup, then create a test mode application, connect a .test name and watch it reach live (quickstart). To talk through your architecture first, book a call.
Frequently asked questions
How do I add a custom domain via the API?
Send a POST request to the connections endpoint with your customer's domain and your application id. Where the provider allows it, CustomDomain™ writes the records for your customer. Where it does not, the API returns the exact records. Each record is checked until the domain is live. The full reference is at docs.customdomain.ai/docs.
How long does it take for a domain to go live?
Records written for the customer usually check out within seconds. Where your customer adds records by hand, timing depends on how quickly they create them. Each record is checked every 5 seconds for the first 5 minutes, then less often, with no deadline on pending.
Do customers need to change nameservers?
No. A domain goes live when every record resolves to its expected value. There is no extra TXT record to add, and the nameservers stay where they are.
Is there a free trial for the custom domains API?
Yes. Every new workspace starts with a 14 day free trial, then Starter is $10 a month and includes the REST API, the embeddable widget, webhooks and the MCP server. Your first ten domains connect free. No card needed to sign up.