Documentation

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

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

Folders API reference

The folders 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

Organise your files in nested folders, from your server. Folders are never part of a file's URL, so renaming or moving one changes no links. Files with no folder are at the root. Needs your private key.

POST/files/move

Move files to a folder

Puts up to 100 files in one folder, or at the root with folderId: null. folderPath creates any missing folders on the path. Ids that are unknown or belong to another app are listed in notFound, so the request can be repeated safely. Moving never changes a file's URL. Sends one file.updated webhook for each file that changes folder; a file already in the folder sends none.

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
ids *string (uuid)[]
folderIdstring | nullThe folder, or null for the root.
folderPathstringThe folder's path, like /products/shoes. / is the root.

Responses

200What happened to each id.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404The folder does not exist.
application/json
GET/folders

List folders

Your app's folders, by name. With parentId only the folders directly inside one folder (root for the top level), otherwise every folder. path looks up one folder by its path and returns it, or an empty list.

Authorization: public key or signed token

Parameters

NameInTypeDescription
limitqueryintegerPage size, 1 to 100.
cursorquerystringThe nextCursor of the previous page. Use it with the same filters and sort. Paging is stable: files added or deleted while you page are never skipped or repeated.
sortquery"name" | "createdAt"
orderquery"asc" | "desc"Defaults to desc, except for sort=name which defaults to asc.
parentIdquerystring (uuid) | stringOnly the folders directly inside this folder, or root for the top level.
namequerystringOnly folders whose name contains this text, ignoring case.
pathquerystringFind the folder at this path, like /products/shoes, ignoring case.
maxFileCountqueryintegerCount each folder's files no further than this: a folder with more has fileCount one past it, so maxFileCount=100 gives 101 for "more than 100". Quicker when folders hold many files. Without it every file is counted, and the folder found by path is always counted exactly.
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

200One page of folders.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404parentId is not one of your folders.
application/json
POST/folders

Create a folder

Send a name, and a parentId to make it inside another folder: 201, or 409 folder_exists if that folder already has one of the same name, ignoring case. Or send a path to make every missing folder on it, like mkdir -p: 201 if anything was made, 200 if it all existed. Names are 1 to 255 characters with no / or \, and cannot be . or ... Folders nest up to 20 deep and an app can have up to 10,000.

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
namestring
parentIdstring | null
pathstring

Responses

200Every folder on path already existed. The last one.
application/json
201The new folder (with path, the last folder on it).
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403No private key, or folder_limit_reached.
application/json
404parentId is not one of your folders.
application/json
409An error. error is a short code and message says what went wrong.
application/json
GET/folders/{id}

Get a folder

One folder, with the folders above it in ancestors for breadcrumbs.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)A folder id.
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 folder.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404An error. error is a short code and message says what went wrong.
application/json
PATCH/folders/{id}

Rename or move a folder

Send name to rename it and parentId to move it, with what is inside, into another folder (null for the root). A folder cannot move into itself or one of its subfolders (400 invalid_move), and the destination cannot already have a folder of the same name (409 folder_exists). No file URLs change.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)A folder id.
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
namestring
parentIdstring | null

Responses

200The folder as it is now.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404An error. error is a short code and message says what went wrong.
application/json
409An error. error is a short code and message says what went wrong.
application/json
DELETE/folders/{id}

Delete a folder

contents says what happens to what is inside. refuse (the default) only deletes an empty folder and answers 409 folder_not_empty otherwise. moveToParent moves its files and subfolders up into its parent (the root for a top-level folder), with a file.updated webhook for each file, and answers 409 folder_exists if a subfolder's name is taken there. delete deletes its subfolders and every file in them, stored data included, with a file.deleted webhook for each: up to 1000 files, more is 409 folder_too_large. If storage cannot be reached, the files already deleted stay deleted, the folder is kept and the request can be repeated. On a plan that keeps deleted files (retentionDays above 0), refuse and delete put the folder, its subfolders and its files in the trash instead (file.deleted is still sent for each file), where POST /folders/{id}/restore brings them all back as they were. moveToParent deletes only the folder, at once.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)A folder id.
contentsquery"refuse" | "moveToParent" | "delete"
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

200What was deleted and moved.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404An error. error is a short code and message says what went wrong.
application/json
409An 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