File Management
Manage your inputs and outputs using directories and presigned uploads.
Create a directory (optional)
POST https://api.ffmpeg-api.com/directory
Authorization: Basic <YOUR_API_KEY>
Content-Type: application/json
{}
Response:
{ "ok": true, "directory": { "id": "dir_123", "ttl": 86400 } }
Create a file (optionally in a directory) and get an upload URL
POST https://api.ffmpeg-api.com/file
Authorization: Basic <YOUR_API_KEY>
Content-Type: application/json
{
"file_name": "input.mp4",
"dir_id": "dir_123" // optional; if omitted, a temp dir is created
}
Response (abridged):
{
"ok": true,
"file": {
"dir_id": "dir_123",
"file_path": "dir_123/input.mp4",
"file_name": "input.mp4",
"added_on": "2024-01-01T00:00:00Z"
},
"upload": {
"url": "https://...",
"method": "PUT",
"headers": {},
"expiresInSeconds": 3600
}
}
ℹ️
File names are case-sensitive and must be unique within a directory. The upload URL expires after ~5 minutes.
Upload the file to the upload URL
curl -X PUT "$UPLOAD_URL" --data-binary @./input.mp4 -H "Content-Type: video/mp4"
await fetch(upload.url, { method: 'PUT', body: fs.readFileSync('./input.mp4') })
requests.put(upload_url, data=open('input.mp4', 'rb'))
List your directories
GET https://api.ffmpeg-api.com/directory
Authorization: Basic <YOUR_API_KEY>
Response:
{ "ok": true, "directories": [ { "id": "dir_123", "ttl": 86400, "added_on": "2024-01-01" } ] }
List files in a directory
GET https://api.ffmpeg-api.com/directory/{dirId}
Authorization: Basic <YOUR_API_KEY>
Response:
{ "ok": true, "files": [ { "file_name": "input.mp4", "added_on": "2024-01-01" } ] }
Tips
- Use one directory per workflow (inputs and resulting outputs live together).
- Reuse uploaded files across multiple processing runs.
- Clean up: temporary directories expire automatically based on TTL.