Documentation

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

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

Files API reference

The files endpoints, generated from the OpenAPI document you can download for code generators and API clients: openapi.json or openapi.yaml. See every endpoint for the rest of the API.

Base URLhttps://api.fileboy.io

Upload, read and serve files.

POST/files/upload

Upload a file

Send the file as multipart/form-data, or send JSON with a url and Fileboy fetches it for you. The demo key only accepts small images and is rate limited. The plan's file limit and storage limit are hard limits on every upload, counting what the app's open upload sessions reserve: past either the answer is 403 (limit_reached, storage_limit_reached) and nothing is stored. A video's files (its original, poster and caption tracks) never count towards the file limit, so only the storage limit holds for those. One file can be up to the plan's upload size limit (5 GB on every plan), sent or fetched: a bigger one is answered with 413 file_too_large and nothing is stored. A request whose Content-Length is over the limit is refused before its body is read, and a URL whose response is too big is never read in full. A fetch from a URL has 60 seconds between bytes, must average at least 4 KB a second once it has waited 60 seconds, and has 9 minutes in all: past any of them it is answered with 504 url_fetch_timeout. An address that can't be fetched (not a public internet address, a name that doesn't resolve, a refused connection, too many redirects) is a 400 url_fetch_error that never says what the host resolved to. Send folderId or folderPath to upload straight into a folder. A request signed with your private key creates any missing folders on folderPath; the public key and access tokens can only use folders that already exist (404 folder_not_found otherwise, and nothing is stored). A multipart upload is stored as it arrives, so its other fields may come before or after the file: one sent before it is checked before anything is stored, one sent after it once the file has arrived (a bad one is then refused and the file not kept). A url field sent after the file is a 400 url_with_file: send either a file or a url. A name, and the uploaded file's own name, can be up to 1,024 characters (counted as characters, not bytes): a longer one is a 400 validation_error and nothing is stored. For a URL import a longer name is refused before anything is fetched, and a longer file name from the server's Content-Disposition is cut to 1,024 characters.

Authorization: public key or signed token

Parameters

NameInTypeDescription
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Request body

multipart/form-data
file *string (binary)
datastringOptional JSON string of name, mime, metadata, folderId and folderPath. name and mime default to the uploaded file's own.
urlstring (uri)If present, the file is fetched from this URL and file is ignored.
folderIdstring (uuid)Put the file in this folder. Can also be sent inside data.
folderPathstringPut the file in the folder at this path, like /uploads/avatars. Can also be sent inside data. See UploadFileData.
application/json
url *string (uri)An http or https address Fileboy can fetch. The file's sourceUrl metadata keeps it without its query string, fragment or user name and password.
namestringUp to 1,024 characters, checked before the file is fetched. Defaults to the file name the server sends, cut to 1,024 characters.
metadataMetadata
folderIdstring (uuid)See UploadFileData.
folderPathstringSee UploadFileData.
expectstring | string[]Reject the download unless it matches. A comma separated string or an array of .ext, type/subtype, type/* or */subtype entries, like an HTML accept attribute. Matched in any case, against the response's type without its parameters (text/csv; charset=utf-8 matches text/csv).

Responses

200The stored file.
application/json
400The request can't be used: multipart_error (a form that can't be read, or one that stopped before the end of its file), file_error (no file), json_error (bad data), url_with_file (a url sent after the file), url_fetch_error, validation_error (a name or file name over 1,024 characters).
application/json
401No key was sent.
application/json
403Refused. storage_limit_reached when the file would take the app past its storage limit, or limit_reached past its file limit, counting what the app's open upload sessions reserve (checked before the file is stored and again as it is saved, so uploads sent at once can't overshoot; an app already over a limit keeps its files but takes no more). origin_not_allowed when the request uses the public key from a page that is not in the app's allowedOrigins (or has no Origin or Referer, when the app sets blockRequestsWithoutOrigin). Requests signed with the private key are never refused for their origin.
application/json
404The folder does not exist.
application/json
413An error. error is a short code and message says what went wrong.
application/json
415An error. error is a short code and message says what went wrong.
application/json
422location_not_removed: the app removes photo locations at upload (stripLocationOnUpload) and this photo's could not be removed, so it was not stored.
application/json
429An error. error is a short code and message says what went wrong.
application/json
500An error. error is a short code and message says what went wrong.
application/json
504url_fetch_timeout: the file at url stopped arriving for 60 seconds, arrived slower than 4 KB a second, or took longer than 9 minutes in all.
application/json
POST/uploads

Start a large, resumable upload

