---
title: "X API media requirements"
description: "X media limits: 5MB images in JPG, PNG, GIF, or WEBP, 15MB GIFs, post video up to 20 minutes, up to 4 photos per post, and the 280-character text limit."
---

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

# X API media requirements

X takes JPG, PNG, GIF, or WEBP images up to 5MB and animated GIFs up to 15MB. Post video runs 0.5 seconds to 20 minutes on a default account. A post carries up to 4 photos, 1 GIF, or 1 video, and 280 characters unless the account has X Premium. (Checked 2026-12-05.)

## Facts

| Fact                                | Official value                       | Source                                                                                  | Checked    |
| ----------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------- | ---------- |
| Images                              | 5MB; JPG, PNG, GIF, WEBP             | [X API: Upload Media](https://docs.x.com/x-api/media/upload-media)                      | 2026-12-05 |
| Animated GIF max size               | 15MB                                 | [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices) | 2026-12-05 |
| Post video length (default account) | 0.5 seconds to 20 minutes            | [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices) | 2026-12-05 |
| Direct Message video length         | 0.5 to 140 seconds                   | [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices) | 2026-12-05 |
| Media per post                      | 4                                    | [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices) | 2026-12-05 |
| Post text                           | 280 characters (more with X Premium) | [X API: Create or Edit Post](https://docs.x.com/x-api/posts/create-post)                | 2026-12-05 |

## Where official docs disagree

- **Media per post**: 4 in [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices); 20 in [X API: Create or Edit Post](https://docs.x.com/x-api/posts/create-post).
- PubNio caps X video at 512MB and 140 seconds, which matches X's Direct Message video limit, not its longer post video limit.

## What PubNio enforces

- Video uploaded to a PubNio workspace is capped at 5GiB, and other media at 256MiB. Only media given to a post by URL can be larger, so a provider limit above those sizes applies to URL media only.
- PubNio accepts JPEG, PNG, GIF, WebP, MP4, MOV: up to 4 images of 5MB, GIFs up to 15MB, and video up to 512MB.
- Post text is capped at 280 weighted characters.

## Read the live value

- [`GET /api/v1/capabilities`](https://pubnio.com/api/v1/docs#tag/capabilities/GET/api/v1/capabilities) returns PubNio's media rules for every X
  placement, and [`POST /api/v1/posts/{postId}/validate`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts/{postId}/validate) checks a draft against them without
  publishing.

## Related errors

- PubNio reports a file it will not send as `media_mime_type`, `media_too_large`, or `media_count` on the target, before any provider call.
- [X error codes](https://pubnio.com/docs/errors/x/) lists the errors PubNio returns for X and how to fix each.

## Limits

- PubNio does not use X Premium's longer post and video limits.

## Sources

- [X API: Upload Media](https://docs.x.com/x-api/media/upload-media), checked 2026-12-05

  ```text
  JPG, PNG, GIF or WEBP, up to 5 MB
  ```

- [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices), checked 2026-12-05

  ```text
  15 MB
  0.5 seconds–20 minutes
  0.5–140 seconds
  You may attach up to 4 photos, 1 animated GIF or 1 video in a Post.
  ```

- [X API: Create or Edit Post](https://docs.x.com/x-api/posts/create-post), checked 2026-12-05

  ```text
  maxItems: 20
  At most 280 characters unless the account has X Premium.
  ```

## Related

- [Posting limits](https://pubnio.com/docs/providers/x/limits/)
- [Rate limits and quota](https://pubnio.com/docs/providers/x/quota/)
- [Scopes and permissions](https://pubnio.com/docs/providers/x/scopes/)
- [App review and access](https://pubnio.com/docs/providers/x/app-review/)
- [Token lifetimes](https://pubnio.com/docs/providers/x/tokens/)
- [API versions](https://pubnio.com/docs/providers/x/versioning/)
- [X error codes](https://pubnio.com/docs/errors/x/)
- [Publishing to X](https://pubnio.com/docs/networks/x/)
- [Provider API explainers](https://pubnio.com/docs/providers/)

Source: https://pubnio.com/docs/providers/x/media/index.mdx
