Skip to main content
POST
Initialize media upload

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

FlowAuthorization Code
Authorization URL
https://api.x.com/2/oauth2/authorize
Token URL
https://api.x.com/2/oauth2/token
Scopes1
media.write
Upload media, such as photos and videos, on your behalf.

Body

application/json
additional_owners
string[]

User ids granted access to the uploaded media.

Pattern: ^[0-9]{1,19}$
media_category
enum<string>

The media category of the upload.

Available options:
amplify_video,
tweet_gif,
tweet_image,
tweet_video,
dm_gif,
dm_image,
dm_video,
subtitles
media_type
enum<string>

The type of media.

Available options:
video/mp4,
video/webm,
video/mp2t,
video/quicktime,
text/srt,
text/vtt,
image/jpeg,
image/gif,
image/bmp,
image/png,
image/webp,
image/pjpeg,
image/tiff,
model/gltf-binary,
model/vnd.usdz+zip
shared
boolean

Whether this media is shared or not.

total_bytes
integer

The total size of the media upload in bytes.

Required range: 0 <= x <= 17179869184

Response

The request has succeeded.

data
object
errors
object[]