Documentation
Guides and API reference for uploads, image transforms and video.
npm install @cd2/fileboy-react API https://api.fileboy.io
Documentation menu
Custom domains
Serve an app's files, images and videos on a domain of yours, like files.example.com, with HTTPS, instead of api.fileboy.io. Custom domains are on the Pro and Max plans.
How it works
You add a subdomain of a domain you own, and point it at Fileboy with a CNAME record. Fileboy's CDN (Cloudflare) checks the record, issues a certificate for the domain, and from then on serves the app's files on it: the same paths as on api.fileboy.io, such as https://files.example.com/files/get/FILE_ID and https://files.example.com/images/get/FILE_ID?transform=resize:400x_.
A domain only ever serves its own app's files. Another app's file id on it is a 404, and so is the management API: keep calling api.fileboy.io for uploads and everything that needs your private key. Every access rule still applies on the domain: signed URLs (a URL signed for api.fileboy.io works on your domain too, as the signature covers the path), private files and videos, allowed origins and the player's embed domains.
Set one up
- In the dashboard, open the app's Settings, then Custom domains, and add the domain. Or call
POST /domains. - Add the records it shows at your DNS provider. Each has a copy button. Every domain needs two:
- a CNAME from your domain to Fileboy's target, which sends its traffic to Fileboy;
- an ownership TXT record,
_cf-custom-hostname.files.example.com, which proves the domain is yours.
- Wait. Fileboy checks after a minute, then less and less often, up to once an hour. Once the records can be seen, the certificate usually takes minutes, but new DNS records can take hours to spread. Press Check now to look at once. A domain still pending after two weeks fails.
- Once it says Active, use the domain in your file URLs. Keep the CNAME: removing it stops the domain. You can remove the ownership TXT record once the domain is active.
1curl -X POST https://api.fileboy.io/domains -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "hostname": "files.example.com" }'
The answer has the records to add:
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 28{ "data": { "id": "8d2f1c3a-5b6e-4f70-9a81-b2c3d4e5f607", "hostname": "files.example.com", "status": "pending", "sslStatus": "pending_validation", "sslMethod": "http", "records": [ { "type": "CNAME", "name": "files.example.com", "value": "domains.fbycdn.com", "purpose": "routing" }, { "type": "TXT", "name": "_cf-custom-hostname.files.example.com", "value": "6f1e2d3c-4b5a-4978-8695-a4b3c2d1e0f9", "purpose": "ownership" } ], "message": null, "url": "https://files.example.com", "lastCheckedAt": "2026-11-23T10:00:00Z", "activatedAt": null, "createdAt": "2026-11-23T10:00:00Z" } }
1 2 3; At your DNS provider, for files.example.com files.example.com. CNAME domains.fbycdn.com. _cf-custom-hostname.files.example.com. TXT "6f1e2d3c-4b5a-4978-8695-a4b3c2d1e0f9"
DNS at common providers
Most providers want the record name without your domain on the end: for files.example.com in the example.com zone, the name is files, and for the TXT record, _cf-custom-hostname.files.
- Cloudflare (your own account): DNS, Records, Add record, type CNAME, name
files, target the value shown, proxy status DNS only (the grey cloud). - GoDaddy: Domain, DNS, Add New Record, CNAME, name
files, value the target. - Namecheap: Domain List, Manage, Advanced DNS, Add New Record, CNAME Record, host
files. - Amazon Route 53: Hosted zones, the zone, Create record, record name
files, type CNAME. TXT values go in double quotes. - Google Cloud DNS and Squarespace Domains: add a CNAME with host
files. Google Cloud DNS wants the full name with a dot on the end for the target.
Root domains
Use a subdomain, like files.example.com or cdn.example.com. A root domain (example.com) can't have a CNAME under the DNS standard, so it would need CNAME flattening (ALIAS or ANAME records) at your provider, and pointing a root domain at Fileboy's CDN by its addresses isn't supported. Fileboy refuses root domains for now, and wildcards, IP addresses and Fileboy's own domains.
International domain names are fine: they are stored in their xn-- form, which is what browsers send.
Certificates
By default ("sslMethod": "http") the certificate is issued once the CNAME points at Fileboy, and renewed by itself. To have the certificate ready before you move traffic over, add the domain with "sslMethod": "txt": it shows a TXT record for the certificate as well. TXT certificates need their record updated when they renew, so switch to the CNAME as soon as you can.
Statuses
pending: waiting for the CNAME, the ownership TXT record or the certificate. Nothing is served on the domain yet.active: files are served on it.failed: the certificate couldn't be issued, the domain was still pending after two weeks, or its DNS stopped pointing at Fileboy. The message says which. A failed domain serves nothing, and isn't checked again until you press Set up again (or call refresh), which starts from the beginning, with new records.deleting: being removed. It already serves nothing.
Links on your domain
Your domain serves every file as soon as it's active, but the links Fileboy hands out stay on Fileboy's own address (its delivery domain) until you turn on customDomainLinks. Then every file, image, video and playlist link in the management API's answers (a video's urls, thumbnails, captions, posters), in video webhooks, on share pages and in the links the dashboard gives you to copy uses the app's active custom domain. They go back to Fileboy's address by themselves if it stops being active. Links your domain doesn't serve (uploads, zips, expiring links, the management API itself) stay on api.fileboy.io, and so does anything in your own metadata. In the SDKs, set filesUrl to build URLs on your domain.
1curl -X PATCH https://api.fileboy.io/app/settings -H "Authorization: token SIGNED_TOKEN" -H "Content-Type: application/json" -d '{ "customDomainLinks": true }'
1 2 3 4 5 6 7 8 9import { Fileboy } from "@cd2/fileboy-node" const fileboy = Fileboy({ publicKey, privateKey }) const domain = await fileboy.addDomain("files.example.com") console.log(domain.records) // the DNS records to add // Later: build file URLs on your domain const onDomain = Fileboy({ publicKey, privateKey, filesUrl: "https://files.example.com" }) onDomain.buildFileUrl(fileId) // https://files.example.com/files/get/<id>
API
All four take the app's private key (not a scoped key) and are in the API reference. Adding is limited to 10 domains an hour per app, and Check now to a few a minute per domain.
1 2 3 4 5 6 7 8# List the app's domains, its plan's limit and the CNAME target curl https://api.fileboy.io/domains -H "Authorization: token SIGNED_TOKEN" # Check a domain now (by id or hostname) curl -X POST https://api.fileboy.io/domains/files.example.com/refresh -H "Authorization: token SIGNED_TOKEN" # Remove it: the domain stops serving files at once curl -X DELETE https://api.fileboy.io/domains/DOMAIN_ID -H "Authorization: token SIGNED_TOKEN"
Troubleshooting
- Still pending after an hour. Look the record up with
dig CNAME files.example.com(or an online DNS checker). It should answer with the target shown. A typo, a record added to the wrong zone, or your domain's name doubled on the end (files.example.com.example.com) are the usual causes. - Pending: the CNAME is in place, but the TXT record isn't there yet. Add the ownership TXT record shown (
_cf-custom-hostname.files.example.com) with exactly the value shown, then press Check now. Check it withdig TXT _cf-custom-hostname.files.example.com. Some providers add your domain to the name by themselves: type_cf-custom-hostname.filesthere. - Failed: no longer points at Fileboy. The CNAME was removed or changed. Put it back, then press Set up again.
- Failed: the certificate couldn't be issued. A CAA record on your domain may forbid the certificate authorities Cloudflare uses. Allow them (see Cloudflare's list of certificate authorities) or remove the CAA record, then set it up again.
- 404 on the domain. The domain isn't active yet, the file belongs to another app, or the path is a management route. Only file, image, video and playlist reads are served on custom domains.
- That hostname is already a custom domain. Each hostname can belong to one app. Remove it from the other app first. If that app's domain has failed, or has been pending for three days without its ownership TXT record, adding it takes it over.
*.example.com) pointing at Fileboy is safe. Names under it do reach Fileboy, but none goes active without its own ownership TXT record, which only you can add. So nobody else can claim cdn.example.com for their app. Each domain is still added by name.