Documentation
Guides and API reference for uploads, image transforms and video.
npm install @cd2/fileboy-react API https://api.fileboy.io
Documentation menu
Virus scanning
Fileboy scans what people upload with ClamAV, an open source antivirus engine, a few seconds after each upload. A file found to contain malware is blocked, and you get a webhook.
What is scanned
Every file a person uploads: files (POST /files/upload and upload sessions), videos and audio files and their replacements, posters and caption files. The copies Fileboy makes (resized images, video renditions, thumbnails) aren't scanned: they come from a file that was.
The scan runs after the upload has finished, so it never slows an upload down. The file is streamed from storage to the scanner, usually within seconds. Archives (zip, tar, gzip, 7z, rar and more), PDFs and Office documents are opened and their contents scanned too, within ClamAV's limits below.
Scan states
Each upload has one of these:
pending: waiting to be scanned, or being scanned.clean: ClamAV found nothing it knows of.infected: ClamAV found malware.signatureis the name it gave it.error: the file couldn't be scanned. A scan that fails (the scanner answers with an error or times out) is tried again after 30 seconds, 2, 10 and 30 minutes; after 5 tries it iserror.messagesays why. While the scanner can't be reached at all, a file waits (stillpending) and uses up no tries.skipped: never scanned.reasonistoo_large(over the scan limit) ornot_configured(scanning was off on the server when it was uploaded).
Files uploaded before virus scanning have no scan (none) and are served as before. See them, and scan one, on the file's page in the dashboard, or from your server with the private key (or a scoped key with files:read, and files:write to scan again):
1 2 3 4 5# Read a file's scan curl https://api.fileboy.io/files/FILE_ID/scan -H "Authorization: token SIGNED_TOKEN" # Scan it again (a failed scan, or a file uploaded before scanning) curl -X POST https://api.fileboy.io/files/FILE_ID/scan -H "Authorization: token SIGNED_TOKEN"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16{ "data": { "fileId": "2a860257-ecf9-424a-846e-00ab68e2fd58", "status": "clean", "reason": null, "signature": null, "message": null, "engine": "ClamAV 1.4.1/27470", "attempts": 1, "queuedAt": "2026-11-23T10:00:00Z", "scannedAt": "2026-11-23T10:00:02Z", "blocked": false, "holdDownloads": false, "maxBytes": 104857600 } }
blocked says whether reads of the file are refused now. An infected file can't be scanned again (409 file_infected): delete it.
Infected files
An infected file is blocked, not deleted. Every read of its bytes answers 403 file_infected: its URL, signed or not, its label, its resized copies, expiring links, share pages, zips (it is left out) and as an image overlay. Your own private key doesn't open it either. Its data (/files/data/:id) and the management API still show it, so you can see what it was and delete it. It stays until you do.
An infected video or audio upload isn't processed (one still waiting fails with a message saying why), and every /videos/:id URL of it answers 403 file_infected.
Fileboy sends a file.infected webhook. It is a file event, so an endpoint's file filters (type, label, folder, metadata) apply to it. scan.videoIds are the videos the file is the upload of.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22{ "id": "0f4e2c1a-9b3d-4a57-8c61-2d7e9f0b1a23", "type": "file.infected", "created": "2026-11-23T10:00:02Z", "appId": "APP_ID", "resource": { "id": "2a860257-ecf9-424a-846e-00ab68e2fd58", "name": "invoice.zip", "originalFilename": "invoice.zip", "mime": "application/zip", "fileSize": 48211, "metadata": {}, "createdAt": "2026-11-23T10:00:00Z", "scan": { "status": "infected", "signature": "Win.Trojan.Agent-123456", "engine": "ClamAV 1.4.1/27470", "scannedAt": "2026-11-23T10:00:02Z", "videoIds": [] } } }
Hold downloads until scanned
By default a file can be downloaded while its scan is pending, and after a scan fails, as before scanning existed. Only an infected file is blocked. Turn on holdDownloadsUntilScanned to hold every new upload back until it is scanned clean: until then its bytes answer 409 file_scan_pending, and 409 file_scan_failed if its scan failed (scan it again to release it). A skipped file (larger than the scan limit, or uploaded while scanning was off) is held too, with 409 file_not_scanned: it will never be scanned, so letting it through would let anything past the hold. Like an infected file, no key opens a held one. A zip that names a held file answers with the same 409, and so does a folder zip holding one. Scanning a file from before virus scanning (Scan now) holds it too until its scan is clean. Turn it on in the app's Settings (Virus scanning card), or:
1curl -X PATCH https://api.fileboy.io/app/settings -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "holdDownloadsUntilScanned": true }'
1 2 3 4 5 6HTTP/1.1 403 Forbidden { "error": "file_infected", "message": "This file was found to contain malware by the virus scan, so it is blocked. Its owner can delete it" } HTTP/1.1 409 Conflict Retry-After: 5 { "error": "file_scan_pending", "message": "This file is still being scanned for viruses. Try again in a moment" }
Use it when people you don't know download what others upload. A page that shows an upload straight away should wait for a clean scan (poll GET /files/:id/scan) or retry the 409.
Limits
- Files up to 100 MB are scanned. Larger files are
skippedwithtoo_large, andmaxBytessays the limit. - Inside an archive, ClamAV scans up to 400 MB of contents in all, files up to 100 MB each, nested up to 17 levels deep and 10,000 files. What lies past those limits isn't scanned, and the archive is still reported
clean. The same goes for a file that takes ClamAV more than a minute to scan. - Encrypted (password-protected) archives and documents can't be opened, so their contents aren't scanned.
- The signatures are updated from ClamAV's database several times a day. A file is scanned once, at upload, and not again when they change.
What scanning does and doesn't catch
ClamAV recognises known malware: viruses, trojans, ransomware, malicious macros and scripts, phishing documents and the standard EICAR test file. It works from signatures, so it catches what has been seen and catalogued before.
clean scan means ClamAV found nothing it knows of, not that the file is safe. New or targeted malware, malware inside encrypted archives, and harmful content that isn't malware (a phishing page as an image, a misleading document) can pass. Keep treating uploads as untrusted, limit who can read them with read access, and pair scanning with your own checks where it matters.