Check what a staging operation would do
/v1/sites/{siteId}/staging/preview Asks the server what an operation would do and need, before you start it (it takes a few seconds): the room it needs, what stands in the way (blockers), and for a push of the database what changed on the live site since the copy and which tables it would copy; for a push of the code, what's newer on the live site (downgrades, which the push needs in its allowDowngrade) and what it would remove.
Nothing is changed. Up to 10 previews a minute; not while a staging operation is running (409 staging_busy). When the server couldn't check, the answer is 503 try_again.
While staging is closed to the account (features.staging in GET /account), only an undo's preview works, so a push can always be checked and undone; the others answer 403 feature_unavailable.
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
sites:read - View sites. See sites and their domains, CDN, firewall, malware protection, backups, staging, resources, SMTP and Media Offload. SMTP includes who each site's recent emails went to, their subjects, and the team's sign-in addresses.
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The live site's id (never the staging copy's). |
Query parameters
| Field | Type and description |
|---|---|
operation Required | string The operation to check: One of: |
scope | string For a push: what it would copy, One of: |
parts | string For a refresh: what it would copy, One of: |
runId | string For an undo (and needed there): the restore point's |
tables | string For a push of the database: the only tables it would copy, separated by commas. |
Example request
curl "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/preview?operation=push&scope=everything" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/preview?operation=push&scope=everything", {
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.staging.preview({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
operation: "push",
scope: "everything",
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/preview?operation=push&scope=everything');
curl_setopt_array($ch, [
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.get(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/staging/preview",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
params={
"operation": "push",
"scope": "everything",
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the StagingPreview object in data.
The StagingPreview object's fields 38 fields
| Field | Type and description |
|---|---|
sizes | object What the operation would copy, and the room it needs. |
liveFilesBytes | integer The live site's files the operation copies, in bytes (0 when it copies none). |
liveDatabaseBytes | integer The live site's database, in bytes. |
stagingFilesBytes | integer The copy's code a push copies, in bytes (0 when it copies none). |
stagingDatabaseBytes | integer The copy's database, in bytes. |
freeBytes | integer Free room on the server's disk, in bytes. |
neededBytes | integer The room the operation needs on the server's disk while it runs, in bytes. |
blockers | array of strings Why the operation would be refused, or fail. Empty when nothing stands in the way. |
warnings | array of strings What's worth knowing before going ahead. |
changes | object or null For a push of the database or an undo: what changed on the live site since then, which the operation would replace. Null otherwise. |
since | string or null An ISO 8601 time, in UTC Since when: the copy's last database copy (for a push), or the push (for an undo). Null when not known. |
orders | integer New orders. |
users | integer New users. |
comments | integer New comments. |
formEntries | integer New form entries. |
posts | integer New posts and pages. |
editedPosts | integer Posts and pages edited. |
tables | array of objects For a push of the database: the copy's tables. Empty otherwise. |
name | string The table's name. |
rows | integer Its rows. |
sizeBytes | integer Its size, in bytes. |
onLive | boolean Whether the live site has a table of this name. |
keptOnLive | boolean Whether the push leaves the live site's own table in place (as it does for the tables that hold the site's own state, unless they're named in |
liveOnlyTables | array of strings For a push of the database: tables only the live site has, which the push leaves in place. |
downgrades | array of objects For a push of the code: what's newer on the live site than on the copy. The push puts these back to the copy's version only when they're named in its |
kind | string
Known values: |
name | string Its folder's name ( |
title | string Its name, as WordPress shows it. |
liveVersion | string or null Its version on the live site. Null when the live site doesn't have it. |
stagingVersion | string or null Its version on the copy. Null when the copy doesn't have it. |
removedFromLive | array of objects For a push of the code: plugins and themes on the live site that the copy doesn't have, which the push removes. |
kind | string
Known values: |
name | string Its folder's name ( |
title | string Its name, as WordPress shows it. |
liveVersion | string or null Its version on the live site. Null when the live site doesn't have it. |
stagingVersion | string or null Its version on the copy. Null when the copy doesn't have it. |
overdueTasks | integer For a push of the database: scheduled tasks on the copy that are already due (they'd run on the live site after the push, unless |
paymentsScheduled | boolean For a push of the database: whether the copy's store has subscription renewals or other payments scheduled, which need care before replacing the live site's database. |
Example response
{
"data": {
"sizes": {
"liveFilesBytes": 0,
"liveDatabaseBytes": 48211456,
"stagingFilesBytes": 0,
"stagingDatabaseBytes": 51380224,
"freeBytes": 41871163392,
"neededBytes": 113036492
},
"blockers": [],
"warnings": [
"The live site has new orders or users since the copy; pushing the database replaces them"
],
"changes": {
"since": "2026-11-18T10:05:47.000Z",
"orders": 3,
"users": 1,
"comments": 0,
"formEntries": 2,
"posts": 0,
"editedPosts": 1
},
"tables": [
{
"name": "wp_options",
"rows": 412,
"sizeBytes": 1212416,
"onLive": true,
"keptOnLive": false
},
{
"name": "wp_posts",
"rows": 1874,
"sizeBytes": 9453568,
"onLive": true,
"keptOnLive": false
},
{
"name": "wp_users",
"rows": 12,
"sizeBytes": 16384,
"onLive": true,
"keptOnLive": false
}
],
"liveOnlyTables": [
"wp_shop_audit_log"
],
"downgrades": [
{
"kind": "plugin",
"name": "woocommerce",
"title": "WooCommerce",
"liveVersion": "9.4.2",
"stagingVersion": "9.4.1"
}
],
"removedFromLive": [],
"overdueTasks": 0,
"paymentsScheduled": false
}
} 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 invalid_ | A query parameter is unknown or has a wrong value ( Correct or remove the parameter named in |
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 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 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 staging_ | The site's server found something that stops this staging operation. Deal with what |
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 |
429 rate_ | Too many requests. Wait for Retry-After seconds, then go on more slowly. |
502 server_ | The server didn't answer, or didn't finish the request. Check that the server is running, then try again in a minute. |
503 try_ | It couldn't be started just now; nothing was changed. Try again in a minute. |