Upload media
Overview
A media object represents a single photo, video or animated GIF. Media objects are used by many endpoints within the Twitter API, and may be included in Tweets, Direct Messages, user profiles, advertising creatives and elsewhere. Each media object may have multiple display or playback variants, with different resolutions or formats.
Media types & size restrictions
Size restrictions for uploading via API
- Image 5 MB
- GIF 15 MB
- Video 512 MB (when using media_category=amplify)
Creation
Objects such as Tweets, Direct Messages, user profile pictures, hosted Ads cards, etc. can contain one or more media objects. These top-level objects are collectively known as entities. The relevant entity creation API (e.g. POST statuses/update) can be passed one or more media objects using a unique media_id.
An entity which contains media object(s) can be created by following these steps:
- Upload the media file(s) using either the recommended chunked upload (images/GIF/video), or the older simple upload (images only).
- Receive a media_id from step 1. This step may be repeated multiple times with different media if the entity allows multiple media_id parameters to be passed in.
- Create the entity by calling the appropriate endpoint, including the media_id and other required parameters. For example, attach a media_id to a Tweet using the POST statuses/update endpoint.
Retrieving
Please refer to the Media Object in the Tweet data dictionary.