Upload Media
Upload media for use in posts. Two modes: 1. URL mode: provide a public URL — file is downloaded and stored. Best for images/videos from AI generators (DALL-E,
upload_media
Upload media for use in posts. Two modes:
- URL mode: provide a public URL — file is downloaded and stored. Best for images/videos from AI generators (DALL-E, Runway, etc).
- Base64 mode: provide base64-encoded data + mimeType — decoded and stored. Best for small generated images (<10MB). Returns a media ID (med_...) to pass in publish_post media array. Supported types: image/, video/, application/pdf.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | no | Public URL to download media from. The file will be downloaded and stored in our CDN. |
base64 | string | no | Base64-encoded file content. Use for small files only (<10MB). Requires mimeType. |
mimeType | string | no | MIME type of the file (e.g. "image/png", "video/mp4"). Required when using base64. |
filename | string | no | Original filename for reference. |
workspaceId | string | no | Workspace ID. Required if your API key accesses multiple workspaces. |
When to use
Inline upload path: encode the file as base64 and send it in the tool call. Use this for small files (≤ 5 MB) where the convenience of "one call" outweighs the bandwidth overhead of base64 (~33% larger than raw).
For anything bigger, use create_upload_url — it's faster, cheaper, and doesn't hit JSON payload size limits.
Example
{
"workspaceId": "wks_01H...",
"filename": "avatar.png",
"mimeType": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAA..."
}data is base64-encoded without the data:image/png;base64, prefix.
Response
{
"id": "med_01H...",
"type": "image",
"mimeType": "image/png",
"status": "uploaded",
"url": "https://..."
}Use id in a subsequent publish_post call.
Gotchas
- Agents have token budgets — a single 5 MB base64 blob is ~7 MB of input tokens. Measure before committing to this path at scale.
- The returned
urlis a Postato-hosted URL. Do not expose it to end users directly; it's for the publishing pipeline. - Content-type sniffing: if the
mimeTypedisagrees with the actual bytes, publishing to the target network may reject the media with a confusing error. Trust the source.
Create Upload URL
Generate a presigned URL for uploading large files (videos, high-res images) directly to storage. Use this when the file is too large for upload_media (>10MB) o
Get Media
Get metadata for an uploaded media file. Returns id, url, type, mimeType, sizeBytes, status (pending/ready/expired), filename, and expiration date.