Documentation

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

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

Labels API reference

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

Labels are names that point at one file. Create, rename, point and group them, read every change in their history and roll back, and schedule swaps to another file at a set time. Needs your private key.

GET/labels

List labels

Your app's labels, by name. A label is a name that points at one file, so you can use PUBLIC_KEY+LABEL in place of a file id. group lists one group's labels, or none the labels in no group.

Authorization: public key or signed token

Parameters

NameInTypeDescription
groupquerystringA label group id, or none.
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

200All labels.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
POST/labels

Create a label

Label names are 1 to 100 characters with no spaces and none of - + / \ ? # % &. Optionally point it at a file straight away, which sends a file.updated webhook for that file. Answers 409 if the name is taken.

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
name *string
fileIdstring | null
groupIdstring | null

Responses

201The new label.
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
404fileId is not one of your files, or groupId one of your groups.
application/json
409An error. error is a short code and message says what went wrong.
application/json
PATCH/labels/{name}

Update a label

Rename the label, point it at another file (fileId, or null for none) and move it to a group (groupId, or null for none). Send any of the three. Each change is recorded in the label's history. A rename or a new file sends file.updated webhooks for the files it touches. {name} is the label's name or id.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its 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
fileIdstring | null
groupIdstring | null

Responses

200The label.
application/json
400invalid_label, validation_error or empty_update.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
404label_not_found, file_not_found or label_group_not_found.
application/json
409label_taken: another label has that name.
application/json
DELETE/labels/{name}

Delete a label

Removes the label, not the file it points at. The file loses the label, which sends a file.updated webhook. The deletion is the last entry in the app's label history (GET /label-history). {name} is the label's name or id. 404 if there is no such label.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its 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

204Deleted.
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
GET/labels/{name}/history

A label's history

Every change to the label, newest first: created, file_changed, renamed, rolled_back and swap_applied, with who made it (someone in the dashboard, the API, or a scheduled swap) and the file it pointed at after. Changes are recorded from when label history was added. Moving a label to another group is not recorded: groups never change what a label serves.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its id.
limitqueryinteger
cursorquerystringnextCursor from the previous page.
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

200A page of history, newest first.
application/json
400invalid_parameter or invalid_cursor.
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
POST/labels/{name}/rollback

Roll a label back

Point the label back at the file it pointed at after one of its history entries. Refused with 409 file_deleted when that file has been deleted, and nothing_to_roll_back_to when the label had no file then. Rolling back to the file it has already changes nothing.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its 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
historyId *string (uuid)

Responses

200The label, pointing at the file again.
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
404label_not_found or history_entry_not_found.
application/json
409file_deleted or nothing_to_roll_back_to.
application/json
GET/labels/{name}/swaps

A label's scheduled swaps

Pending swaps soonest first, then finished ones newest first.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its id.
statusquery"pending" | "applied" | "failed" | "cancelled"
limitqueryinteger
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

200Scheduled swaps.
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
POST/labels/{name}/swaps

Schedule a label swap

Point the label at a file at a time you choose, up to a year ahead. Swaps are applied within about 30 seconds of their time, and appear in the label's history as swap_applied. If the file is deleted before then, the swap is marked failed with failureReason file_deleted and the label keeps its file. A label can have 50 swaps waiting.

Authorization: public key or signed token

Parameters

NameInTypeDescription
name *pathstringThe label's name, or its 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
fileId *string (uuid)
runAt *string (date-time)RFC 3339, in the future.

Responses

201The scheduled swap.
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
404label_not_found or file_not_found.
application/json
409too_many_swaps.
application/json
GET/label-history

Every label's history

Every change to every label of the app, newest first, including labels that have since been deleted (their entries have a null labelId).

Authorization: public key or signed token

Parameters

NameInTypeDescription
limitqueryinteger
cursorquerystringnextCursor from the previous page.
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

200A page of history, newest first.
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
GET/label-swaps

List scheduled swaps

Every label's swaps: pending ones soonest first, then finished ones newest first.

Authorization: public key or signed token

Parameters

NameInTypeDescription
statusquery"pending" | "applied" | "failed" | "cancelled"
limitqueryinteger
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

200Scheduled swaps.
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
POST/label-swaps/{id}/cancel

Cancel a scheduled swap

Only a pending swap can be cancelled: 409 swap_not_pending otherwise.

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 cancelled swap.
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
GET/label-groups

List label groups

Your app's label groups, by name, with how many labels each has.

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.

Responses

200All groups.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
POST/label-groups

Create a label group

Group names are 1 to 100 characters and unique in the app, whatever their case. An app can have 200 groups. Put labels in it with groupId on POST /labels or PATCH /labels/{name}.

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
name *string

Responses

201The new group.
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
409label_group_taken or too_many_label_groups.
application/json
PATCH/label-groups/{id}

Rename a label group

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
name *string

Responses

200The group.
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/label-groups/{id}

Delete a label group

The labels in it are kept, in no group.

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

204Deleted.
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