API Reference

Media

The media library gives you a two-step upload flow backed by UniPost-managed storage. Use it when you do not want to depend on public asset URLs or when you want UniPost to resolve media IDs server-side during publish.

Best for

The media library is the recommended path for large local files, especially video destined for YouTube. It is also the same flow the dashboard uses before publish.

Reserve an upload

Create a media row and receive a presigned upload URL. The media stays in a pending state until the file lands and UniPost resolves its final metadata.

curl -X POST https://api.unipost.dev/v1/media \
  -H "Authorization: Bearer up_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "photo.jpg",
    "content_type": "image/jpeg",
    "size_bytes": 284192
  }'

Flow

StepWhat happens
POST /v1/mediaReserve a media row and receive a presigned URL
PUT to storageUpload directly to storage using the returned URL
GET /v1/media/{id}Read the resolved media row once the file is available
Use media_ids in publishReference the media row from `platform_posts[]`

Use media IDs in posts

Once uploaded, pass media_ids on a platform post entry. UniPost resolves those IDs to short-lived download URLs internally before handing off to platform adapters.

{
  "platform_posts": [
    {
      "account_id": "sa_instagram_1",
      "caption": "Launch day.",
      "media_ids": ["med_abc123"]
    }
  ]
}

YouTube note

If you are publishing a local video to YouTube, prefer media_ids over trying to inline the file body or rely on an MCP client to move the raw bytes. The dashboard already follows this upload-to-storage-then-publish workflow because it is more reliable for larger assets.