Documentation

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

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

Access requests API reference

The access requests 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

Asking to watch a private video: a signed-in Fileboy person asks, you approve or deny, and an approval lets that one person watch that one video until you revoke it. Asking needs a viewer session and no key; approving, denying, revoking, blocking and the settings need your private key.

GET/videos/{id}/access

See whether a viewer can ask for access to a video

What a watch page asks to know when a private video won't play: whether the video takes requests (requests), whether the viewer is signed in (signedIn), what became of their request (request.status: pending, approved or denied, which is also what a revoked or blocked person is told) and, once they are approved for a private video, an access grant. The viewer is named by the X-Fileboy-Viewer-Session header, a short-lived token the website server makes for a signed-in Fileboy person (POST /api/account/viewer-session). Without it signedIn is false. Put the grant's query (fb_access=...) on every request for the video, as <fileboy-player signed-query>. It opens that one video for that one person until it expires (four hours) and stops at once, on the next request, when the owner revokes the access or blocks the person (403 access_revoked). It never opens the video's original file. Needs no key. Answers Cache-Control: no-store.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's id.
X-Fileboy-Viewer-SessionheaderstringA signed-in viewer's session token.

Responses

200What the viewer can do.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401sign_in_required: the viewer session is not valid.
application/json
404An error. error is a short code and message says what went wrong.
application/json
POST/videos/{id}/access-requests

Ask to watch a private video

A signed-in Fileboy person asks the video's owner to let them watch. Only a Fileboy account can ask, so there is no anonymous or by-email request. The owner is shown the account's email address and whether it is verified (requester.emailVerified: the person used a link Fileboy emailed to it). Unverified accounts can still ask. The optional message is plain text of up to 500 characters, and any links in it are removed. One request per person and video: asking again while waiting is 409 already_requested, and after the owner denied or revoked it 409 request_declined until a week has passed. 409 video_not_private for a video that isn't private, and 403 requests_off when the owner turned requests off. A person the owner blocked is answered 409 request_declined, like someone who was denied, so they are not told it is a block. Limits per hour: 10 requests per person, 30 per video, 100 per app and 30 per address (429 rate_limited with Retry-After), and a video holds at most 200 waiting requests (429 inbox_full). The app's members are emailed with Approve and Deny buttons, the dashboard lists the request and a video.access_requested webhook is sent. Needs the X-Fileboy-Viewer-Session header and no key.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's id.
X-Fileboy-Viewer-Session *headerstringA signed-in viewer's session token.

Request body

application/json
messagestring

Responses

201The request was made and the owner has been told.
application/json
400An error. error is a short code and message says what went wrong.
application/json
401sign_in_required.
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
429rate_limited or inbox_full.
application/json
GET/access-requests

List requests for access

The app's requests, newest first, filtered by videoId and status (pending, approved, denied or revoked) and paged with cursor and limit. pendingCount is how many are waiting in the whole app. An approved request is the grant: that person can watch that video.

Authorization: public key or signed token

Parameters

NameInTypeDescription
videoIdquerystring (uuid)
statusquery"pending" | "approved" | "denied" | "revoked"
cursorquerystring
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

200A page of requests.
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/access-requests/{id}/approve

Approve a request

Lets that one person watch that one video until you revoke it. A waiting request, or one you denied or revoked before, can be approved; the person is emailed the video's link. 409 invalid_state for a request that is approved already, and 409 requester_blocked while the person is blocked. Recorded as video.access_approved.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The request's 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 approved request.
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
POST/access-requests/{id}/deny

Deny a request

For a waiting request. The person is told, in a short email that gives no reason, and can ask again after a week. 409 invalid_state for a request that isn't waiting. Recorded as video.access_denied.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The request's 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 denied request.
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
POST/access-requests/{id}/revoke

Revoke an approval

Ends the person's access to the video from the next request: a player that has the video open stops being served (403 access_revoked). They aren't emailed, and can ask again after a week. 409 invalid_state for a request that isn't approved. Recorded as video.access_revoked.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The request's 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 revoked request.
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/access-requests/settings

Get the app's default for requests

on unless you turned requests off for the app.

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

200The default.
application/json
401No key was sent.
application/json
403An error. error is a short code and message says what went wrong.
application/json
PATCH/access-requests/settings

Turn requests on or off for the app

Private videos offer "Request access" unless the app or the video turned it off, the video's own setting winning. Turning requests off never ends access you approved. Needs the app's own private key, not a scoped key. Recorded as app.access_requests_updated.

Authorization: public key or signed token

Request body

application/json
requests *"on" | "off"

Responses

200The new default.
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/videos/{id}/access-requests/settings

Get a video's setting for requests

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's 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 setting.
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/videos/{id}/access-requests/settings

Turn requests on or off for a video

app follows the app's default, on and off override it. Recorded as video.access_requests_updated.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's 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
requests *"app" | "on" | "off"

Responses

200The new setting.
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
GET/access-blocks

List blocked requesters

The people blocked from asking for access in the app, newest first (at most 1000).

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

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

Block a requester

The person can't ask for access to any video of the app, and everything they had ends at once: approved requests are revoked (with no email, like any revoke) and waiting ones denied (with the same short email as any denial, so they can't tell it was a block; ended says how many). 404 requester_not_found unless they have asked for a video of this app, so a block can't be used to find out who has an account. Blocking someone who is blocked answers 200. Recorded as viewer.access_blocked.

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
userId *string (uuid)
reasonstring

Responses

200The person was blocked already.
application/json
201The block.
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
DELETE/access-blocks/{userId}

Unblock a requester

They can ask again after a week. What ended when you blocked them stays ended until you approve it again. 404 block_not_found. Recorded as viewer.access_unblocked. Answers 204.

Authorization: public key or signed token

Parameters

NameInTypeDescription
userId *pathstring (uuid)The person's user id, as requester.userId of their request.
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

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