GET statuses/oembed
Returns a single Tweet, specified by either a Tweet web URL or the Tweet ID, in an oEmbed-compatible format. The returned HTML snippet will be automatically recognized as an Embedded Tweet when Twitter’s widget JavaScript is included on the page.
The oEmbed endpoint allows customization of the final appearance of an Embedded Tweet by setting the corresponding properties in HTML markup to be interpreted by Twitter’s JavaScript bundled with the HTML response by default. The format of the returned markup may change over time as Twitter adds new features or adjusts its Tweet representation.
The Tweet fallback markup is meant to be cached on your servers for up to the suggested cache lifetime specified in the cache_age
.
The oEmbed endpoint supports unauthenticated requests at api.twitter.com/1/statuses/oembed.{format}
suitable for distributed software and general discovery. Individual sites should request oEmbed data using an application token.
Resource URL
https://api.twitter.com/1.1/statuses/oembed.{format}
Resource Information
Parameters
Either the id
or url
parameters must be specified in a request. It is not necessary to include both.
The ID of the desired Tweet.
Example Values: 99530515043983360
The URL of the Tweet to be embedded.
Example Values:
To embed the Tweet at https://twitter.com/Interior/status/507185938620219395
, use:https%3A%2F%2Ftwitter.com%Interior%2Fstatus%2F507185938620219395
The maximum width of a rendered Tweet in whole pixels. This value must be between 220
and 550
inclusive. A supplied value under or over the allowed range will be returned as the minimum or maximum supported width respectively; the reset width value will be reflected in the returned width
property.
Note that Twitter does not support the oEmbed maxheight
parameter. Tweets are fundamentally text, and are therefore of unpredictable height that cannot be scaled like an image or video. Relatedly, the oEmbed response will not provide a value for height
. Implementations that need consistent heights for Tweets should refer to the hide_thread
and hide_media
parameters below.
Example Values: 325
When set to true
, t
or 1
links in a Tweet are not expanded to photo, video, or link previews.
Example Values: true
When set to true
, t
or 1
a collapsed version of the previous Tweet in a conversation thread will not be displayed when the requested Tweet is in reply to another Tweet.
Example Values: true
When set to true
, t
or 1
the <script>
responsible for loading widgets.js
will not be returned. Your webpages should include their own reference to widgets.js
for use across all Twitter widgets including Embedded Tweets.
Example Values: true
Specifies whether the embedded Tweet should be floated left, right, or center in the page relative to the parent element. Valid values are left
, right
, center
, and none
. Defaults to none
, meaning no alignment styles are specified for the Tweet.
Example Values: center
Request returned HTML and a rendered Tweet in the specified Twitter language supported by embedded Tweets.
Example Values: fr
Set to video
to return a Twitter Video embed for the given Tweet.
Example Value: video
Applies to video
type only. Set to 1
or true
to link directly to the Tweet URL instead of displaying a Tweet overlay when a viewer clicks on the Twitter bird logo.
Example Value: 1
OAuth Signature Generator
Sign in to see a list of your registered applications.
Example Request
GET
https://api.twitter.com/1.1/statuses/oembed.json?id=507185938620219395
Example Result
{ "cache_age": "3153600000", "url": "https://twitter.com/Interior/status/507185938620219395", "provider_url": "https://twitter.com", "provider_name": "Twitter", "author_name": "US Dept of Interior", "version": "1.0", "author_url": "https://twitter.com/Interior", "type": "rich", "html": "<blockquote class=\"twitter-tweet\"><p>Happy 50th anniversary to the Wilderness Act! Here's a great wilderness photo from <a href=\"https://twitter.com/YosemiteNPS\">@YosemiteNPS</a>. <a href=\"https://twitter.com/hashtag/Wilderness50?src=hash\">#Wilderness50</a> <a href=\"http://t.co/HMhbyTg18X\">pic.twitter.com/HMhbyTg18X</a></p>— US Dept of Interior (@Interior) <a href=\"https://twitter.com/Interior/status/507185938620219395\">September 3, 2014</a></blockquote>\n<script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>", "height": null, "width": 550 }