Skip to content

Connect a domain to a site

POST /v1/sites/{siteId}/domains

Connects a domain you own to the site. First point the domain's A record at the site's server: dnsTarget in the answer is its address.

What happens next. Its DNS is checked at once. If it already points at the server, the answer has status: "provisioning": the domain is set up on the server and its SSL certificate issued, usually within a few minutes. If not, it's pending_dns with the reason in lastError: point the DNS, then check again with POST /sites/{siteId}/domains/{domainId}/actions/verify.

With makePrimary: true the site moves to the domain as soon as its DNS is verified.

Limits. Up to 10 domains per site, and a domain can be connected to one site only. A staging copy keeps its own address.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

sites:write
Manage sites. Domains, SSL, CDN, cache, firewall, malware protection, resources, backups, staging, Media Offload, SMTP and RabbitPress Cache. Choosing Rabbitflare Backup for a site's backups, and turning on Media Offload or a site's malware protection, also need Turn on paid features: they start monthly charges.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Path parameters

FieldType and description
siteId Required

string

The site's id.

Request body

JSON, with these fields. Fields that aren't listed are refused.

FieldType and description
hostname Required

string Up to 253 characters

The domain to connect, like shop.example.com or www.example.com (no https:// or path).

makePrimary

boolean

Make it the site's primary domain: at once if its DNS already points at the server, otherwise as soon as its DNS is verified. Default false.

Example request

curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/domains" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "hostname": "shop.example.com"
}'

Response

201 Created Returns the SiteDomain object in data.

The SiteDomain object's fields 13 fields
FieldType and description
id

string

The domain's id.

siteId

string

The site it's connected to.

serverId

string

The site's server.

hostname

string

The domain, like shop.example.com.

isPrimary

boolean

Whether the site is served on this domain (the others redirect to it).

isBuiltIn

boolean

The address every site gets. It can't be removed.

primaryOnVerify

boolean

Still waiting for DNS, and becomes the primary domain once its DNS is verified.

status

string

pending_dns: waiting for its DNS to point at the server. provisioning: DNS is verified and the domain is being set up with its certificate. active: in use. failed: see lastError.

Known values: pending_dnsprovisioningactivefailed More can appear.

sslStatus

string

The domain's SSL certificate: none, pending, active or failed.

Known values: nonependingactivefailed More can appear.

dnsTarget

string or null

Point the domain's A record at this address (the server's IPv4). Null until the server has one.

lastError

string or null

Why the last DNS check or setup failed. Null otherwise.

verifiedAt

string or null An ISO 8601 time, in UTC

When its DNS was verified. Null until then.

createdAt

string An ISO 8601 time, in UTC

When the domain was added.

Example response

201 Created
{
  "data": {
    "id": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
    "siteId": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
    "serverId": "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
    "hostname": "shop.example.com",
    "isPrimary": false,
    "isBuiltIn": false,
    "primaryOnVerify": false,
    "status": "pending_dns",
    "sslStatus": "none",
    "dnsTarget": "203.0.113.10",
    "lastError": "DNS check failed: no A record was found",
    "verifiedAt": null,
    "createdAt": "2026-11-18T09:18:03.000Z"
  }
}

Errors

The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).

Status and codeWhen, and what to do
400 bad_request

The request can't be carried out as sent. message says why (for example, a site's built-in domain can't be removed).

Change the request as message says.

403 · 409 limit_reached

A limit is reached: message says which (servers per account, snapshots per server, domains per site, …).

Delete something first, or contact support to raise the limit.

404 not_found

The resource doesn't exist, or isn't this account's.

Check the id. Ids of other accounts' resources answer the same way.

409 conflict

This clashes with something that exists, or is already done (for example, a domain already connected to a site).

Read message; there may be nothing left to do.

409 invalid_state

The resource's status doesn't allow this now (for example, powering on a server that is running). message says why.

Check the resource's status, then do what message says.

409 server_unavailable

The server isn't in a state that allows this (for example, it's off or still being set up).

Start the server, or wait until it's active, then try again.

409 staging_copy

This site is a staging copy, which can't do this.

Do it on the live site. A staging copy is managed through its live site's staging operations.

409 staging_busy

A staging operation is running on this site, or on a site of this server.

Wait until it finishes (activeRun in GET /sites/{siteId}/staging is null again), or cancel it, then try again.

409 clone_busy

A clone of this site, or of a site on this server, is being made.

Wait until the clone finishes (or cancel it), then try again.

409 server_restoring

The server is being restored, and nothing else can change it or its sites until that's done.

Wait until the restore finishes (the server's pendingAction is null again), then try again. A restore that stopped partway keeps pendingAction: "restore", with the server's lastError set, until our team has checked the server.

422 validation_failed

One or more fields are missing or wrong. fields names each one with what's wrong.

Correct the fields named in fields. Unknown fields are refused too.

Rate limit

Write requests: 30 a minute per token, 60 per account. More in Rate limits.

Added on .

Popular

API docs