POST /2/media/upload
endpoint. Uploading media with OAuth can be a bit tricky, so we’ve outlined some things to keep in mind as well as a working sample of how to use this endpoint here.
application/octet-stream
).media_id_string
provided in the API response for Javascript and any other languages that cannot accurately represent a long integer.tweet_image
, tweet_video
, or tweet_gif
), depending on the content type.
The most common media categories are as follows:
tweet_image
tweet_video
tweet_gif
dm_image
dm_video
dm_gif
subtitles
JPG
, PNG
, GIF
, WEBP
<= 5 MB
<= 15 MB
media_id
. The file size limit and other constraints may vary depending on the media_category
parameter.
<= 1280x1080
(width
x height
)<= 350
<= 300 million
(width
* height
* num_frames
)<= 15Mb
media_category
parameter. This allows the server to process the GIF file asynchronously, which is a requirement for processing larger files. Pass media_category=tweet_gif
to enable async upload behavior for Posts with an animated GIF.
H264 High Profile
30 FPS
, 60 FPS
1280x720
(landscape), 720x1280
(portrait), 720x720
(square). Subscribed users can upload a 1080p video and get 1080p playback. Unsubscribed users can upload a 720p video and get a 720p playback.5,000 kbps
128 kbps
AAC LC
16:9
(landscape or portrait), 1:1
(square)60 FPS
or less32x32
and 1280x1024
512 mb
0.5 seconds
and 140 seconds
1:3
and 3:1
1:1
AAC
with Low Complexity profile. (High-Efficiency AAC
is not supported)mono
or stereo
, not 5.1 or greateropen GOP
progressive scan
Orientation | Width | Height | Video Bitrate | Audio Bitrate |
---|---|---|---|---|
Landscape | 1280 | 720 | 2048K | 128K |
Landscape | 640 | 360 | 768K | 64K |
Landscape | 320 | 180 | 256K | 64K |
Portrait | 720 | 1280 | 2048K | 128K |
Portrait | 360 | 640 | 768K | 64K |
Portrait | 180 | 320 | 256K | 64K |
Square | 720 | 720 | 2048K | 128K |
Square | 480 | 480 | 768K | 64K |
Square | 240 | 240 | 256K | 32K |