> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Media

> Uploads an image or video from a URL to X and registers it in the ads account's Media Library

Uploads an image or video from a URL to X and registers it in the ads account's Media Library. Videos are processed asynchronously and the node waits until X finishes. Use the returned media\_key in x\_ads\_create\_post.

|                       |                       |
| --------------------- | --------------------- |
| **App**               | X Ads                 |
| **Operation ID**      | `x_ads_upload_media`  |
| **Type**              | Action                |
| **Connection**        | `x_ads` (required)    |
| **Credits per run**   | 1                     |
| **Agent / MCP tool**  | Yes                   |
| **Requires approval** | Yes (write operation) |

## Inputs

| Field              | Type                                                              | Required | Default | Description                                                                                                                                                                                                                                                                                                                                      |
| ------------------ | ----------------------------------------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `account`          | DynamicAccount                                                    | Yes      | -       | Select the X Ads account whose Media Library receives the file.                                                                                                                                                                                                                                                                                  |
| `image_url`        | string                                                            | No       | -       | Image to upload. Provide an image or a video, not both. Accepts jpg, png, webp or gif, up to 3MB when the image is used on a card. Give a direct URL, a Google Drive share link (set to 'Anyone with the link'), or a file uploaded through Markifact. Returns a media\_key to reference from the post and ad nodes.                             |
| `video_url`        | string                                                            | No       | -       | Video to upload. Provide an image or a video, not both. Accepts mp4 or mov, up to 10 minutes and 500MB, from a direct URL, a Google Drive share link (set to 'Anyone with the link'), or a file uploaded through Markifact. Uploaded in chunks and awaited until X finishes processing, as amplify\_video, the category promoted video requires. |
| `media_category`   | enum (`tweet_image`, `tweet_gif`, `tweet_video`, `amplify_video`) | No       | -       | Overrides the upload category, which is otherwise detected from the file (images become tweet\_image/tweet\_gif, videos become amplify\_video, which promoted video requires).                                                                                                                                                                   |
| `name`             | string                                                            | No       | -       | Name shown in the Media Library, up to 100 characters.                                                                                                                                                                                                                                                                                           |
| `file_name`        | string                                                            | No       | -       | File name shown in the Media Library, up to 255 characters.                                                                                                                                                                                                                                                                                      |
| `title`            | string                                                            | No       | -       | Video only: title rendered with the video, up to 70 characters.                                                                                                                                                                                                                                                                                  |
| `description`      | string                                                            | No       | -       | Video only: description rendered under the video, up to 200 characters.                                                                                                                                                                                                                                                                          |
| `poster_media_key` | string                                                            | No       | -       | Video only: media\_key of an uploaded image to use as the poster frame.                                                                                                                                                                                                                                                                          |

## Output

**Type**: `Dict`

Returns the media\_key, media\_id, and the Media Library item.

**Fields**: dynamic (depend on the inputs)
