Push the staging copy to the live site
/v1/sites/{siteId}/staging/actions/push Copies the staging copy to the live site: its code (the default), its database with the media added on it, or everything (scope). What it replaces on the live site is kept as a restore point for 7 days, so the push can be undone with POST /sites/{siteId}/staging/actions/undo-push. A site keeps only its newest restore point: the next push or undo replaces it (and it's deleted by itself 7 days after it was made).
Idempotency-Key required. A push or an undo done twice would discard the first one's restore point, so each needs an Idempotency-Key (400 idempotency_key_required without one): the same request sent again with the same key gets the first answer, and nothing is done twice.
Pushing the database replaces the live site's orders, users and posts made since the copy: check with GET /sites/{siteId}/staging/preview?operation=push&scope=database first. Plugins, themes or WordPress itself that are newer on the live site are put back to the copy's version only when named in allowDowngrade; otherwise the push fails, changing nothing.
What happens next. The answer is 202 with the push operation in activeRun. It prepares everything first, while the live site keeps working (it can be cancelled then), and then switches the live site over in seconds. Poll GET /sites/{siteId}/staging every 10 seconds until activeRun is null; the operation is then first in recentRuns, completed, or failed with the reason in lastError. A push that fails leaves the live site as it was.
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 Required | 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 live site's id (never the staging copy's). |
Request body
JSON, with these fields. Fields that aren't listed are refused.
| Field | Type and description |
|---|---|
scope | string What to copy to the live site: One of: |
tables | array of strings 1 to 500 items Only with |
allowDowngrade | array of strings Up to 200 items What you agree to put back to the copy's older version, where the live site has a newer one: |
cancelOverdue | boolean For a push of tables that include the scheduled tasks: cancel the copy's tasks that are already due, so they don't run on the live site. Default true. |
Example request
# Keep this key when you send the same request again (after a timeout, say), so it's only done once.
KEY=$(uuidgen)
curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/actions/push" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $KEY" \
-d '{
"scope": "code"
}' import { randomUUID } from "node:crypto";
// Keep this key when you send the same request again (after a timeout, say), so it's only done once.
const idempotencyKey = randomUUID();
const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/actions/push", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
"Content-Type": "application/json",
"Idempotency-Key": idempotencyKey,
},
body: JSON.stringify({
"scope": "code"
}),
});
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 });
// The SDK sends an Idempotency-Key and keeps it when it sends the request again, so it's only done once.
const data = await rf.sites.staging.push({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
scope: "code",
});
console.log(data); <?php
// Keep this key when you send the same request again (after a timeout, say), so it's only done once.
$idempotencyKey = bin2hex(random_bytes(16));
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/actions/push');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
'Content-Type: application/json',
'Idempotency-Key: ' . $idempotencyKey,
],
CURLOPT_POSTFIELDS => json_encode([
'scope' => 'code',
]),
]);
$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 uuid
import requests
# Keep this key when you send the same request again (after a timeout, say), so it's only done once.
idempotency_key = str(uuid.uuid4())
response = requests.post(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/actions/push",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
"Idempotency-Key": idempotency_key,
},
json={
"scope": "code",
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
202 Accepted Returns the SiteStaging object in data.
The SiteStaging object's fields 70 fields
| Field | Type and description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
live | object The live site. | ||||||||||||||
id | string The live site's id. | ||||||||||||||
name | string The live site's name. | ||||||||||||||
url | string The live site's address. | ||||||||||||||
copy | object or null The site's staging copy. Null when it has none. | ||||||||||||||
id | string The copy's id. It's a site of its own ( | ||||||||||||||
name | string The copy's name: the live site's, with “(staging)”. | ||||||||||||||
status | string
Known values: | ||||||||||||||
url | string The copy's address. | ||||||||||||||
adminUrl | string The address of the copy's WordPress dashboard. Its users and passwords are the live site's, as of the last copy of the database. | ||||||||||||||
hostname | string The copy's own address: | ||||||||||||||
sslStatus | string The copy's SSL certificate: Known values: | ||||||||||||||
certificate | string Which certificate the copy is served with: Known values: | ||||||||||||||
certificateRetry | boolean Whether a trusted certificate can be asked for again (the last tries gave up): | ||||||||||||||
createdAt | string An ISO 8601 time, in UTC When the copy was created. | ||||||||||||||
databaseSyncedAt | string or null An ISO 8601 time, in UTC When the live site's database was last copied into it (when it was made or refreshed). Null until then. | ||||||||||||||
filesSyncedAt | string or null An ISO 8601 time, in UTC When the live site's files were last copied into it. Null until then. | ||||||||||||||
settings | object The staging copy's settings. Show its 6 fields
| ||||||||||||||
activeRun | object or null The staging operation in progress (or waiting for our team). Null when none is. Poll | ||||||||||||||
id | string The operation's id. | ||||||||||||||
operation | string
Known values: | ||||||||||||||
status | string
Known values: | ||||||||||||||
phase | string or null While it runs: Known values: | ||||||||||||||
stage | string or null What's happening now, in words. Null once it's finished. | ||||||||||||||
progress | integer or null How far it has got, 0 to 100. Null when that isn't known. | ||||||||||||||
cancellable | boolean Whether it can be cancelled now ( | ||||||||||||||
options | object What the operation was asked to do. Show its 4 fields
| ||||||||||||||
lastError | string or null Why it failed, or why it waits for our team. Null otherwise. | ||||||||||||||
notes | array of strings For a finished operation: facts worth knowing (files left out, places that still mention the other address…). | ||||||||||||||
createdAt | string An ISO 8601 time, in UTC When it was asked for. | ||||||||||||||
startedAt | string or null An ISO 8601 time, in UTC When it started on the server. Null until then. | ||||||||||||||
finishedAt | string or null An ISO 8601 time, in UTC When it finished. Null until then. | ||||||||||||||
restorePoints | array of objects The restore point of the last push or undo: what it replaced on the live site. Only the newest is kept: the next push or undo replaces it, and the one it replaces is listed | ||||||||||||||
runId | string The id of the push (or undo) that made it. Send it to | ||||||||||||||
operation | string What made it: a Known values: | ||||||||||||||
scope | string or null What it holds of the live site, as it was before: Known values: | ||||||||||||||
status | string
Known values: | ||||||||||||||
createdAt | string An ISO 8601 time, in UTC When it was made. | ||||||||||||||
expiresAt | string or null An ISO 8601 time, in UTC When it's deleted by itself (7 days after it was made), unless the next push or undo replaces it first. Null when it's kept for now. | ||||||||||||||
sizeBytes | integer or null The room it takes on the server's disk. Null when not known. | ||||||||||||||
recentRuns | array of objects The last 10 finished staging operations, newest first. | ||||||||||||||
id | string The operation's id. | ||||||||||||||
operation | string
Known values: | ||||||||||||||
status | string
Known values: | ||||||||||||||
phase | string or null While it runs: Known values: | ||||||||||||||
stage | string or null What's happening now, in words. Null once it's finished. | ||||||||||||||
progress | integer or null How far it has got, 0 to 100. Null when that isn't known. | ||||||||||||||
cancellable | boolean Whether it can be cancelled now ( | ||||||||||||||
options | object What the operation was asked to do. Show its 4 fields
| ||||||||||||||
lastError | string or null Why it failed, or why it waits for our team. Null otherwise. | ||||||||||||||
notes | array of strings For a finished operation: facts worth knowing (files left out, places that still mention the other address…). | ||||||||||||||
createdAt | string An ISO 8601 time, in UTC When it was asked for. | ||||||||||||||
startedAt | string or null An ISO 8601 time, in UTC When it started on the server. Null until then. | ||||||||||||||
finishedAt | string or null An ISO 8601 time, in UTC When it finished. Null until then. | ||||||||||||||
blockers | array of strings Why a staging copy can't be created right now: staging isn't open to the account, the site is still installing, its server is off, an operation is running, or the weekly limit is reached. Empty when one can be, or when the site has a copy. | ||||||||||||||
createsLeftThisWeek | integer How many more times a copy can be created for this site in the next 7 days (3 a week per site). |
Example response
{
"data": {
"live": {
"id": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"name": "Shop",
"url": "https://shop.example.com"
},
"copy": {
"id": "5c2e8f1a-7b3d-4e6f-9a0b-1c2d3e4f5a6b",
"name": "Shop (staging)",
"status": "active",
"url": "https://staging.shop-x7k2p.rabbitflare.link",
"adminUrl": "https://staging.shop-x7k2p.rabbitflare.link/wp-admin/",
"hostname": "staging.shop-x7k2p.rabbitflare.link",
"sslStatus": "active",
"certificate": "trusted",
"certificateRetry": false,
"createdAt": "2026-11-18T10:02:11.000Z",
"databaseSyncedAt": "2026-11-18T10:05:47.000Z",
"filesSyncedAt": "2026-11-18T10:05:47.000Z",
"settings": {
"protect": true,
"username": "staging",
"holdEmail": true,
"tasks": false,
"status": "applied",
"lastError": null
}
},
"activeRun": {
"id": "3e9a1f7c-2d4b-4c6e-8a1f-9b0c1d2e3f4a",
"operation": "push",
"status": "queued",
"phase": null,
"stage": "Waiting to start",
"progress": null,
"cancellable": true,
"options": {
"parts": null,
"scope": "code",
"tables": null,
"restoreRunId": null
},
"lastError": null,
"notes": [],
"createdAt": "2026-11-18T16:02:40.000Z",
"startedAt": null,
"finishedAt": null
},
"restorePoints": [
{
"runId": "7f1e2d3c-4b5a-4968-8776-655443322110",
"operation": "push",
"scope": "code",
"status": "available",
"createdAt": "2026-11-18T14:21:38.000Z",
"expiresAt": "2026-11-25T14:21:38.000Z",
"sizeBytes": 182403211
}
],
"recentRuns": [
{
"id": "7f1e2d3c-4b5a-4968-8776-655443322110",
"operation": "push",
"status": "completed",
"phase": null,
"stage": null,
"progress": 100,
"cancellable": false,
"options": {
"parts": null,
"scope": "code",
"tables": null,
"restoreRunId": null
},
"lastError": null,
"notes": [],
"createdAt": "2026-11-18T14:20:03.000Z",
"startedAt": "2026-11-18T14:20:05.000Z",
"finishedAt": "2026-11-18T14:21:38.000Z"
}
],
"blockers": [],
"createsLeftThisWeek": 2
}
} 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 |
|---|---|
400 bad_ | The request can't be carried out as sent. Change the request as |
400 idempotency_ | This operation needs an Idempotency-Key header: it spends money, or doing it twice isn't the same as doing it once. Send a unique Idempotency-Key (a UUID) with the request. |
403 feature_ | This product isn't open to the account. Contact support if you'd like it opened. |
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 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 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 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 staging_ | A staging operation is running on this site, or on a site of this server. Wait until it finishes ( |
409 no_ | The site has no staging copy. Create one first: POST /v1/sites/{siteId}/staging. |
409 staging_ | The staging copy can't be used for this now: it's still being created, or it's being removed. Check |
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 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 |
422 validation_ | One or more fields are missing or wrong. Correct the fields named in |