Media API

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 has multiple display or playback variants, with different resolutions or formats.

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 internally as product entities. The relevant product entity creation API (e.g. POST statuses/update) can be passed one or more media objects using a unique media_id.

A product entity which contains media object(s) can be created by following these steps:

1) Upload the media file(s) using either the simple (image only) or the chunked (recommended) media upload API to receive a media_id. This step may be repeated multiple times with different media if the product entity allows multiple media_id parameters to be passed in.

2) Create the product 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.

Troubleshooting

For issues with the Media APIs: