Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions x-ads-api/creatives.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ For detailed guidance on video uploading through the API, please see the [Video

Videos can also be promoted as pre-roll assets. See the [Video Views Pre-roll Objective Guide](/x-ads-api/campaign-management/reference#video-views-preroll-objective) for a detailed explanation.

- (As of 2015-10-22) When uploading videos to be used in promoted content, the `media_category` parameter must be set with a value of `amplify_video` for all `INIT` command requests to the [POST media/upload (chunked)](/x-api/media/initialize-media-upload) endpoint. Using this new param ensures that the video is asynchronously pre-processed and prepared for use in promoted content. The `STATUS` command can be used to check completion of asynchronous processing after video upload.
- The maximum promoted video length currently allowed is 10 mins with a file size of 500MB or less.
- When uploading videos for promoted content, set `media_category` to `amplify_video` in [`POST /2/media/upload/initialize`](/x-api/media/initialize-media-upload). This ensures the video is asynchronously pre-processed for promoted content. Poll [`GET /2/media/upload`](/x-api/media/get-media-upload-status) with `command=STATUS` to check when processing completes.
- Promoted video limits follow the authenticated user's X Premium / verified status: up to 20 minutes and 512 MB by default, or up to 6 hours and 16 GB for X Premium / verified accounts. See [size and duration limits](/x-api/media/introduction#size-and-duration-limits).
- Uploaded video should be either mp4 or mov.
- Uploaded video generally processes quickly, but processing times can vary depending on video length and file size.
- Uploaded poster images should be in png or jpg format. There are no aspect ratio or size requirements, but the poster image will be adjusted to fit the video player.
Expand Down
13 changes: 7 additions & 6 deletions x-api/media/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,31 @@ Limits depend on:
- The **authenticated user's** X Premium / verified status — not your developer API plan
- The `media_category` you pass when initializing the upload

### Images and GIFs
### Images, GIFs, and subtitles

| Type | Max file size | Notes |
| :--- | :--- | :--- |
| Image (`tweet_image`, `dm_image`) | 5 MB | JPG, PNG, GIF, WEBP |
| Animated GIF (`tweet_gif`, `dm_gif`) | 15 MB | See [GIF constraints](/x-api/media/quickstart/best-practices#animated-gif-recommendations) |
| Animated GIF (`tweet_gif`, `dm_gif`) | 15 MB (chunked) / 5 MB (simple upload for `tweet_gif`) | See [GIF constraints](/x-api/media/quickstart/best-practices#animated-gif-recommendations). MP4-as-GIF is limited to 15 seconds. |
| Subtitles (`subtitles`) | 1 MB | SRT only. Max segment size is 1 MB. |

### Video

Use [chunked upload](/x-api/media/quickstart/media-upload-chunked) for all videos. Simple `POST /2/media/upload` is for images and small files only.

| Authenticated account | `media_category` | Max duration | Max file size |
| :--- | :--- | :--- | :--- |
| Default (no Premium) | `tweet_video`, `amplify_video` | 20 minutes | 8 GB |
| X Premium / verified | `tweet_video`, `amplify_video` | 125 minutes | 16 GB |
| Default (no Premium) | `tweet_video`, `amplify_video` | 20 minutes | 512 MB |
| X Premium / verified | `tweet_video`, `amplify_video` | 6 hours | 16 GB |
| Default (no Premium) | `dm_video` | 140 seconds (2 min 20 sec) | 512 MB |
| X Premium / verified | `dm_video` | 10 minutes | 1 GB |

Minimum video duration is **0.5 seconds** in all cases.

These Post-video caps match the X app. Premium status is the uploading user's X Premium / verified subscription (`feature/long_video_upload`), not your developer API plan.
These Post-video caps match the X app. Premium status comes from the uploading user's X Premium / verified subscription (`feature/long_video_upload`), not your developer API plan.

<Note>
`POST /2/media/upload/initialize` accepts `total_bytes` up to 16 GB. Passing a larger `total_bytes` than the account is allowed to upload fails at initialize or finalize.
`POST /2/media/upload/initialize` accepts `total_bytes` up to 16 GB. Passing a larger `total_bytes` than the account is allowed to upload fails at initialize or finalize. Each chunked upload session accepts up to 10,000 segments (`segment_index` `0` through `9999`), up to 8 MB per segment (1 MB for `subtitles`).
</Note>

### Posting (`POST /2/tweets`)
Expand Down
20 changes: 11 additions & 9 deletions x-api/media/quickstart/best-practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ These limits are enforced first by the upload endpoints, then again when you att
| Media | Category | Max duration | Max file size |
| :--- | :--- | :--- | :--- |
| Image | `tweet_image`, `dm_image` | — | 5 MB |
| Animated GIF | `tweet_gif`, `dm_gif` | — | 15 MB |
| Video on a Post | `tweet_video`, `amplify_video` | 0.5 seconds–20 minutes | 8 GB |
| Animated GIF | `tweet_gif`, `dm_gif` | — | 15 MB chunked (5 MB simple upload for `tweet_gif`) |
| Subtitles | `subtitles` | — | 1 MB (SRT only, 1 MB max segment) |
| Video on a Post | `tweet_video`, `amplify_video` | 0.5 seconds–20 minutes | 512 MB |
| Video in a DM | `dm_video` | 0.5–140 seconds | 512 MB |

### X Premium / verified accounts

| Media | Category | Max duration | Max file size |
| :--- | :--- | :--- | :--- |
| Image | `tweet_image`, `dm_image` | — | 5 MB |
| Animated GIF | `tweet_gif`, `dm_gif` | — | 15 MB |
| Video on a Post | `tweet_video`, `amplify_video` | 0.5 seconds–125 minutes | 16 GB |
| Animated GIF | `tweet_gif`, `dm_gif` | — | 15 MB chunked (5 MB simple upload for `tweet_gif`) |
| Subtitles | `subtitles` | — | 1 MB (SRT only, 1 MB max segment) |
| Video on a Post | `tweet_video`, `amplify_video` | 0.5 seconds–6 hours | 16 GB |
| Video in a DM | `dm_video` | 0.5 seconds–10 minutes | 1 GB |

Post-video caps match the X app. `POST /2/media/upload/initialize` accepts `total_bytes` up to 16 GB.
Post-video caps match the X app. `POST /2/media/upload/initialize` accepts `total_bytes` up to 16 GB. Chunked upload sessions accept up to 10,000 segments (`segment_index` `0` through `9999`), up to 8 MB per segment (1 MB for `subtitles`).

### Posting errors

Expand All @@ -70,15 +72,15 @@ When [`POST /2/tweets`](/x-api/posts/create-post) rejects a video for duration,
This user is not allowed to post a video longer than N minutes.
```

`N` is the posting user's cap for that media (20 minutes by default, 125 minutes for Premium / verified Post video). Handle this error even after a successful finalize.
`N` is the posting user's cap for that media (20 minutes by default, 361 minutes / 6 hours for Premium / verified Post video). Handle this error even after a successful finalize.

## Image specifications and recommendations

Image files must meet all of the following criteria:

- **Supported image media types**: `JPG`, `PNG`, `GIF`, `WEBP`
- **Image size**: `<= 5 MB`
- **Animated GIF size**: `<= 15 MB`
- **Animated GIF size**: `<= 15 MB` with chunked upload (`<= 5 MB` with simple `POST /2/media/upload` for `tweet_gif`)

## Animated GIF recommendations

Expand Down Expand Up @@ -109,8 +111,8 @@ Use the [chunked upload](/x-api/media/quickstart/media-upload-chunked) flow for

- **Frame rate**: must be `60 FPS` or less
- **Dimensions**: must be between `32x32` and `1280x1024`
- **File size**: see [size and duration limits](#size-and-duration-limits) (8 GB default for Post video; 16 GB for Premium / verified)
- **Duration**: must be at least `0.5 seconds`. Maximum depends on the authenticated user's Premium / verified status and `media_category` — 20 minutes by default for Post video (`tweet_video` / `amplify_video`), 125 minutes for Premium / verified Post video. DM video remains 140 seconds default / 10 minutes Premium.
- **File size**: see [size and duration limits](#size-and-duration-limits) (512 MB default for Post video; 16 GB for Premium / verified)
- **Duration**: must be at least `0.5 seconds`. Maximum depends on the authenticated user's Premium / verified status and `media_category` — 20 minutes by default for Post video (`tweet_video` / `amplify_video`), 6 hours for Premium / verified Post video. DM video remains 140 seconds default / 10 minutes Premium.
- **Aspect ratio**: must be between `1:3` and `3:1`
- **[Pixel aspect ratio](https://en.wikipedia.org/wiki/Pixel_aspect_ratio)**: must have `1:1`
- **Pixel format**: Only [YUV](https://en.wikipedia.org/wiki/YUV) 4:2:0 is supported
Expand Down
12 changes: 6 additions & 6 deletions x-api/media/quickstart/media-upload-chunked.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Use `tweet_video` for a regular Post. Use `amplify_video` for Ads creatives. See

## Step 2: Upload chunks (APPEND)

Upload each chunk to `POST /2/media/upload/{id}/append`. Keep each segment at or below **5 MB** (the server maximum is 8 MB). Segments are indexed from `0`.
Upload each chunk to `POST /2/media/upload/{id}/append`. Each segment can be up to **8 MB** (**1 MB** for `subtitles`). If you send a JSON body instead of multipart form data, keep each segment to **4 MB** or less because base64 encoding adds about a third to the payload size. Sessions accept up to **10,000 segments** (`segment_index` `0` through `9999`).

<CodeGroup dropdown>

Expand Down Expand Up @@ -337,7 +337,7 @@ If the video is longer than the posting user is allowed to attach, the response
}
```

`N` is the posting user's duration cap (20 minutes by default, 125 minutes for Premium / verified).
The duration cap in the error message is 20 minutes by default, or 361 minutes (6 hours) for X Premium / verified accounts.

---

Expand All @@ -346,13 +346,13 @@ If the video is longer than the posting user is allowed to attach, the response
| Category | Use for | Typical max (default / Premium) |
|:---------|:--------|:--------------------------------|
| `tweet_image` | Image on a Post | 5 MB |
| `tweet_gif` | Animated GIF on a Post | 15 MB |
| `tweet_video` | Video on a Post | 20 min / 8 GB · Premium: 125 min / 16 GB |
| `amplify_video` | Ads / promoted video | 20 min / 8 GB · Premium: 125 min / 16 GB |
| `tweet_gif` | Animated GIF on a Post | 15 MB chunked (5 MB with simple upload) |
| `tweet_video` | Video on a Post | 20 min / 512 MB · Premium: 6 hours / 16 GB |
| `amplify_video` | Ads / promoted video | 20 min / 512 MB · Premium: 6 hours / 16 GB |
| `dm_image` | Image in a Direct Message | 5 MB |
| `dm_gif` | Animated GIF in a Direct Message | 15 MB |
| `dm_video` | Video in a Direct Message | 140 s / 512 MB · Premium: 10 min / 1 GB |
| `subtitles` | Subtitle file | 1 MB |
| `subtitles` | Subtitle file (SRT) | 1 MB (1 MB max segment) |

If you omit `media_category`, the upload is treated as Post media (`tweet_image`, `tweet_video`, or `tweet_gif`) based on content type.

Expand Down
4 changes: 2 additions & 2 deletions x-api/posts/create-post.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Duration and file size are checked again at Post create. They follow the **posti

| Posting account | Video cap when attaching to a Post |
| :--- | :--- |
| Default (no Premium) | 20 minutes, 8 GB |
| X Premium / verified | 125 minutes, 16 GB |
| Default (no Premium) | 20 minutes, 512 MB |
| X Premium / verified | 6 hours, 16 GB |

These caps apply to `tweet_video` and `amplify_video`. If the video is longer than that user is allowed to post, the response is **403 Forbidden**:

Expand Down
2 changes: 1 addition & 1 deletion x-api/posts/manage-tweets/integrate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Posts created via the API are limited to a maximum of 1 cashtag (e.g. `$TICKER`)

Upload media with the [chunked upload](/x-api/media/quickstart/media-upload-chunked) endpoints, then pass the `media_id` in `media.media_ids`. A Post may include up to 4 photos, 1 animated GIF, or 1 video.

Video duration and file size are checked again at Post create. They follow the posting user's X Premium / verified status (20 minutes / 8 GB by default; 125 minutes / 16 GB for Premium / verified, for `tweet_video` and `amplify_video`). If the video exceeds that user's cap, `POST /2/tweets` returns **403** `This user is not allowed to post a video longer than N minutes.` See [size and duration limits](/x-api/media/introduction#size-and-duration-limits).
Video duration and file size are checked again at Post create. They follow the posting user's X Premium / verified status (20 minutes and 512 MB by default; 6 hours and 16 GB for Premium / verified, for `tweet_video` and `amplify_video`). If the video exceeds that user's cap, `POST /2/tweets` returns **403** `This user is not allowed to post a video longer than N minutes.` See [size and duration limits](/x-api/media/introduction#size-and-duration-limits).

### Rate limits

Expand Down
4 changes: 2 additions & 2 deletions x-api/posts/manage-tweets/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ A Post may include **up to 4 photos**, **1 animated GIF**, or **1 video**. Video

| Posting account | Video cap when attaching to a Post (`tweet_video` / `amplify_video`) |
| :--- | :--- |
| Default (no Premium) | 20 minutes, 8 GB |
| X Premium / verified | 125 minutes, 16 GB |
| Default (no Premium) | 20 minutes, 512 MB |
| X Premium / verified | 6 hours, 16 GB |

If the video is longer than that user is allowed to post, the response is **403 Forbidden**: `This user is not allowed to post a video longer than N minutes.` A successful upload does not guarantee the media can be attached. See [size and duration limits](/x-api/media/introduction#size-and-duration-limits).

Expand Down
Loading