upload_media
Upload images, GIFs, or videos to X and get a media_id for creating posts. Small images upload directly; larger files and videos use chunked processing, with optional alt text.
Instructions
Upload an image, GIF or video and return its media_id for create_post. Images <= 5 MB go in one request; GIFs, videos and larger files use chunked upload and wait for processing. Optional alt text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base64 | No | Base64 data (or data: URL) instead of file_path | |
| account | No | X username of an authorized account (see list_accounts). Omit to use the default account. | |
| alt_text | No | ||
| file_path | No | Absolute path to a local file (jpg/png/webp/gif/mp4/mov) | |
| mime_type | No | Required for base64 without a data: prefix | |
| media_category | No | Inferred from the file type for posts; use dm_* for direct messages |