Streaming upload
Send the raw bytes as the request body with the file’s ownContent-Type
(image/* or video/*). Not multipart, not base64: the bytes themselves.
Response
handle object (both fields) in uploadedHandles when you
create the post:
preview.r2Url is a real URL you can show in a composer before the post exists.
It is a staging location, not the published permalink.
Inline base64
For small images, skip the upload round trip:data:image/jpeg;base64, prefix.
Carousels
Order is the order you supply. Sources are concatenated asuploadedHandles then mediaItems, so don’t split one carousel across both
unless you want that ordering.
Video covers
PasscoverImage to choose a video’s thumbnail. Same base64 shape as
mediaItems:
Validation
The item count is checked for every post before it is accepted (for example, an Instagram carousel takes 2 to 10 items). InlinemediaItems are also checked
against the target platform and mediaType (dimensions, duration, and file
size). A rejection comes back as 400 naming the offending item:
failed and errorMessage says why.
Removing media from a post
While a post is still editable, drop one item without touching the rest:mediaId comes from the media[] array on the post. This removes the attachment
and deletes its stored file when the file belongs to that post. An attachment
that references the asset library is removed, but the library file stays.
For a clip pipeline that removes files after publication, see
Media retention and cleanup.