Skip to content

X initialize video upload API: POST /2/media/upload/initialize

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.

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 (unless it saves a draft), POST /api/v1/posts/{postId}/publish, or 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 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.

Limits

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

Sources

Type to search…

↑↓ navigate↵ selectEsc close