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

PubNio calls X's `POST /2/media/upload/{id}/finalize` (`finalizeMediaUpload`) to close a video upload once every segment is sent.

## 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 finalizes in the same step that creates the post, right before it, and only when the upload session's committed bytes equal the stored size; otherwise the delivery fails as `media_preparation_failed`.
- The response's `processing_info` decides whether PubNio must wait for X to process the video before it creates the post.

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

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

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

## Limits

- Finalizing does not make the video postable on its own; until `processing_info.state` is `succeeded` or absent, PubNio does not create the post. This step is never retried.

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