Attach a file to a post by reference
Changed onAttach one image or video to an existing draft or scheduled post using a file reference: an HTTPS download URL plus a stable file ID, the shape ChatGPT supplies through openai/fileParams to the MCP attach_media tool. Publora downloads the file right away through the same guarded pipeline as mediaUrls, which detects the type from the bytes and probes the file. Accepted: JPEG, PNG, GIF, WebP, TIFF and AVIF images up to 25 MB; MP4, MOV and WebM videos up to 150 MB. The file is attached with status ready, and no presigned PUT or complete-media call is needed. The post is always left in draft. A scheduled post is demoted to draft and keeps its stored time; schedule it again with update-post. The body accepts only file and fileName, and publishing parameters are rejected with INVALID_MEDIA_FILE. The response has the update-post shape and does not include the media ID, so read media[] from get-post. Each attempt that reaches the download counts one URL against the media URL ingestion limit of 60 URLs per hour, shared with mediaUrls; idempotent replays don't count.
Request
- Base URLhttps://api.publora.com/api/v1
- AuthAPI key in header x-publora-key
Path parameters
Headers
Recommended. Publora recognises a retry by the post ID, file.file_id and the sanitized file name. download_url and mime_type are excluded, so a retry with a refreshed temporary URL replays the original response instead of attaching the file twice. Reusing the key with a different post, file ID or file name returns 422. A failed download frees the key for a retry with a fresh reference. Without a key, every call attaches another copy. Keys are kept for 24 hours.
Request body
Example request
{
"file": {
"download_url": "https://files.example.com/download/abc123?signature=TEMPORARY",
"file_id": "file-abc123",
"mime_type": "image/png",
"file_name": "image.png"
},
"fileName": "spring-launch-banner.png"
}Response
File downloaded, validated and attached; the post is in draft
Example response
{
"message": "Post updated successfully"
}Changes
- info
endpoint added
- info