Skip to main content
POST
Upload media

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

media
required

The media file to upload: base64-encoded in JSON bodies, raw bytes in multipart bodies.

media_category
enum<string>
required

The category of the media being uploaded.

Available options:
tweet_image,
tweet_video,
tweet_gif,
dm_image,
dm_video,
dm_gif,
subtitles
additional_owners
string

Comma-separated list of user IDs who can use this media.

Response

The request has succeeded.

data
object
errors
object[]