Skip to main content
POST
Upload a media file and get back its identifiers, including a media_key. The media field carries the file content base64-encoded in JSON bodies (raw bytes in multipart bodies); media_category is tweet_image, tweet_video, or tweet_gif for posts and ads, dm_image/dm_video/dm_gif for DMs, or subtitles. For X Ads accounts, register the returned media_key via create_media_library_item to add it to the account's media library and use it in campaigns.

Authorizations

Authorization
string
header
required

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

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[]