POST/sites/:siteSlug/domains

Add a custom domain to a site. Creates a Cloudflare Custom Hostname for TLS provisioning. Requires the domains:write scope.

Request body

domain (required, string): The fully-qualified domain name to attach (e.g. www.myapp.com). The domain must be one you own and can configure DNS for.

DNS configuration

After adding the domain, point a CNAME record at cname.zxapi.net. The response includes DNS instructions and TLS verification details. SSL is provisioned automatically once the CNAME propagates.

Response

Returns 201 Created with data.domain and data.dnsInstructions.

Code examples

cURL
curl "https://www.zyberspace.com/api/v1/{teamSlug}/sites/my-site/domains" \
  -H "Authorization: Bearer zxk_live_YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"domain":"www.myapp.com"}'
JavaScript
const res = await fetch(`https://www.zyberspace.com/api/v1/{teamSlug}/sites/my-site/domains`, {
  method: "POST",
  headers: {
    Authorization: "Bearer zxk_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ domain: "www.myapp.com" }),
});
const { data } = await res.json(); // 201
// data.domain.status === "pending" until DNS propagates

Base URL: https://www.zyberspace.com

Get your API key →