Upload a media file using multipart form data.
Authorization
Send your API key in the Authorization header. It is under Settings → Developers → Public API in Ferra.
Body
filestringrequiredThe file to upload
adjust"true" | "false"Adjust the file to the platforms' limits after the upload: videos are scaled to a 1080 px short side (long side at most 1920 px) and re-encoded to H.264 MP4 with AAC audio, images larger than that are scaled down. Runs in the background, poll GET /media/{id}/status for the result. Defaults to false.
Request
curl -X POST 'https://tryferra.co/api/public/v1/upload' \
-H 'Authorization: your-api-key' \
-H 'Content-Type: application/json' \
-d '{
"file": "string",
"adjust": "true"
}'Responses
200File uploaded successfully
{
"id": "e639003b-f727-4a1e-87bd-74a2c48ae41e",
"name": "image.png",
"path": "https://tryferra.co/uploads/image.png",
"organizationId": "85460a39-6329-4cf4-a252-187ce89a3480",
"createdAt": "2024-12-14T08:18:54.274Z",
"updatedAt": "2024-12-14T08:18:54.274Z"
}Upload a media file by multipart form. Returns an id and path you can pass into a post's image array.
Accepted MIME types
The backend inspects the file's actual content (not just the extension) and rejects anything outside this allowlist:
| Type | MIME |
|---|---|
| JPEG | image/jpeg |
| PNG | image/png |
| GIF | image/gif |
| WebP | image/webp |
| AVIF | image/avif |
| BMP | image/bmp |
| TIFF | image/tiff |
| MP4 video | video/mp4 |
PDFs are not accepted. See Uploads troubleshooting for limits and recommended video formats.
Example
curl -X POST "https://tryferra.co/api/public/v1/upload" \
-H "Authorization: your-api-key" \
-F "file=@photo.jpg"
Example response:
{
"id": "01HXYZ123ABCDEF",
"path": "https://tryferra.co/uploads/photo.jpg",
"status": "ready"
}
Adjusting media to platform limits
Platforms reject media that is too large, too small or in an encoding they don't accept. Send the optional adjust field as true to adjust the file after the upload. It defaults to false, which stores the file as uploaded.
- Videos get their short side scaled to 1080 px, up or down, with the long side at most 1920 px. They are re-encoded to H.264 MP4 (yuv420p, at most 60 fps) with AAC audio (128 kbps, 48 kHz) and the metadata moved to the start of the file for streaming.
- Images are only scaled down, to a short side of at most 1080 px and a long side of at most 1920 px, and keep their format.
- GIF, AVIF, BMP and TIFF files are stored as uploaded.
curl -X POST "https://tryferra.co/api/public/v1/upload" \
-H "Authorization: your-api-key" \
-F "adjust=true" \
-F "file=@video.mp4"
The adjustment runs in the background, so the response comes back with "status": "processing". The adjusted file replaces the original at the same path, usually within seconds. Poll Media Status every few seconds and wait until the status is ready before publishing a post with this path: a post published while it is processing uses the original, unadjusted file. Without adjust the upload is synchronous and the path is ready immediately.
If the adjustment fails, the original file is kept and used for publishing, and Media Status returns "status": "ready" with a warning.
Usage in a post
{
"image": [
{
"id": "01HXYZ123ABCDEF",
"path": "https://tryferra.co/uploads/photo.jpg"
}
]
}