upload_media
Upload media and get back a reusable media_id. Three 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), or (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. 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. 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. | |
| 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. |