Documentation

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

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

Video analytics API reference

The video analytics 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

Views, unique viewers, watch time, the share watched, completions, call-to-action clicks and retention per video and day, counted by the Fileboy player. Reading them needs your private key (or videos:read); players report viewing with no key, under the video's own read access.

POST/videos/{id}/views

Report what a player played

What the Fileboy player (1.8.0+) sends for video analytics, for other players to send too. The body is JSON sent as text/plain (any type is accepted), so navigator.sendBeacon works and no CORS preflight is needed; at most 16 KB. seq counts up from 1 per session: a batch with a seq the session has already had is ignored, so resending is safe. watched is the whole seconds of the video played since the last batch, as [start, end) ranges. Unknown event types are ignored. A batch counts only when the request may read the video (the same fb_* parameters as its stream), the video is ready and version is the one it plays now. Every well-formed batch answers 204, counted or not, so this never says whether a video exists or is private. Rate limits: 240 a minute per address and 30 per session (429 rate_limited with Retry-After); past 6,000 a minute for one video, its batches are dropped (204). Requests from bots are dropped. No cookies are set, and the address and user agent aren't stored: unique viewers are counted by a hash of them with a salt made each day and deleted after two, kept with the sessions for 90 days. View tickets (player 1.9.0+): session and ticket come from analytics in GET /videos/{id}/data. A batch whose ticket isn't for this video and session is dropped (204); a ticket starts its session within two hours of being issued. Batches without a ticket are taken until 1 February 2027, with a lower limit on new sessions. A session starts when the server first hears of it (t is a hint, at most 30 s). At most 60 new sessions per address per video an hour, and 300 per address per app (each counted per API server); past 20,000 new sessions a video a day (100,000 an app), a session only adds to overflowPlays and watch time. Quality of experience (with qoe: 1): startup, rebuffers, rebuffered, errors and renditions are clamped, never refused.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's id.
fb_expquerystringA signed URL's expiry, for a private video (see ReadSignature).
fb_sigquerystringA signed URL's signature, for a private video.
fb_grantquerystringA password video's playback grant (POST /videos/{id}/unlock).
fb_linkquerystringA video link's token, for a video shared with an expiring link.

Request body

text/plain
session *stringThe session id from the view ticket (analytics.session in the video's data). Players before 1.9.0 make a random one.
ticketstringThe view ticket (analytics.ticket in the video's data).
seq *integer
version *integer
playednumberSeconds since the last batch.
watchedinteger[][]Whole seconds played, as [start, end) ranges.
eventsobject[]
tnumberSeconds since the session began. Only a hint: at most 30 s of it is used.
qoe"1"1 on every batch of a player that reports quality of experience.
startupnumberSeconds from pressing play to the first frame, once per session (at most 120 counts).
rebuffersintegerStalls while playing since the last batch (at most 100 count).
rebufferednumberSeconds of those stalls.
errorsobject[]
renditionsnumber[][][height, seconds played at it] since the last batch.
pagestringThe host of the page the player is on (player 1.17.0+); for Fileboy's embed page in an iframe, the site framing it. Ignored when the request's Origin is another site, which names the page instead. Host only.
refstringThe host of the page's referrer (player 1.17.0+). Host only.
viewerstringA signed-in viewer's session: the viewer-session of Fileboy's pages or a sign-in hand-off's (player 1.17.0+). Names the viewer in viewers of the video's analytics. One that doesn't check out is ignored and the batch counts anonymously.
viewerTokenstringThe app's viewer token for its signed-in user (see /docs/video/reactions-and-comments), instead of viewer (player 1.17.0+).

Responses

204Taken (or quietly dropped).
400An 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
429An error. error is a short code and message says what went wrong.
application/json
GET/videos/{id}/analytics

Get a video's analytics

Totals and one row per UTC day from from to to (both included, at most 366 days; days with nothing are zeroes), the retention curve of the version the video plays now, or of version, and the quality of experience (qoe: start-up time, rebuffering and errors, from players 1.9.0+). Without version, when the current version has no curve yet (a blur makes a new version, say), it is the newest version's that has one; retention.version says which. A view is a playback of at least 3 seconds (half the video under 6 seconds); a completion is 90% of the video watched; unique viewers are counted once a day. Figures are added about every 30 minutes, once a playback has stopped.

Authorization: public key or signed token

Parameters

NameInTypeDescription
id *pathstring (uuid)The video's id.
fromquerystring (date)The first UTC day, YYYY-MM-DD. Default: 29 days before to.
toquerystring (date)The last UTC day, YYYY-MM-DD. Default: today.
versionqueryintegerThe version whose retention curve to return. Default: the current one.
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 video's figures.
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/analytics/videos

Get your videos' analytics

Every video of the app together, per UTC day, and the top videos by a figure. Unique viewers count a person once a day across all the app's videos, and are null for a range reaching back more than 90 days.

Authorization: public key or signed token

Parameters

NameInTypeDescription
fromquerystring (date)The first UTC day, YYYY-MM-DD. Default: 29 days before to.
toquerystring (date)The last UTC day, YYYY-MM-DD. Default: today.
sortquery"views" | "watchSeconds" | "completions" | "ctaClicks"What the top videos are ranked by.
limitqueryintegerHow many top videos.
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 app's figures.
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