Skip to main content
POST
Upload a file
Upload a media file by multipart form. Returns an id and path you can pass into a post’s image array.

Accepted MIME types

The backend inspects the file’s actual content (not just the extension) and rejects anything outside this allowlist: PDFs are not accepted. See Uploads troubleshooting for limits and recommended video formats.

Example

Example response:

Adjusting media to platform limits

Platforms reject media that is too large, too small or in an encoding they don’t accept. Send the optional adjust field as true to adjust the file after the upload. It defaults to false, which stores the file as uploaded.
  • Videos get their short side scaled to 1080 px, up or down, with the long side at most 1920 px. They are re-encoded to H.264 MP4 (yuv420p, at most 60 fps) with AAC audio (128 kbps, 48 kHz) and the metadata moved to the start of the file for streaming.
  • Images are only scaled down, to a short side of at most 1080 px and a long side of at most 1920 px, and keep their format.
  • GIF, AVIF, BMP and TIFF files are stored as uploaded.
The adjustment runs in the background, so the response comes back with "status": "processing". The adjusted file replaces the original at the same path, usually within seconds. Poll Media Status every few seconds and wait until the status is ready before publishing a post with this path: a post published while it is processing uses the original, unadjusted file. Without adjust the upload is synchronous and the path is ready immediately. If the adjustment fails, the original file is kept and used for publishing, and Media Status returns "status": "ready" with a warning.
On self-hosted instances without the media processor configured, adjust has no effect and the file is stored as uploaded with "status": "ready".

Usage in a post

Authorizations

Authorization
string
header
required

Your Postiz API key

Body

multipart/form-data
file
file
required

The file to upload

adjust
enum<string>
default:false

Adjust the file to the platforms' limits after the upload: videos are scaled to a 1080 px short side (long side at most 1920 px) and re-encoded to H.264 MP4 with AAC audio, images larger than that are scaled down. Runs in the background, poll GET /media/{id}/status for the result. Defaults to false.

Available options:
true,
false

Response

200 - application/json

File uploaded successfully

id
string

Unique file ID

name
string

File name

path
string

File URL

organizationId
string
createdAt
string<date-time>
updatedAt
string<date-time>
status
enum<string>

"processing" while an upload with adjust set to true is being adjusted, otherwise "ready"

Available options:
ready,
processing