Skip to content

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

POST/v1/media/uploads

Reserves 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 · string

    image/jpeg, image/png, image/gif, image/webp, video/mp4, video/quicktime

  • sizeBytesrequiredbody · integer

    Exact 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

201 response
{
  "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

Start an upload errors
StatusWhen
400Unsupported type, daily upload limit or storage limit reached.
403This account is being deleted.
413File larger than the limit for its type.
401Missing, invalid, revoked or expired API key.
429Too many requests to this endpoint; wait Retry-After seconds.
403code: "api_key_read_only": the API key is read-only, and this request changes something.

Complete an upload

POST/v1/media/uploads/{id}/complete

Checks 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 assetId from 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.

200 response
{
  "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

Complete an upload errors
StatusWhen
400The 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.
404Upload not found.
401Missing, invalid, revoked or expired API key.
429Too many requests to this endpoint; wait Retry-After seconds.
403code: "api_key_read_only": the API key is read-only, and this request changes something.

Upload a small file

POST/v1/media/upload

One-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 · file

    The 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

201 response
{
  "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

Upload a small file errors
StatusWhen
400Unsupported type, or limits reached.
413Larger than 10 MB.
401Missing, invalid, revoked or expired API key.
429Too many requests to this endpoint; wait Retry-After seconds.
403code: "api_key_read_only": the API key is read-only, and this request changes something.
Media uploads API reference · Flenvio