A media object represents a single photo, video or animated GIF. Media objects are used by many endpoints within the X API, and may be included in Posts, Direct Messages, user profiles, advertising creatives and elsewhere. Each media object may have multiple display or playback variants, with different resolutions or formats.Documentation Index
Fetch the complete documentation index at: https://docs.x.com/llms.txt
Use this file to discover all available pages before exploring further.
Media types & size restrictions
Size restrictions for uploading via API- Image:
5 MB - GIF:
15 MB - Video:
512 MB(when usingmedia_category=amplify_video)
Creation
Objects such as Posts, 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 /2/tweets) 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_idfrom step 1. This step may be repeated multiple times with different media if the entity allows multiplemedia_idparameters to be passed in. - Create the entity by calling the appropriate endpoint, including the
media_idand other required parameters. For example, attach amedia_idto a Post using thePOST /2/tweetsendpoint.