API Reference

Media

Upload images and video

OpenPost stores uploads in Cloudflare R2. Every upload is re-sniffed server-side with file-type, stripped of EXIF, and for images re-encoded via sharp. The browser-declared content type is never trusted.

Product-wide upload caps at the API: 1 GB video, 30 MB image. Individual platforms have their own (tighter) caps enforced at publish time. Uploads beyond the hard cap are rejected with 413.

Pick an upload mode

  • Small filesPOST /v1/media as multipart form.
  • Remote URLPOST /v1/media/from-url with a URL; we download, sniff, and store.
  • Large files — the multipart upload flow (init → part PUTs → complete).

Direct upload (small files)

POST/v1/media

Multipart form upload. Field name: file. Max 1 GB video / 30 MB image.

bash
curl -X POST https://api.openpost.so/v1/media \
  -H "Authorization: Bearer $OP_KEY" \
  -F "file=@launch.jpg"
json
{
  "media": {
    "id": "9f1e2d4c-...",
    "org_id": "...",
    "file_url": "<r2-object-key>",
    "file_type": "image/jpeg",
    "file_size": 2148304,
    "created_at": "2026-04-16T10:27:04Z"
  }
}

Upload from a URL

POST/v1/media/from-url

Download a remote file, re-sniff, and persist in R2. 30-second fetch timeout.

FieldTypeDescription
url*stringPublic HTTPS URL to the file.
curl
curl -X POST https://api.openpost.so/v1/media/from-url \
  -H "Authorization: Bearer $OP_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/hero.jpg" }'

Multipart upload (large files)

For video uploads near the 1 GB cap, use the chunked flow. R2 requires every part except the last to be at least 5 MiB, and supports a maximum of 10,000 parts per upload.

POST/v1/media/multipart/init

Register an upload. Body: { filename, type, size, totalParts }. Returns uploadId, key, partSize, trackingId.

POST/v1/media/multipart/part

Get a presigned PUT URL for a single part and upload its bytes.

POST/v1/media/multipart/complete

Finalize the upload after all parts are uploaded. We re-sniff the object and persist metadata.

Using media in a post

Reference the returned media id in the media_ids array when you create a post.

A handful of MIME types are blocked outright for security: SVG, HTML, shell scripts, and Windows executables. JPEG/PNG/WebP/GIF images and MP4/MOV/WebM video are the broadly-accepted formats.
Last updated April 2026 Edit this page