Files and uploads
Give a job a public URL, or upload a file and use its file id.
Inputs are either a public http or https URL, or the id of a file you uploaded. Use them anywhere an input is expected: the input field of a tool or a value in input_files for Run FFmpeg.
Using a URL
We download the URL when the job starts, and follow redirects. The URL must be public: localhost, .local and .internal hosts, private IP ranges, and our own API host are refused with status 400.
The input can be as large as your plan allows. A larger file fails the job with Input is larger than your plan allows. A download that fails ends the job with Couldn't download <url>: .... Neither of these is charged.
Uploading a file
POST /v1/files takes the raw bytes as the request body. It needs a Content-Length, which curl --data-binary sends for you. Name the file with ?name= so its extension reaches FFmpeg.
curl "https://api.mediatofu.com/v1/files?name=clip.mov" \
-H "Authorization: Bearer $MEDIATOFU_API_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @clip.movThe response has status 201. The id and size below are examples.
{
"file_id": "file_0123456789abcdef01234567.mov",
"size": 67108864
}Then use the id as an input:
{ "input": "file_0123456789abcdef01234567.mov" }The upload limit is on Plans and limits, and is lower than the limit for URLs on most plans. For larger files, use a URL.
In ?name=, characters other than letters, digits, ., _ and - are replaced by _, and the name is cut to 100 characters. If you leave it out the file has no extension, and FFmpeg works out the format from the content.
A file id only works for the account that uploaded it. If a file id can't be found, the job fails with File <id> not found, or it has expired. Don't rely on uploads staying around: upload again if you see this.
Upload errors
| Status | Error |
|---|---|
| 411 | Send the file as the raw body, with a Content-Length. |
| 413 | Uploads are limited to <n> MB on your plan. |