Documentation

Guides and API reference for uploads, image transforms and video.

npm install @cd2/fileboy-react
API https://api.fileboy.io

Trash and restoring files

On Pro and Max, deleting a file or video moves it to the app's trash. You can restore it, with the same id and URLs, until its time runs out. Then it is deleted for good. A file in the trash still counts toward your storage, because it is still stored.

How long deletes are kept

It depends on the app's plan:

  • Free: none, deletes are immediate
  • Starter: none, deletes are immediate
  • Pro: 7 days
  • Max: 30 days

The time is fixed when something is deleted: changing plan afterwards doesn't change when it goes. On Free nothing is kept, so a delete is permanent as it always was.

What a delete does

DELETE /files/{id}, POST /files/delete, deleting a folder with its contents, DELETE /videos/{id} and the dashboard all use the trash when the plan has one. From that moment the file reads as if it never existed: its URLs, transforms, labels, expiring links, share page, zips, lists, search and counts all answer 404 (or exactly what they answer for an id that was never used), so nothing reveals it is in the trash. A deleted video stops playing, and processing skips it.

Nothing is removed from storage until it is deleted for good. That is what lets it come back exactly as it was, cached image copies and video renditions included.

A video deleted while it was being processed is processed again when it is restored.

Deleting a folder

Deleting a folder, empty (contents=refuse) or with everything in it (contents=delete), puts the folder, its subfolders and their files in the trash. The answer's retentionDays says for how long. The folder is then gone from every list, path and count, and its name is free for a new folder. Its files are in the trash list as well, and can be restored on their own (at the root while their folder is in the trash).

POST /folders/{id}/restore brings it back with the same id, where it was, with its subfolders and the files deleted with it, each in its folder. A file that was deleted on its own before stays in the trash. If the folder it was in is gone, it comes back at the top level; if another folder there has taken its name, it comes back as "Name (restored)" and renamedFrom says so. Files that can't come back now (the plan's file limit, or a folder of thousands that takes too long) stay in the trash on their own and are listed in failed: restore them from there and they go into their folder. contents=moveToParent deletes only the folder, at once, as its contents stay.

1
2
# A deleted folder: back where it was, with its subfolders and files
curl -X POST https://api.fileboy.io/folders/FOLDER_ID/restore -H "Authorization: token SIGNED_TOKEN"
1
2
3
4
5
6
7
8
9
10
{
  "data": {
    "folder": { "id": "8c0b4f6e-1d2a-4b3c-9e5f-6a7b8c9d0e1f", "name": "Invoices", "path": "/Invoices", ... },
    "restoredFolders": 3,
    "restoredFiles": 41,
    "restoredFileIds": ["2a860257-ecf9-424a-846e-00ab68e2fd58", ...],
    "failed": [],
    "renamedFrom": null
  }
}

Storage and limits

Files and videos in the trash count toward your storage until they are deleted for good: we still store them, so they still cost. They don't count toward your plan's file, video or audio limits, so deleting makes room for new uploads at once.

GET /usage has trashStorageBytes, the part of storageBytes in the trash, and GET /usage/storage shows it as the trash kind. To free the space sooner, empty the trash or delete things forever.

Restoring checks the limits again: if the app already has as many files (or videos, or audio files) as its plan allows, the restore is refused:

1
2
HTTP/1.1 403 Forbidden
{ "error": "limit_reached", "message": "This app already has 5000 files, as many as its plan allows. Delete some or upgrade the plan, then restore it" }

List the trash

GET /trash lists what can still be restored, most recently deleted first, with who deleted it and when it goes. ?kind=file, ?kind=video or ?kind=folder lists one kind; page with limit and cursor as with GET /files. Add counts=true for counts: how many files, videos and folders are in the trash, which is what emptying it deletes.

