Documentation
Guides and API reference for uploads, image transforms and video.
npm install @cd2/fileboy-react API https://api.fileboy.io
Documentation menu
Bring your own storage
Store an app's files in your own S3-compatible bucket (Amazon S3, Cloudflare R2, DigitalOcean Spaces, Backblaze B2, MinIO and others) instead of Fileboy's. Everything else stays the same: uploads, image transforms, video, links and access rules all work as before, and files are still served through Fileboy. On the Max plan.
What is stored where
Once a bucket is set up, every new upload of the app goes to it: files sent with POST /files/upload, resumable uploads (parts included), recordings, videos and their renditions, posters, thumbnails, captions and documents, the cached copies image transforms make, and AI image edits.
Each file records where it was stored. Files uploaded before you set up the bucket stay in Fileboy's storage and keep working. Files stored in your bucket stay there even if you turn it off later, and keep reading from it with its credentials. Keys look like fileboy/APP_ID/AbCdEfGhIjKlMnOpQrStUvWx.jpg: your prefix, the app's id, then a random name, with Fileboy's own copies under APP_ID/auto/.
Objects are private. Fileboy sets no ACL, reads them with signed requests, and serves them on its own URLs with every access rule applied: signed URLs, private files, custom domains. Your bucket doesn't need to be public, and shouldn't be.
Plans and usage
Bring your own storage is part of the Max plan. Files in your bucket still count towards the app's file, video and audio limits, but while the app stores in its own bucket its uploads aren't limited by Fileboy's storage limit: you pay your storage provider for those bytes.
GET /usage/storage still reports every byte the app stores as storageBytes, and says how much of it is in your own buckets as byoStorageBytes, and whether uploads go there now as ownStorage.
Moving to a plan without it pauses it. New uploads go to Fileboy's storage again (and count towards its storage limit), the same as Disable. Files already in your bucket stay there and keep reading from it with the saved credentials, so keep the bucket and its key working. The dashboard shows the bucket as Paused: your plan doesn't include your own storage, the activity log records storage.byo_suspended with the reason plan, and GET /storage lists it as suspended. Fileboy checks the plan whenever it picks where an upload goes, so nothing reaches the bucket once the plan has changed. After upgrading, press Test and turn back on (or PUT /storage with the same bucket): the bucket is tested again, and only turned back on if every step passes. Nothing is moved either way.
Set it up
- Make a bucket, and a key that can only reach it (see your provider below).
- In the dashboard, open the app's Settings, then Storage. Pick your provider, fill in the endpoint, region, bucket, an optional prefix (folder) and the key, and press Test. Only the app's Owners and Admins can.
- When every step passes, press Save. New uploads go to the bucket from then on.
Testing writes a small object under the prefix, reads it back, lists the prefix and deletes the object, so the key needs those permissions and no more. Each step says what went wrong if it fails, such as an unknown key, a secret that doesn't match, a bucket that doesn't exist or the wrong region. Nothing is saved until every step passes. Tests are limited to 10 every 10 minutes per app.
Or with the API, with a token signed with the app's own private key:
1 2 3 4 5 6 7 8 9 10curl -X PUT https://api.fileboy.io/storage -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "endpoint": "https://s3.eu-west-2.amazonaws.com", "region": "eu-west-2", "bucket": "my-company-media", "prefix": "fileboy/", "pathStyle": false, "directParts": false, "accessKeyId": "AKIA...", "secretAccessKey": "..." }'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27{ "data": { "id": "8d2f1c3a-5b6e-4f70-9a81-b2c3d4e5f607", "status": "active", "endpoint": "https://s3.eu-west-2.amazonaws.com", "region": "eu-west-2", "bucket": "my-company-media", "prefix": "fileboy/", "pathStyle": false, "directParts": false, "accessKeyId": "AKIA...", "secretLast4": "x9Qz", "health": "healthy", "lastError": null, "failingSince": null, "lastCheckedAt": "2026-11-23T10:00:00Z", "createdAt": "2026-11-23T10:00:00Z", "retiredAt": null }, "steps": [ { "step": "write", "ok": true, "message": "Wrote a test object under the prefix" }, { "step": "read", "ok": true, "message": "Read it back" }, { "step": "list", "ok": true, "message": "Listed the prefix and found it" }, { "step": "delete", "ok": true, "message": "Deleted it" }, { "step": "cors", "ok": true, "skipped": true, "message": "Not needed: upload parts go through Fileboy" } ] }
A bucket that fails its test is a 422, with each step:
1 2 3 4 5 6 7 8 9 10 11{ "error": "storage_check_failed", "message": "The secret access key doesn't match the access key id", "steps": [ { "step": "write", "ok": false, "message": "The secret access key doesn't match the access key id" }, { "step": "read", "ok": false, "skipped": true, "message": "Skipped: an earlier step failed" }, { "step": "list", "ok": false, "skipped": true, "message": "Skipped: an earlier step failed" }, { "step": "delete", "ok": false, "skipped": true, "message": "Skipped: an earlier step failed" }, { "step": "cors", "ok": false, "skipped": true, "message": "Skipped: an earlier step failed" } ] }
Saving the same bucket and prefix again changes its options or credentials in place (leave secretAccessKey out to keep the saved one). Saving another bucket or prefix moves new uploads there; the earlier one is kept, for the files in it.
Amazon S3
Endpoint https://s3.REGION.amazonaws.com, with the bucket's region (like eu-west-2) in the region field too. Leave path style off. Keep Block Public Access on and ACLs disabled: Fileboy doesn't need either.
Make an IAM user (or role) with this policy, with your bucket's name and your prefix in it, and give Fileboy its access key. It can only reach objects under the prefix:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24{ "Version": "2012-10-17", "Statement": [ { "Sid": "FileboyObjects", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts" ], "Resource": "arn:aws:s3:::YOUR_BUCKET/fileboy/*" }, { "Sid": "FileboyList", "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::YOUR_BUCKET", "Condition": { "StringLike": { "s3:prefix": ["fileboy/*"] } } } ] }
With no prefix, use arn:aws:s3:::YOUR_BUCKET/* and drop the condition. A lifecycle rule that aborts incomplete multipart uploads after a day or two cleans up after uploads that were never finished.
Cloudflare R2
Endpoint https://ACCOUNT_ID.r2.cloudflarestorage.com (your account id is in the R2 dashboard), region auto, path style on. Make an R2 API token with Object Read & Write permission, limited to the bucket, and use its access key id and secret access key. R2 has no ACLs, and its CORS rules take the same JSON as S3's.
DigitalOcean Spaces
Endpoint https://REGION.digitaloceanspaces.com and the region the Space is in (like lon1 or nyc3). Path style off. Make a Spaces access key limited to the Space with read, write and delete access, rather than one for every Space. Keep the Space's file listing restricted.
Backblaze B2
Use the S3 endpoint on the bucket's page, like https://s3.eu-central-003.backblazeb2.com, and the region in it (eu-central-003). Make an application key with read and write access to that bucket only, with a name prefix if you use one. The key id is the access key id and the application key the secret. Keep the bucket private.
MinIO and others
Any service with the S3 API works: give its https endpoint, the region it expects (MinIO's default is us-east-1) and turn path style on if the service needs it, as MinIO does. Give Fileboy a key with a policy like the S3 one above. The endpoint must be reachable from the internet over https.
Uploads straight to your bucket (CORS)
Large and resumable uploads are sent in parts. By default each part goes through Fileboy, which sends it on to your bucket. Turn on direct part uploads and browsers send parts straight to the bucket with short-lived signed URLs instead, so the bytes never pass through Fileboy. Browsers only do that when the bucket's CORS rules let them PUT to it and read the ETag header, so the test checks this too, from the dashboard's address and the sites in the app's allowed origins.
Add a rule like this (the dashboard shows it with your origins filled in). In S3 it goes in the bucket's Permissions, CORS; in R2 the bucket's Settings, CORS policy; in Spaces, the Space's Settings. B2 needs its own CORS rules set with the B2 command line tool. Use "*" as the origin if uploads come from any site: the signed URL is the permission either way.
1 2 3 4 5 6 7 8 9[ { "AllowedOrigins": ["https://fileboy.io", "https://www.example.com"], "AllowedMethods": ["PUT"], "AllowedHeaders": ["*"], "ExposeHeaders": ["ETag"], "MaxAgeSeconds": 3000 } ]
Server SDKs don't need CORS: only browsers check it.
When your bucket fails
If Fileboy can't use the bucket (the key was revoked, the bucket was deleted, the service is down) the app's uploads and reads of files in it fail with a 502 and storage_unavailable. Uploads say what went wrong in the message; reads of files, which anyone with a public file's link can make, only say the file can't be read right now, so they never name your bucket. Fileboy never stores in its own storage instead: your files only go where you said.
The bucket shows as Failing in the dashboard with the reason, and the first failure is written to the app's activity log (storage.failed). Fileboy checks a failing bucket again every 5 minutes, and one that works every 6 hours, and logs storage.recovered once it works again. Press Check now (or POST /storage/check) after fixing it.
Turn it off, or change keys
Disable (DELETE /storage) sends new uploads back to Fileboy's storage. The files already in your bucket stay there and still read from it, so keep the bucket and its key working until you've deleted them. Fileboy keeps the credentials for as long as any file is stored in the bucket, and forgets them once the last one is deleted.
When you rotate the key of a bucket the app used before, give Fileboy the new one under Earlier buckets in the dashboard, or with PATCH /storage/locations/ID. For the active bucket, save it again with the new key.
Deleting files and apps
Deleting a file deletes its object in your bucket, Fileboy's copies of it included. Deletes made in the dashboard are queued and done by Fileboy within a minute or so, retried while the bucket fails, for up to a week. A delete through the API while the bucket fails (a revoked key, a deleted bucket) still deletes the file, and its object is queued the same way. Deleting the app deletes its objects the same way, in the background: the app keeps the bucket's credentials until they're done (or have failed for a week), then forgets them; anything left then stays in your bucket. Fileboy never deletes anything in your bucket that it didn't store there for the app.
Security
- The secret access key is encrypted (AES-256-GCM) before it is stored, with a key only Fileboy's API servers have. It is never shown again, sent in an answer or written to a log: the dashboard and the API show its last 4 characters.
- Endpoints must be https and resolve only to public addresses. Every connection is checked again when it is made, so a name that later points somewhere internal is refused. Redirects aren't followed.
- Only the app's own private key can call the storage routes (not scoped keys or personal access tokens), and in the dashboard only the app's Owners and Admins can change them. Changes are in the activity log.
- Give Fileboy a key that can only reach the bucket (and prefix) it uses.
- Fileboy never makes objects in your bucket public. If Fileboy support suspends the app or disables a file for abuse (see Suspended apps and disabled files), it sets any of those objects you made public to private, with your key (so allow it
s3:GetObjectAclands3:PutObjectAclif you use ACLs), and back once it's lifted. It only takes away the public grant and puts it back: any other grant you gave stays. Without those two permissions (the policy above doesn't give them) Fileboy leaves your objects' ACLs as they are. Fileboy can't purge a CDN you run in front of your bucket: that keeps serving what it cached until it expires.
API and SDKs
The storage routes are in the API reference. They answer 503 byo_storage_unavailable on a Fileboy server without the feature set up, and 403 plan_limit on a plan without it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14# The app's storage: the active bucket (null for Fileboy's), earlier ones and the CORS rule curl https://api.fileboy.io/storage -H "Authorization: token SIGNED_TOKEN" # Test a bucket without saving it (or the saved one, with an empty body) curl -X POST https://api.fileboy.io/storage/test -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{}' # Check every bucket of the app now curl -X POST https://api.fileboy.io/storage/check -H "Authorization: token SIGNED_TOKEN" # New credentials for a bucket the app stored in before curl -X PATCH https://api.fileboy.io/storage/locations/LOCATION_ID -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "accessKeyId": "AKIA...", "secretAccessKey": "..." }' # Send new uploads back to Fileboy's storage curl -X DELETE https://api.fileboy.io/storage -H "Authorization: token SIGNED_TOKEN"
The Node SDK has getStorage, setStorage, testStorage, checkStorage, updateStorageCredentials and disableStorage, and the Ruby and Python SDKs the same in snake case.
1 2 3 4 5 6 7 8 9 10 11 12 13 14import { Fileboy } from "@cd2/fileboy-node" const fileboy = Fileboy({ publicKey, privateKey }) await fileboy.setStorage({ endpoint: "https://ACCOUNT_ID.r2.cloudflarestorage.com", region: "auto", bucket: "media", prefix: "fileboy/", pathStyle: true, accessKeyId: process.env.R2_ACCESS_KEY_ID!, secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!, }) const { active } = await fileboy.getStorage() console.log(active?.health) // "healthy"