Upload Media
upload_mediaUpload media and get back a reusable media_id. Four modes: (1) pass url to upload from a publicly accessible URL, (2) pass data (base64-encoded file bytes) plus mime_type for small files (3MB cap), (3) for a file on the user's machine when you can run shell commands (Claude Code, Cowork, Codex, Cursor), pass size_bytes plus mime_type and name with no url or data: you get a media_id and a presigned upload_url, then PUT the raw file to it yourself (curl command included in the result, valid 2 hours, up to 500MB, no 3MB cap). Use mode 3 for any local video. (4) In ChatGPT, pass a file from the conversation (one the user attached, or an image you generated) as file: ChatGPT supplies its download link and the file goes straight into the media library, no size cap beyond 500MB and no manual upload. Supports images (PNG/JPEG), videos (MP4/MOV), and PDFs (application/pdf). A PDF returns a document-kind media_id — pass it to create_post on a LinkedIn account to publish a native LinkedIn document post (PDF carousel); set platform_configurations.linkedin.document_title to control the title. Use the returned media_id with the media param on create_post/update_post. A media_id stays available until the last post that uses it has published, then the file is deleted: reusing it across posts that are all scheduled is fine, but for a post created after those have gone out, upload the file again. HEIC/HEIF images are not supported — convert to JPEG or PNG first. Direct data uploads are capped at 3MB raw because of serverless request-body limits — for larger local files use mode 3 if you can run commands, otherwise request_upload_link.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Publicly accessible URL of the image or video to upload. Provide either `url` or `data`, not both. | |
| data | No | Base64-encoded file contents. Requires `mime_type`. Capped at 3MB raw (serverless request-body limit). For larger files, host the file at a public URL and pass it as `url` instead. Provide either `data` or `url`, not both. | |
| file | No | ChatGPT only: a file from this conversation (attached by the user or generated by you). ChatGPT fills in download_url and file_id. Provide only `file`, not `url`/`data`/`size_bytes`. | |
| name | No | Optional filename to store (defaults to the URL's filename, or 'file' for direct uploads) | |
| mime_type | No | Required with `data` or `size_bytes`. One of: image/png, image/jpeg, video/mp4, video/quicktime, application/pdf. | |
| size_bytes | No | Mode 3: exact size of the local file in bytes (e.g. from `stat` or `wc -c`). With `mime_type` and `name`, and no `url`/`data`, returns a presigned upload_url to PUT the file to yourself. Max 500MB. |