See what turning on Media Offload would move
/v1/sites/{siteId}/media-offload/actions/inspect Reads the site's media library on its server and says what turning Media Offload on (with the settings given) would move to storage, by kind of file; what would stay on the server, by reason, with the largest folders kept; the server's disk; and anything that stands in the way (problems, and other media offload plugins in conflictingPlugins). It changes nothing. A large library takes a while (up to a few minutes); an inspection with the same settings is kept 5 minutes (fresh: true reads it again). Up to 10 a minute.
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. |
Request body
JSON, with these fields. Fields that aren't listed are refused.
| Field | Type and description |
|---|---|
settings | object The settings to inspect with. Left out: |
mode | string
One of: |
freeAfterDays | number In free up disk mode, how many days new files stay on the server before their copy there is removed: 1, 3, 7, 14, 30, 90. Left out: 7. One of: |
kinds | array of strings 1 to 7 items The kinds of files to keep in storage: One of: |
keep | array of strings Up to 50 items Folders of the uploads folder to keep on the server, besides the ones always kept there (private downloads and form uploads, backups and logs, files plugins rebuild, code). Left out: none. |
fresh | boolean Read the media library again, even if it was inspected with the same settings in the last 5 minutes. Left out: |
Example request
curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/media-offload/actions/inspect" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}' const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/media-offload/actions/inspect", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
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.mediaOffload.inspect({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/media-offload/actions/inspect');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(new stdClass()),
]);
$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/media-offload/actions/inspect",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
json={},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the MediaOffloadInspection object in data.
The MediaOffloadInspection object's fields 21 fields
| Field | Type and description |
|---|---|
ready | boolean Nothing in the site's setup stands in the way of turning it on ( |
problems | array of strings What stands in the way, one sentence each. |
conflictingPlugins | array of strings Other media offload plugins active on the site: deactivate them in WordPress first. |
files | integer Files in the uploads folder. |
bytes | integer Their size, in bytes. |
kinds | array of objects What would move to storage, by kind of file. |
kind | string A kind of file: Known values: |
files | integer Files of this kind that would move to storage. |
bytes | integer Their size, in bytes. |
keptOnServer | array of objects Files of the uploads folder that stay on the server, by reason. |
reason | string Why they stay: Known values: |
files | integer Files. |
bytes | integer Their size, in bytes. |
keptFolders | array of objects Up to 10 folders kept on the server, largest first. |
folder | string A folder of the uploads folder. |
bytes | integer What stays there, in bytes. |
disk | object or null The site's server's disk. Null when it couldn't be read. |
freeBytes | integer Free space, in bytes. |
totalBytes | integer The disk's size, in bytes. |
multisite | boolean Whether the site is a WordPress multisite network. |
checkedAt | string An ISO 8601 time, in UTC When the media library was inspected (an inspection is kept 5 minutes). |
Example response
{
"data": {
"ready": true,
"problems": [],
"conflictingPlugins": [],
"files": 18726,
"bytes": 12521012000,
"kinds": [
{
"kind": "image",
"files": 18120,
"bytes": 9870000000
},
{
"kind": "video",
"files": 12,
"bytes": 2410000000
},
{
"kind": "audio",
"files": 0,
"bytes": 0
},
{
"kind": "document",
"files": 280,
"bytes": 200000000
},
{
"kind": "archive",
"files": 0,
"bytes": 0
},
{
"kind": "font",
"files": 0,
"bytes": 0
},
{
"kind": "other",
"files": 0,
"bytes": 0
}
],
"keptOnServer": [
{
"reason": "folder",
"files": 310,
"bytes": 41000000
},
{
"reason": "code",
"files": 4,
"bytes": 12000
}
],
"keptFolders": [
{
"folder": "woocommerce_uploads",
"bytes": 41000000
}
],
"disk": {
"freeBytes": 52300000000,
"totalBytes": 80000000000
},
"multisite": false,
"checkedAt": "2026-11-19T10:05:12.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 |
|---|---|
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 site_ | The site isn't in a state that allows this (for example, it's still installing). Wait until the site is active, 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 |
429 rate_ | Too many requests. Wait for Retry-After seconds, then go on more slowly. |