---
title: "X initialize video upload API: POST /2/media/upload/initialize"
description: "When PubNio calls X's initialize video upload request, POST /2/media/upload/initialize: 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 initialize video upload API: POST /2/media/upload/initialize

PubNio calls X's `POST /2/media/upload/initialize` (`initializeMediaUpload`) to open a chunked upload for a video.

## 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.
- PubNio sends `media_type`, `total_bytes` from the stored file, and `media_category` `tweet_video` in a staging step of its own, and keeps the returned media ID in the delivery's upload session.
- A retried staging step finds the open session and reuses it instead of opening a second upload. A refusal from X fails the delivery as `provider_rejected`.
- PubNio refuses an X video over 512 MB before the upload opens.

## 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

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

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

## Limits

- An upload opened for a delivery that later fails is not cleaned up; X expires unused media on its own schedule.

## Sources

- [X API v2 OpenAPI document](https://api.x.com/2/openapi.json)

## 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/initialize-media-upload/index.mdx
