API reference
Media
Upload images and videos for posts: direct uploads with a presigned URL, or a single multipart request for small files.
Walkthrough and complete code: Upload media.
Start an upload
/v1/media/uploadsReserves space for one file and returns a URL to PUT it to, valid for one hour.
- Auth
- API key
x-api-key - Rate limit
- 30/minute; 200 uploads per 24 hours; 10 GB stored
Then PUT the bytes to uploadUrl with exactly the returned headers and no API key, and call complete.
Parameters
contentTyperequiredbody · stringimage/jpeg,image/png,image/gif,image/webp,video/mp4,video/quicktimesizeBytesrequiredbody · integerExact file size. Images up to 10 MB, videos up to 1 GB.
Example request
curl -X POST "https://api.flenvio.com/v1/media/uploads" \
-H "x-api-key: $FLENVIO_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"contentType": "image/jpeg",
"sizeBytes": 482113
}'Response 201
{
"assetId": "a55e7000-0000-4000-8000-000000000001",
"uploadUrl": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Amz-Signature=…",
"method": "PUT",
"headers": {
"Content-Type": "image/jpeg"
}
}Errors
| Status | When |
|---|---|
400 | Unsupported type, daily upload limit or storage limit reached. |
403 | This account is being deleted. |
413 | File larger than the limit for its type. |
401 | Missing, invalid, revoked or expired API key. |
429 | Too many requests to this endpoint; wait Retry-After seconds. |
403 | code: "api_key_read_only": the API key is read-only, and this request changes something. |
Complete an upload
/v1/media/uploads/{id}/completeChecks the stored file against what you declared and makes it attachable. Returns the url to use in posts. Safe to repeat.
- Auth
- API key
x-api-key - Rate limit
- 120/minute
Parameters
idrequiredpath · string (UUID)The
assetIdfrom starting the upload.
Example request
curl -X POST "https://api.flenvio.com/v1/media/uploads/a55e7000-0000-4000-8000-000000000001/complete" \
-H "x-api-key: $FLENVIO_API_KEY"Response 200
meta has kind, and when readable width, height, durationSec (videos) and format.
{
"id": "a55e7000-0000-4000-8000-000000000001",
"url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg",
"key": "uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg",
"meta": {
"kind": "image",
"width": 1080,
"height": 1350,
"format": "jpeg"
}
}Errors
| Status | When |
|---|---|
400 | The file has not been uploaded yet., the file doesn’t match what was declared (it is deleted), This upload expired. Upload the file again., or the id isn’t a UUID. |
404 | Upload not found. |
401 | Missing, invalid, revoked or expired API key. |
429 | Too many requests to this endpoint; wait Retry-After seconds. |
403 | code: "api_key_read_only": the API key is read-only, and this request changes something. |
Upload a small file
/v1/media/uploadOne-step upload for files up to 10 MB, as multipart/form-data with a file field. The type is detected from the content.
- Auth
- API key
x-api-key - Rate limit
- 30/minute (shared limits as above)
Parameters
filerequiredbody · fileThe image or video.
Example request
curl -X POST "https://api.flenvio.com/v1/media/upload" \
-H "x-api-key: $FLENVIO_API_KEY" \
-F '[email protected];type=image/jpeg'Response 201
{
"id": "a55e7000-0000-4000-8000-000000000001",
"url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg",
"key": "uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg",
"meta": {
"kind": "image",
"width": 1080,
"height": 1350,
"format": "jpeg"
}
}Errors
| Status | When |
|---|---|
400 | Unsupported type, or limits reached. |
413 | Larger than 10 MB. |
401 | Missing, invalid, revoked or expired API key. |
429 | Too many requests to this endpoint; wait Retry-After seconds. |
403 | code: "api_key_read_only": the API key is read-only, and this request changes something. |