---
title: "X upload image API: POST /2/media/upload"
description: "When PubNio calls X's upload image request, POST /2/media/upload: the scopes it needs, the errors PubNio handles for it, and its pinned spec revision."
---

> 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 upload image API: POST /2/media/upload

PubNio calls X's `POST /2/media/upload` (`mediaUpload`) to upload an image or GIF before it creates the post. Values checked 2026-12-05.

## How PubNio calls it

- Publishing: [`POST /api/v1/posts`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts) (unless it saves a draft), [`POST /api/v1/posts/{postId}/publish`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts/{postId}/publish), or [`POST /api/v1/posts/{postId}/targets/{targetId}/retry`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts/{postId}/targets/{targetId}/retry) starts the delivery.
- Images and GIFs go up in one multipart request with `media` and `media_category` set to `tweet_image` or `tweet_gif`. PubNio reads the stored file whole and refuses it when the size differs from what was stored.
- PubNio caps an X image at 5 MB and a GIF at 15 MB before it sends anything.

| Value        | Official value           | Source                                                                                  | Checked    |
| ------------ | ------------------------ | --------------------------------------------------------------------------------------- | ---------- |
| Image limits | 5MB; JPG, PNG, GIF, WEBP | [X API: Upload Media](https://docs.x.com/x-api/media/upload-media)                      | 2026-12-05 |
| GIF size     | 15MB                     | [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices) | 2026-12-05 |

## Scopes

- The pinned spec lists one scope: `media.write`.
- PubNio's X sign-in requests every one of them.
- Before a delivery makes this call, PubNio checks that the account granted `tweet.write`.

## Errors

PubNio has no X error code pages yet. [Provider error codes](https://pubnio.com/docs/errors/providers/) covers the providers that have them.

## Spec and changes

`mediaUpload` in the pinned spec, revision `2.175`.

Checked weekly; no change to `POST /2/media/upload` recorded since this revision. [Change tracker](https://pubnio.com/docs/changes/).

## Limits

- Videos never use this single request; they go through the chunked `initialize`, `append`, and `finalize` steps.

## Sources

- [X API v2 OpenAPI document](https://api.x.com/2/openapi.json)
- [X API: Upload Media](https://docs.x.com/x-api/media/upload-media), checked 2026-12-05
- [X API: Media best practices](https://docs.x.com/x-api/media/quickstart/best-practices), checked 2026-12-05

## Related

- [Provider API operations PubNio calls](https://pubnio.com/docs/providers/operations/)
- [X rate limits and quota](https://pubnio.com/docs/providers/x/quota/)

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