HTTP API
The file service the CLI, the connector and the server on your machine call. Trade an API token for a session, then call it with that.
- Base URL
- fffs.freakingfast.io
- Requests
- POST, JSON
- Spec
- OpenAPI 3.1
Authenticate#
An API token doesn't call the file service itself. Trade it at /exchange-token for a session token, and send that as the bearer token, along with X-Absurd-App: fffd.
curl -X POST https://auth.freakingfast.io/exchange-token \
-H "Authorization: Bearer $FREAKING_FAST_API_TOKEN"{
"gelToken": "eyJhbGciOiJIUzI1NiIs…",
"expiresIn": 86400,
"userId": "73ad9b0e-7227-11ef-9399-bfdd82c9e268"
}The session lasts a day, as expiresIn says in seconds. Trade the token again before it runs out. Keep userId: new files go under users/{userId}/.
curl -X POST https://fffs.freakingfast.io/search-files \
-H "Authorization: Bearer $SESSION" \
-H "X-Absurd-App: fffd" \
-H "Content-Type: application/json" \
-d '{ "text": "harbor", "type": "Video" }'Upload a file#
Files go straight to storage on a signed form, so an upload never passes through the API.
Ask for a form
POST/generate-file-urls
- typestringrequired
- The kind of file, like
Video,AudioorImage. - fileNamestringrequired
- The name it shows under.
- fileSizeintegerrequired
- Its exact size in bytes, up to 2 TB.
- objectKeystringrequired
- Where it is stored:
users/{userId}/… - mimeTypestring
- Its content type.
You get an
uploadUrland anuploadForm. The form lasts 2 days.Send the file
POST the file to
uploadUrlasmultipart/form-data, with everyuploadFormfield before it, unchanged.Record it
POST/insert-file
Send the same fields with
isPublic: falseandcreator: { id: userId }. The service reads the stored size back, and turns the file down if it differs fromfileSize. You get the new file'sid.
Large files#
Above 64 MiB, send a file in parts instead, many at once. If an upload stops, start it again with the same objectKey and only the missing parts go up.
| Call | Does |
|---|---|
/create-multipart-upload | Opens the upload, or picks up the one already open under that key. |
/sign-upload-parts | Gives an upload URL for each part you ask for. |
/complete-multipart-upload | Joins the parts into the file. |
/insert-file | Records it, as for any upload. |
Share and download#
/generate-download-url gives a link to any of your files that lasts 6 hours. /toggle-file-access makes a file public, and its link then stays up for good, played from the closest region.
Work on files#
A job works on your files where they're stored, so nothing is downloaded to do it. Name its type, the files in order, each once, and its settings. What it makes lands as new files beside the first one (a folder's zip beside the folder), or in the folder you name, never over them.
curl -X POST https://fffs.freakingfast.io/create-file-job \
-H "Authorization: Bearer $SESSION" \
-H "X-Absurd-App: fffd" \
-H "Content-Type: application/json" \
-d '{ "jobType": "cut", "fileIds": ["4f7c…"], "options": { "start": "1:20", "end": "2:05" } }'It waits its turn, usually starting within half a minute when nothing's ahead of it. Ask /select-file-jobs how it's going, or watch /select-drive-events for its job event. Jobs count against your plan by the time they take: 1 hour a month on Intro, 4 hours a month on Basic, 15 hours a month on Pro. One that fails costs nothing, and /cancel-file-job stops one, keeping what it made. Send dryRun: true to check its settings and how long it should take without starting it.
| Type | Takes | Settings |
|---|---|---|
cut | A video or audio | Settingsstart, end; exact for a frame-exact start; fadeIn, fadeOut for audio |
proxy | Videos | Settingsheight: 720 or 1080 |
convert | Videos, audio or pictures | Settingsformat; codec h264 or hevc for video; maxEdge for pictures |
shrink | A video | SettingstargetMB |
reframe | Videos | Settingsaspect 9:16, 1:1, 4:5 or 16:9; rotate 90, 180 or 270 |
gif | A video | Settingsstart, length up to 15 seconds, width, fps |
burnIn | A video | Settingstimecode, captions, text |
join | 2 to 50 videos, or audio | Settingsformat, for audio |
stills | A video | Settingsat, a list of moments, or every so many seconds |
contactSheet | A video, or pictures | Settingscount for a video; columns |
extractAudio | Videos | Settingsformat: mp3, m4a, wav or flac |
loudness | Videos or audio | Settingstarget: −14, −16 or −23 LUFS |
split | An audio file | Settingssilence in seconds, threshold in dB |
stripMetadata | Pictures, videos or audio | Settings– |
watermark | Pictures | Settingstext, position, opacity |
makePdf | Pictures | SettingspageSize fit, a4 or letter; name |
mergePdf | 2 to 50 PDFs | Settingsname |
splitPdf | A PDF | Settingsevery so many pages |
extractPages | A PDF | Settingspages, like 1-3,7 |
compressPdf | PDFs | Settingsquality: screen, ebook or printer |
pdfToImages | A PDF | Settingsformat jpg or png; dpi; pages |
zip | Files, or a folder | Settingsname |
unzip | A .zip | Settings– |
captions | Videos or audio, read first | Settingsformat: srt, vtt or txt |
checksum | Any files | Settingsalgorithm: sha256 or md5 |
Times are seconds, or a clock like 4:10. The OpenAPI spec has each setting's range.
Endpoints#
Every route is a POST to https://fffs.freakingfast.io with a JSON body. The OpenAPI spec has the full request and response for each.
Upload#
| Route | Does |
|---|---|
/generate-file-urls | A signed form to upload a new file with. |
/insert-file | Record an uploaded file on the account. |
/create-multipart-upload | Start an upload in parts, or resume the one open under this key. |
/sign-upload-parts | Upload URLs for parts of an open upload. |
/complete-multipart-upload | Join the parts into the finished file. |
/abort-multipart-upload | Throw away an open upload and its parts. |
/import-from-url | Bring in a file from a link, fetched by the service. |
Find and read#
| Route | Does |
|---|---|
/select-user-files | Every file you made. |
/search-files | Find files by words, type, tag, folder, date, length, size, tempo, key or place, and folders by name. |
/read-file | What is in a file, for a model: an image, a frame, a PDF’s or text file’s text. |
/generate-download-url | A link to a file that lasts 6 hours. |
/get-user-storage-usage | Bytes and files by bucket and kind. |
Organize#
| Route | Does |
|---|---|
/tag-files | Tag files by name, making new tags as needed. |
/update-file-tags | Add one tag to files, or take it off. |
/move-files | Put files in a folder, by path or id. |
/update-file-description | Set a file’s description. |
/toggle-file-access | Make a file public or private. |
/select-collections | Your folders, playlists, galleries and tags. |
Playlists and galleries#
| Route | Does |
|---|---|
/create-playlist | A playlist of audio and video, in order. |
/add-to-playlist | Add to the end of a playlist. |
/reorder-playlist | Put a playlist in a new order. |
/create-gallery | A gallery of images, in order. |
/add-to-gallery | Add to the end of a gallery. |
/reorder-gallery | Put a gallery in a new order, and choose what goes up front. |
/set-cover | Put an image on a track or playlist as its art. |
/set-video-thumbnail | Set a video’s poster from a frame or an image. |
/create-archive-request | A ZIP of files, a gallery or a playlist. |
Requests and reviews#
| Route | Does |
|---|---|
/create-file-request | A link anyone can send files to. |
/select-file-requests | Your requests, and what arrived on each. |
/set-file-request-open | Close a request, or open it again. |
/create-file-review | A link to watch a video or track and leave notes on it. |
/select-file-reviews | Your reviews, each with its notes as an edit list. |
/reply-to-review-note | Answer a note. |
/set-review-note-resolved | Mark a note dealt with, or not. |
Activity#
| Route | Does |
|---|---|
/select-file-views | How often other people opened your files, and who. |
/select-drive-events | What happened in your drive after a point, oldest first. |
Images#
| Route | Does |
|---|---|
/generate-image | Start an image from a prompt, on your plan. |
/select-generations | How your generations are going, and what they made. |
Jobs#
| Route | Does |
|---|---|
/create-file-job | Work on files where they are stored: cut, convert, zip and the rest. |
/select-file-jobs | Your jobs, newest first, with how far each has got and what it made. |
/cancel-file-job | Stop a job, keeping what it already made. |
Trash#
| Route | Does |
|---|---|
/trash-files | Move files to the trash. |
/restore-files | Bring files back. |
/select-trashed-files | What is in the trash. |
/purge-trashed-files | Empty the trash, for good. |
/delete-files | Delete files and what is stored for them, for good. |
Errors#
Errors come back with a sentence for people and a code for code. retryable says whether trying again could work, which the status alone doesn't tell you.
{
"error": "A fileSize is required",
"code": "missing_field",
"field": "fileSize",
"retryable": false
}| Status | Means |
|---|---|
| 400 | Something in the request is missing or wrong. field names it. |
| 401 | No session, or one that has expired. Trade the token again. |
| 403 | Signed in, but not allowed, or the account has no plan. |
| 404 | Nothing of yours has that id. |
| 500 | Something went wrong on our side. retryable is true. |