Start an upload session for one file: it is sent in parts (POST /uploads/{id}/parts), which can be retried one at a time and resumed after a crash (GET /uploads/{id}), then completed (POST /uploads/{id}/complete). Takes the same keys and rules as POST /files/upload: the public key (held to the app's allowed origins), an access token, the private key or a scoped key with the uploads scope. size is held to the plan's upload cap (413 file_too_large), and, counting what the app's other open sessions reserve (a signed session counts only signed ones, so public-key sessions can't hold up the app's own), to its storage limit (403 storage_limit_reached) and, for a kind: "file" session, its file limit (403 limit_reached): while the session is open its size, and for a file session one file, are reserved. A video session's file never counts towards the file limit. Fileboy chooses the part size (8 MiB to 64 MiB) and answers with it and the number of parts (at most 10,000). kind: "video" makes a video at complete, as POST /videos/upload does: its mime is video/*, or audio/* for an audio file. An app can have 1,000 signed sessions open and 200 public-key ones, and starting them is rate limited per app and, for the public key, per address (429). The shared demo app takes images only, up to its own cap, and no video. Sessions last 24 hours. openEnded: true (with no size) is for a file still being made, like a recording uploaded while it records: every part is partSize (5 MiB) but the last, which may be smaller, and each part's size is given when its URL is asked for. It reserves a part to start with and grows its reservation as part URLs are asked for, held to the same limits as it goes; maxSize is the most it may hold (the plan's cap). Its size and partCount are null until it completes. A video session reserves its video's id (videoId) when it is made: GET /videos/{id}/data answers uploading: true for it until the session completes, and the video is made with that id. No video exists, counts toward the plan or is sent in a webhook until then; an aborted or expired session takes the id with it.

Authorization: public key or signed token

Parameters

NameInTypeDescription
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Request body

application/json
sizeintegerThe file's size in bytes. Required unless openEnded.
openEndedbooleanA file still being made, with no size yet (a recording uploaded as it records). Leave size out. Not on the demo app.
filenamestringThe file's own name, kept as originalFilename. Up to 1,024 characters.
namestringThe name to save it under, up to 1,024 characters. Defaults to filename.
mimestringThe type. The stored type is told from the file's bytes at complete.
kind"file" | "video"
metadataMetadata
folderIdstring (uuid)
folderPathstringAs for POST /files/upload.
descriptionstringFor a video.
tagsstring[]For a video.
sourceVideoSourceFor a video, as for POST /videos/upload. Refused (400) for a file.

Responses

201The new session.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
402spend_cap_reached: the app is at its spend cap while overage billing is on, so no new video encoding starts until the month ends at midnight UTC or the cap is raised. Beside error and message the body has resetsAt (when it lifts) and usageUrl (the app's Usage page, where the cap is set). Existing videos keep playing. See /docs/usage-alerts.
application/json
403origin_not_allowed, storage_limit_reached, limit_reached or not_available_on_demo. video_limit_reached for a kind: "video" session with a video/* type (a recording too) when the app is on the Free plan and has no room for another video (see POST /videos/upload).
application/json
404The folder does not exist.
application/json
413An error. error is a short code and message says what went wrong.
application/json
415An error. error is a short code and message says what went wrong.
application/json
429An error. error is a short code and message says what went wrong.
application/json
500An error. error is a short code and message says what went wrong.
application/json
GET/uploads/{id}

Read an upload session, to resume it

The session, with parts: the parts storage already holds (their numbers, sizes and ETags) and uploadedBytes. Send the rest and complete. A session made with a signed request is only found with one. Expired sessions are 404 upload_not_found.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Responses

200The session.
application/json
401No key was sent.
application/json
403Refused. origin_not_allowed when the request uses the public key from a page that is not in the app's allowedOrigins (or has no Origin or Referer, when the app sets blockRequestsWithoutOrigin). Requests signed with the private key are never refused for their origin.
application/json
404upload_not_found: no session with that id, or it expired.
application/json
DELETE/uploads/{id}

Abort an upload session

Stop a session and throw its parts away at storage. On a completed session only the session goes, never its file. 409 upload_completing while another request completes it.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Responses

204Aborted.
401No key was sent.
application/json
403Refused. origin_not_allowed when the request uses the public key from a page that is not in the app's allowedOrigins (or has no Origin or Referer, when the app sets blockRequestsWithoutOrigin). Requests signed with the private key are never refused for their origin.
application/json
404upload_not_found: no session with that id, or it expired.
application/json
409An error. error is a short code and message says what went wrong.
application/json
POST/uploads/{id}/parts

Get URLs to send parts to

Up to 100 part numbers a call. Each URL takes one PUT of that part's bytes, exactly size of them, with the headers given and no key: the URL is the permission, for 15 minutes. For an open-ended session, give the last part's size: {"parts": [{"number": 7, "size": 1234}]} (a bare number is a full part). Each call grows what the session reserves to the end of its furthest part: 413 file_too_large past the plan's cap, 403 storage_limit_reached past the storage limit. When direct is true the URLs point straight at storage (an S3 presigned URL) and no file bytes pass through the API; otherwise they point at PUT /uploads/{id}/parts/{n}. Either way the answer to the PUT has an ETag header to send to complete.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Request body

application/json
parts *integer | object[]

Responses

200A URL for each part.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403origin_not_allowed, or for an open-ended session storage_limit_reached or limit_reached.
application/json
404upload_not_found: no session with that id, or it expired.
application/json
409upload_not_open: the session is completing or completed.
application/json
413file_too_large: an open-ended session's part would end past maxSize.
application/json
PUT/uploads/{id}/parts/{n}

Send one part through the API

Where a part URL from POST /uploads/{id}/parts points when the parts don't go straight to storage. The URL's expires and signature are the permission: there is no key. The body is the part's bytes, exactly its size. Answers with the part and its ETag header.

Authorization: none needed

Parameters

NameInTypeDescription
id *pathstring (uuid)
n *pathinteger
expires *queryinteger
sizequeryintegerAn open-ended session's part size, which the signature covers.
signature *querystring

Request body

application/octet-stream

Responses

200The part was stored.
application/json
400part_size_mismatch: the body is not the part's size.
application/json
403invalid_part_url: changed or expired.
application/json
404upload_not_found: no session with that id, or it expired.
application/json
POST/uploads/{id}/complete

Complete an upload session

Checks storage has every part at its size (409 parts_missing, part_size_mismatch; with parts, 409 part_mismatch for an ETag that differs), puts them together, and saves the file exactly as POST /files/upload would: it is read once from storage, its type told from its first bytes, its SHA-1 hash worked out from every byte (a hash the client sends is not trusted), an image gets its size, EXIF data and palette, and it must be the declared size (422 size_mismatch, and the session is thrown away). The storage limit, and for a kind: "file" session the file limit, are checked again (403, and the session stays open). Then the file goes in its folder and file.uploaded is sent, or for kind: "video" the video is made, video.uploaded sent and processing starts. Completing a completed session answers with the same file. 409 upload_completing while another request completes it.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)
X-Fileboy-Appheaderstring (uuid)With a personal access token: the id of the app the request is for. Ignored for an app's own keys and scoped keys.

Request body

application/json
partsobject[]Optional: the ETags the part PUTs answered with, checked against storage's.

Responses

200The completed session, with file (and video).
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403storage_limit_reached or limit_reached.
application/json
404upload_not_found: no session with that id, or it expired.
application/json
409An error. error is a short code and message says what went wrong.
application/json
413An error. error is a short code and message says what went wrong.
application/json
415An error. error is a short code and message says what went wrong.
application/json
422An error. error is a short code and message says what went wrong.
application/json
500An error. error is a short code and message says what went wrong.
application/json
GET/files/get/{id}

Get a file

Returns the stored bytes of a file. The id is a file id or PUBLIC_KEY+LABEL for a labelled file. If the query has a transform parameter the request is redirected (301) to the matching /images/get URL. Every file is sent with X-Content-Type-Options: nosniff. HTML, XHTML, SVG, XML and JavaScript files are also sent with Content-Security-Policy: sandbox; default-src 'none' (inline styles and data: images allowed), so they display but never run scripts.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206.
*/*
206The requested byte range.
*/*
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
HEAD/files/get/{id}

Check a file

Same as the GET, without the body: the size is in Content-Length (or, for a Range, the range's, with Content-Range). The file is not read from storage.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206. Headers only.
206The requested byte range. Headers only.
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
GET/files/get/{id}/{filename}

Get a file under a chosen file name

Returns the stored bytes of a file. The id is a file id or PUBLIC_KEY+LABEL for a labelled file. If the query has a transform parameter the request is redirected (301) to the matching /images/get URL. Every file is sent with X-Content-Type-Options: nosniff. HTML, XHTML, SVG, XML and JavaScript files are also sent with Content-Security-Policy: sandbox; default-src 'none' (inline styles and data: images allowed), so they display but never run scripts.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
filename *pathstringFile name to serve the file as. If it has no extension, one is added from the file's type.
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206.
*/*
206The requested byte range.
*/*
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
HEAD/files/get/{id}/{filename}

Check a file under a chosen file name

Same as the GET, without the body: the size is in Content-Length (or, for a Range, the range's, with Content-Range). The file is not read from storage.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
filename *pathstringFile name to serve the file as. If it has no extension, one is added from the file's type.
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206. Headers only.
206The requested byte range. Headers only.
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
GET/files/{id}DEPRECATED

Get a file

Legacy alias of /files/get/{id}. Returns the stored bytes of a file. The id is a file id or PUBLIC_KEY+LABEL for a labelled file. If the query has a transform parameter the request is redirected (301) to the matching /images/get URL. Every file is sent with X-Content-Type-Options: nosniff. HTML, XHTML, SVG, XML and JavaScript files are also sent with Content-Security-Policy: sandbox; default-src 'none' (inline styles and data: images allowed), so they display but never run scripts.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206.
*/*
206The requested byte range.
*/*
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
HEAD/files/{id}DEPRECATED

Check a file

Same as the GET, without the body: the size is in Content-Length (or, for a Range, the range's, with Content-Range). The file is not read from storage.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
downloadquerystringAdd ?download to send the file as an attachment so browsers save it. download=false turns it off.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's bytes, streamed from storage. Content-Type is the stored type. Supports Range requests: a single range (to resume a download or seek) gets 206. Headers only.
206The requested byte range. Headers only.
301A transform query was given. Follow the redirect to /images/get/{id}.
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
409Only for an app with holdDownloadsUntilScanned on: file_scan_pending, the file is still being scanned (try again shortly), file_scan_failed, it could not be scanned, or file_not_scanned, it was skipped (larger than the scan limit, or uploaded while scanning was off).
application/json
416The Range holds no bytes of the file (it starts past the end, or is empty). Content-Range gives the file's size, as bytes */SIZE. A Range sent with an If-Range that doesn't name the file's current ETag is ignored and the whole file sent instead.
429delivery_limit_reached: the app is on Free and has served 150% of its monthly delivery allowance, so its files and images are not served until the month ends at midnight UTC. Retry-After is the seconds until then, and beside error and message the body has resetsAt and upgradeUrl. Paid plans are never cut off, and the dashboard's own reads always work. See /docs/delivery/cdn.
application/json
502The file could not be read from storage.
text/plain
GET/files/data/{id}

Get a file's details

Name, type, size, hash and metadata of a file. The id is a file id or PUBLIC_KEY+LABEL.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's details.
application/json
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
GET/files/{id}/dataDEPRECATED

Get a file's details (legacy path)

Legacy alias of /files/data/{id}.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstringA file id (UUID), or PUBLIC_KEY+LABEL to address a labelled file.
e.g. 2a860257-ecf9-424a-846e-00ab68e2fd58
e.g. YOUR_PUBLIC_KEY+logo
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The file's details.
application/json
400The id is not a valid file id or label.
text/plain
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404No file with that id or label.
text/plain
GET/files/{id}/share

Get a file's share page

The data behind a file's share page, https://fileboy.io/f/{id}: its name, type and size, and the URLs the page shows and downloads from. The page is off unless you turn it on (sharePage on updateFile, or the dashboard), and Fileboy's own files (image copies, the parts of a video) never have one: both are 404 share_page_not_found. It follows the file's read access. A public file of a public app opens for anyone. A file that needs a signature (its read permission is authenticated, or the app requires signed reads) needs a signed share link: sign the page URL (https://fileboy.io/f/{id}, scope share) and the page passes fb_exp, fb_sig and fb_ip on to this route. Without one the answer is 401 signature_required, whether or not the page is on. The URLs in the answer are then signed with the link's own expiry and address range. A signature for the file itself does not open the page, and the page's signature does not read the file. Only file ids are accepted, not labels. Answers are kept by the browser for at most 60 seconds, so turning a page off reaches everyone within a minute.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)A file id. Labels are not accepted.
fb_expqueryinteger (int64)Unix time in seconds after which a signed URL stops working (30 seconds of leeway for clock differences). Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated).
fb_sigquerystringThe signature of a signed URL. Only used for reads that need a signature (apps that require signed reads, files whose read permission is authenticated), ignored otherwise.
fb_ipquerystringAn IP address or CIDR range the request must come from. Part of the signature, so it cannot be added or removed afterwards.
fb_keyquerystringFor a URL signed with a scoped key or a personal access token: its prefix (fbk_ or fbp_ and 12 characters). fb_sig is then keyed with its signing key, the hex HMAC-SHA256 of fileboy-url-signing-v1 keyed with the whole key. Accepted only while it works, only with files:read (files, images, file data, share pages) or videos:read (videos, downloads, playlists), and for a token only while its owner is a member of the app that owns what is signed.

Responses

200The share page's data.
application/json
400The id is not a file id.
application/json
401The app requires signed reads, or the file's read permission is authenticated, and the request has no signature. In an app that requires signed reads the same answer is given whether or not the file exists.
application/json
403The signature is wrong (signature_invalid: tampered, for another file, transform or filename, or made with another key), has expired (signature_expired) or the request comes from an address the URL is not valid for (ip_not_allowed).
application/json
404share_page_not_found: no such file, its page is off, or it is one of Fileboy's own files.
application/json