1
curl "https://api.fileboy.io/trash?limit=50&counts=true" -H "Authorization: token SIGNED_TOKEN"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "data": [
    {
      "kind": "file",
      "id": "2a860257-ecf9-424a-846e-00ab68e2fd58",
      "name": "invoice.pdf",
      "mime": "application/pdf",
      "fileSize": 48211,
      "folderId": "8c0b4f6e-1d2a-4b3c-9e5f-6a7b8c9d0e1f",
      "createdAt": "2026-11-02T09:12:00Z",
      "deletedAt": "2026-11-23T10:00:00Z",
      "deletedBy": "API key",
      "purgeAt": "2026-12-23T10:00:00Z",
      "daysLeft": 29
    }
  ],
  "nextCursor": null,
  "retentionDays": 30,
  "storageBytes": 48211,
  "counts": { "files": 1, "videos": 0, "folders": 0 }
}

Restore

A restored file has the same id, URLs, labels and metadata, and goes back to its folder. If the folder was deleted for good meanwhile, or is in the trash, it comes back at the root. Restore a deleted folder to put its files back in it.

1
2
3
4
5
6
7
8
# One file: the same id and URLs, back in its folder
curl -X POST https://api.fileboy.io/files/FILE_ID/restore -H "Authorization: token SIGNED_TOKEN"

# Up to 100 files
curl -X POST https://api.fileboy.io/files/restore -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "ids": ["FILE_ID", "OTHER_FILE_ID"] }'

# A video, with everything it holds
curl -X POST https://api.fileboy.io/videos/VIDEO_ID/restore -H "Authorization: token SIGNED_TOKEN"

Delete forever and empty the trash

POST /files/{id}/purge and POST /videos/{id}/purge delete one thing for good at once, whether it is in the trash or not: use them when you want a delete to be permanent on any plan. POST /folders/{id}/purge deletes a folder in the trash for good, with its subfolders and the files deleted with it. POST /trash/empty deletes everything in the trash, folders included.

1
2
3
4
5
# Delete one forever, now (in the trash or not)
curl -X POST https://api.fileboy.io/files/FILE_ID/purge -H "Authorization: token SIGNED_TOKEN"

# Empty the trash: up to 200 a call, send it again while "remaining" is above 0
curl -X POST https://api.fileboy.io/trash/empty -H "Authorization: token SIGNED_TOKEN"
Deleting an app or your account deletes everything in it, the trash included. Nothing goes to a trash then.

Deleting an app

An app's Owner deletes it, with everything in it, from its Settings page (after cancelling a paid plan). It is gone at once, for everyone: its keys stop working, its file, image and video URLs answer 404 as for an id that never existed, it takes no uploads, its webhooks stop and its custom domains stop resolving. Its members, invites and pending ownership transfer go with it.

What it holds is then deleted in the background, a small batch at a time: its videos and every file they made, its files and Fileboy's copies of them, the trash, then its webhook history, analytics and activity, and finally the app itself. A large app takes a while to go fully. Until then your apps list shows it as deleting, with how many files are left, and when it's done whoever deleted it gets an email. Its usage stops counting towards your account and organisation straight away. Deleting your account works the same way for the apps that go with it. If Fileboy support deletes an app, any paid plan it has ends at once (or it comes off its organisation's subscription), with no refund for the rest of the period, and the email goes to the app's Owner.

Webhooks

file.deleted is sent when a file goes to the trash, the moment it stops being served, so an integration that removes its own copy keeps working as before. Then file.restored if it comes back, or file.purged when it is deleted for good. Videos send video.deleted, video.restored and video.purged. On Free only file.deleted is sent. Filters and replays work for all of them; see webhooks.

In the SDKs and the dashboard

Each app has a Trash page in the dashboard, with Restore, Delete forever and Empty trash (which says how much it will delete first). Tick items, or all of a page, to restore them together. Deleting a file, video or folder in the dashboard offers Undo straight away. The SDKs have the same calls:

1
2
3
4
5
6
7
8
9
import { Fileboy } from "@cd2/fileboy-node"

const fileboy = new Fileboy({ publicKey, privateKey })

await fileboy.destroyFile(fileId) // to the trash on Pro and Max
const { data, retentionDays } = await fileboy.listTrash()
await fileboy.restoreFile(fileId) // the same id and URLs
await fileboy.purgeFile(otherId) // gone for good
await fileboy.emptyTrash()

Related guides