Guides
Media
Upload images, video, GIFs and PDFs; how Outboxer processes them into previews and per-platform derivatives; limits and validation.
Attach images, video, animated GIFs and PDF documents to posts. You upload a file once. Outboxer processes it and, for each channel a post goes to, prepares a version that fits that network: the right size, crop, format and file size.
Scopes: media:write to upload, import and edit media (a default agent scope); posts:read to list and read it.
Supported files#
| Kind | Formats | Max size |
|---|---|---|
| Image | JPEG, PNG, WebP, HEIC/HEIF (iPhone photos), AVIF | 50 MB |
| Animated GIF | GIF | 50 MB |
| Video | MP4, MOV, WebM | 4 GB |
| Document | 100 MB |
The type is detected from the file's contents, not its name or extension. Anything else returns
422 unsupported_format, and a file over its limit returns 413 file_too_large.
Uploading#
There are three ways in. Each returns a media object with a med_… id.
Direct upload (files up to 20 MB): POST /v1/workspaces/{ws}/media with multipart file, or JSON
{data: <base64>, filename}.
curl -s -X POST "https://api.outboxer.dev/v1/workspaces/acme/media?wait=true" \
-H "Authorization: Bearer $OUTBOXER_API_KEY" -H "Idempotency-Key: $(uuidgen)" \
-F [email protected] -F "alt_text=A bag of Ethiopia Guji beans on a wooden counter"Import from a URL: POST /v1/workspaces/{ws}/media/import {url, alt_text?}. Only public http(s) URLs work
(422 url_not_allowed otherwise); a URL that doesn't return a file gives 422 import_failed.
Presigned upload (large files and video):
POST /v1/workspaces/{ws}/media/uploads {filename, content_type, bytes}returnsmedia_id, anuploadobject (method: PUT,url,headers,expires_at, valid for 60 minutes) and acomplete_url.- PUT the raw bytes to
upload.urlwith the given headers. This request takes no API key. POST /v1/media/{id}/completeto start processing.
Optional fields on upload: alt_text, tags[], focal_point {x, y} (0–1, where crops should center),
ai_generated, source_prompt and keep_original. Uploading identical bytes again returns the existing asset.
Agents are limited to uploads_per_day (500 by default, 429 quota_exceeded).
Processing#
A media object's status goes awaiting_upload (presigned only) → processing → ready or failed (with a
failure_code). Use the id in a post once it is ready:
- Add
?wait=trueto an upload, import, complete orGET /v1/media/{id}call to wait up to 20 seconds for processing. - Or subscribe to the
media.readywebhook.
What processing produces:
- Metadata:
width,height,duration_s,codec,audio_codec,has_audio,frame_rate,frame_countandanimated(GIFs),page_count(PDFs). Portrait phone video is reported at its displayed orientation. - A master (
url): images are normalized (HEIC and AVIF decoded, up to 4096 px on the long edge). Video that isn't already H.264/AAC in MP4 or MOV is converted to an H.264/AAC MP4. - Previews (
previews): WebP images at 320, 800 and 1600 px for UIs. PDFs get a preview of the first page. - A cover frame for video (
poster), taken at 0.5 s by default. Change it withPATCH /v1/media/{id} {"poster_at_s": 3.2}.
PATCH /v1/media/{id} also updates alt_text, tags, folder, focal_point, ai_generated and keep_original.
GET /v1/workspaces/{ws}/media searches the library (type, tag, folder, q), and GET /v1/media/{id}/usage
lists the posts that use an asset.
Platform derivatives#
When a post is published, each channel gets a derivative made for that network from the master:
- Images are cropped to the network's preset closest to the image's aspect ratio (for example Instagram feed
1080×1350, square 1080×1080, landscape 1080×566), centered on the
focal_pointor your manualcrop, then resized and compressed to the network's limits, with metadata stripped. - Video that already meets the network's rules (format, codecs, duration, size, aspect ratio, frame rate) is sent as is. Otherwise it is re-encoded, either fitted (keeping its ratio) or cropped to a preset such as 9:16 for reels, stories and shorts. Video that is too long is trimmed and the frame rate is capped, each with a warning.
- Animated GIFs are sent as GIFs where the network supports them (X, LinkedIn, Facebook), converted to looping MP4
video where it prefers video (Instagram, Threads, TikTok, YouTube), and flattened to a still image elsewhere
(Pinterest, Google Business Profile, with a
gif_flattenedwarning). - PDFs are posted as documents where the network supports them, such as LinkedIn (up to 300 pages).
keep_original: true on an image publishes your file byte for byte wherever the network accepts it as is, and
optimizes it only where it doesn't (derivative warning original_not_accepted).
Derivatives are listed on the media object (derivatives[], each with preset, status, format, size, warnings
and url). You don't need to create them yourself. To preview or pre-warm them, or to override a crop, call:
curl -s -X POST https://api.outboxer.dev/v1/media/med_…/optimize \
-H "Authorization: Bearer $OUTBOXER_API_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"targets":[{"channel_id":"ch_…","post_type":"reel"},{"preset":"linkedin:landscape"}],"focal_point":{"x":0.5,"y":0.35}}'A crop that has to enlarge the image or video more than 2× comes back with an upscale warning.
The presets and limits per network are in GET /v1/channels/{id}/capabilities and GET /v1/rule-packs.
Using media in posts#
Put media on base.media (shared by every channel) or on a variant's media (that channel only). Items are
med_… ids or {media_id, alt_text?, crop?}. Validation checks media against each network's rules and reports
issues with a JSON path, such as variants[0].media or base.media[3]:
- Counts and mixes. Each network has its own maximum number of items, and some can't mix images and video in
one post (
media_mix_not_allowed). X takes the first 4 items and warns withmedia_truncated. - Carousels. On Instagram every item is shown at the first item's aspect ratio (
carousel_aspect_mismatch), and carousel video is capped at 60 seconds. - Alt text. A missing alt text is a warning (
alt_text_missing), or an error if the workspace's settings require alt text on every image. - Documents.
document_too_many_pages(LinkedIn: 300) and adocument_encryptedwarning.
See core concepts for how validation issues work, and the quickstart for a complete post.
