Zernio
APIFor you
Zernio
APIFor you
API Reference

Media

Get upload URLPOSTPrepare media for a platformPOST
Dashboard
OverviewPlatformsAPI ReferenceResources
Media

Prepare media for a platform

Turn any image or video into a version the target platform accepts, using the same per-platform processing Zernio runs before publishing. Each team can prepare up to 60 files per hour; past that the endpoint answers 429 with retryAfterSeconds.

What each target does to a video: instagram, facebook_reel re-encode to H.264 Main 4.1, 30 fps, 1080 wide (HDR sources only get the size step, so they are not flattened to SDR). instagram_story re-encodes a video over 100MB to fit 60 seconds and 100MB. facebook_story reframes anything wider than 9:16 onto a 1080x1920 canvas with a blurred background (Facebook otherwise publishes such stories with 0 seconds of video and no error). threads re-encodes to the conservative H.264 Baseline profile Threads processes reliably. bluesky re-encodes to 1080 wide and at most 180 seconds, then compresses under 50MB if the result is still larger. telegram compresses to 50MB and moves the index to the start of the file. The other targets compress only when the file is over the platform limit.

Images are converted to a format the platform ingests (Instagram takes only JPEG, LinkedIn and Google Business reject WebP and AVIF) and compressed under its size limit; telegram also fits the width plus height limit and googlebusiness enlarges images under its minimum size.

When the file already complies, changed is false and url is the input URL (after redirects). Otherwise url points to the prepared file in Zernio storage, kept under the same retention as uploaded media. The request is synchronous: a long video can take a few minutes. Videos over 200MB are refused with 413, and a video URL whose host sends no Content-Length is refused with 400.


POST
/v1/media/prepare

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.media.prepareMedia({  body: {    url: 'https://example.com/clip.mov',    target: 'facebook_story',  },});console.log(data);
{  "target": "facebook_story",  "url": "https://media.zernio.com/media/1761100000000_ab12cd_clip_story.mp4",  "changed": true,  "mediaType": "video",  "originalSize": 48211337,  "outputSize": 31877210}
Was this page helpful?

Get upload URL

Get a presigned URL to upload files directly to cloud storage (up to 5GB). Returns an uploadUrl and publicUrl. PUT your file to the uploadUrl, then use the publicUrl in your posts.

Validate media URL

Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons. Performs a HEAD request (with GET fallback) to detect content type and size. Rejects private/localhost URLs for SSRF protection. Platform limits are sourced from each platform's actual upload constraints.

url*string

Public http(s) URL of the image or video.

Formaturi
target*string

Where the media will be published. twitter, googlebusiness and youtube_thumbnail take images only; facebook_reel takes videos only.

Value in

  • "instagram"
  • "instagram_story"
  • "facebook"
  • "facebook_reel"
  • "facebook_story"
  • "threads"
  • "tiktok"
  • "linkedin"
  • "twitter"
  • "bluesky"
  • "pinterest"
  • "reddit"
  • "snapchat"
  • "telegram"
  • "googlebusiness"
  • "youtube_thumbnail"