Download a file or folder of a site
/v1/sites/{siteId}/files/download Downloads a file as it is (Content-Type: application/octet-stream, with its Content-Length), or a folder with everything in it as a .zip archive (application/zip, made as it's sent, so without a length), as an attachment named after it. The bytes are passed on from the site's server as they come, never held whole.
Files can hold secrets, so every download is written to the token's request log.
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
sites:files - Files and logins. File Manager, WordPress logins, cron jobs, backup downloads and backup storage. Full access to the sites' code and data.
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The site's id. |
Query parameters
| Field | Type and description |
|---|---|
path Required | string Up to 4,096 characters The file's or folder's path in the site. |
Example request
curl "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/files/download?path=%2Fwp-content%2Fuploads%2F2026%2F11%2Fteam-photo.jpg" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" \
-OJ import { writeFile } from "node:fs/promises";
const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/files/download?path=%2Fwp-content%2Fuploads%2F2026%2F11%2Fteam-photo.jpg", {
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
},
});
if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
await writeFile("download", Buffer.from(await res.arrayBuffer())); import { writeFile } from "node:fs/promises";
import { Rabbitflare } from "@rabbitflare/api";
const rf = new Rabbitflare({ token: process.env.RABBITFLARE_TOKEN });
const res = await rf.sites.files.download({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
path: "/wp-content/uploads/2026/11/team-photo.jpg",
});
await writeFile("download", Buffer.from(await res.arrayBuffer())); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/files/download?path=%2Fwp-content%2Fuploads%2F2026%2F11%2Fteam-photo.jpg');
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");
}
file_put_contents('download', $body); import os
import requests
response = requests.get(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/files/download",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
params={
"path": "/wp-content/uploads/2026/11/team-photo.jpg",
},
timeout=120,
)
response.raise_for_status()
with open("download", "wb") as f:
f.write(response.content) Response
200 OK The answer is the file itself, as application/octet-stream, without the data envelope.
Example response
The file itself, as application/octet-stream, without the data envelope.
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 |
400 bad_ | The path isn't one the site's server can use. Use a path in the site that starts with /, without control characters. |
403 trial_ | The site's server is on the free trial: WordPress sign-in, the File Manager and Cron Jobs switch on once it's kept. Keep the server in the control panel: they switch on by themselves. |
403 outside_ | The path leads outside the site's folder (through a link), which files can't reach. Use a path inside the site's folder. |
403 permission_ | The site's server refused access to a file or folder: its permissions don't let the site's own user do this. Check its permissions ( |
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 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 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 io_ | The site's server couldn't complete the file operation (its disk or file system refused). Try again; if it keeps failing (for example, the disk is full), contact support. |
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. |
502 file_ | The site's server didn't complete the file operation. Try again in a moment. |