Skip to content

See what turning on Media Offload would move

POST /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

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
settings

object

The settings to inspect with. Left out: copy, 7 days, the kinds image, video, audio, document, archive, font, and no extra folders. The whole object left out: the defaults.

mode

string

copy: files stay on the server and are copied to storage. free (free up disk): once storage holds them, files older than freeAfterDays are removed from the server and served from storage. Left out: copy.

One of: copyfree

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: 137143090

kinds

array of strings 1 to 7 items

The kinds of files to keep in storage: image (Images: JPEG, PNG, WebP, AVIF, GIF, SVG), video (Video: MP4, MOV, WebM), audio (Audio: MP3, M4A, WAV, OGG), document (Documents: PDF, Word, Excel, PowerPoint, text), archive (Archives: ZIP, RAR, 7z, tar), font (Fonts: WOFF2, WOFF, TTF, OTF), other (Everything else: Any other file plugins keep there (CSS, JSON, logs…)). Left out: image, video, audio, document, archive, font.

One of: imagevideoaudiodocumentarchivefontother

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: false.

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 '{}'

Response

200 OK Returns the MediaOffloadInspection object in data.

The MediaOffloadInspection object's fields 21 fields
FieldType and description
ready

boolean

Nothing in the site's setup stands in the way of turning it on (problems is empty). Another media offload plugin must be deactivated too.

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: image (Images: JPEG, PNG, WebP, AVIF, GIF, SVG), video (Video: MP4, MOV, WebM), audio (Audio: MP3, M4A, WAV, OGG), document (Documents: PDF, Word, Excel, PowerPoint, text), archive (Archives: ZIP, RAR, 7z, tar), font (Fonts: WOFF2, WOFF, TTF, OTF), other (Everything else: Any other file plugins keep there (CSS, JSON, logs…)).

Known values: imagevideoaudiodocumentarchivefontother More can appear.

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: folder (a folder always kept, or one in keep), kind (a kind of file not chosen), code (code files), hidden (hidden files), name (a path too long for storage), owner (files that don't belong to the site's own user).

Known values: folderkindcodehiddennameowner More can appear.

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

200 OK
{
  "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 codeWhen, and what to do
403 feature_unavailable

This product isn't open to the account.

Contact support if you'd like it opened.

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 site_unavailable

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_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.

429 rate_limited

Too many requests. scope says which limit: token, account, create, operation or network.

Wait for Retry-After seconds, then go on more slowly.

Rate limit

Heavy requests: 20 a minute per token, 40 per account. More in Rate limits.

Added on .

Popular

API docs