Make a domain the site's primary domain
/v1/sites/{siteId}/domains/{domainId}/actions/make-primary Serves the site on this domain; its other domains redirect to it. For a verified domain the change is put in place on the server at once (202; the site's pendingAction is domain for a moment). A domain still waiting for DNS becomes primary as soon as its DNS is verified (200, with primaryOnVerify: true). 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
| Field | Type and description |
|---|---|
Idempotency-Key | string 1 to 255 characters A key of your own for this request, like a UUID: letters, digits and |
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The site's id. |
domainId Required | string The domain's id, from the site's list of domains. |
Example request
curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/domains/c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f/actions/make-primary" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/domains/c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f/actions/make-primary", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
},
});
if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
const { data } = await res.json();
console.log(data); import { Rabbitflare } from "@rabbitflare/api";
const rf = new Rabbitflare({ token: process.env.RABBITFLARE_TOKEN });
const data = await rf.sites.domains.makePrimary({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
domainId: "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/domains/c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f/actions/make-primary');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($body === false || $status >= 400) {
throw new RuntimeException("Rabbitflare API error $status: $body");
}
print_r(json_decode($body, true)['data']); import os
import requests
response = requests.post(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/domains/c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f/actions/make-primary",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
202 Accepted Returns the SiteDomain object in data. It can also answer 200 OK.
The SiteDomain object's fields 13 fields
| Field | Type 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
Known values: |
sslStatus | string The domain's SSL certificate: Known values: |
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
{
"data": {
"id": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
"siteId": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"serverId": "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
"hostname": "shop.example.com",
"isPrimary": true,
"isBuiltIn": false,
"primaryOnVerify": false,
"status": "active",
"sslStatus": "active",
"dnsTarget": "203.0.113.10",
"lastError": null,
"verifiedAt": "2026-11-18T09:20:44.000Z",
"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 code | When, and what to do |
|---|---|
404 not_ | The resource doesn't exist, or isn't this account's. Check the id. Ids of other accounts' resources answer the same way. |
409 busy | Another change is still in progress on this server or site, or something else under way stops this one for now (a site backup running on the server, the server's backups being moved): Wait until it finishes, then try again. A change to the server or site itself is done when its |
409 invalid_ | The resource's status doesn't allow this now (for example, powering on a server that is running). Check the resource's |
409 server_ | 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_ | A staging operation is running on this site, or on a site of this server. Wait until it finishes ( |
409 clone_ | 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 not_ | The domain's DNS isn't verified yet. Verify the domain first. A domain waiting for DNS can be made primary once it's verified instead. |
409 staging_ | 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 server_ | 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 |