Twitter Moment oEmbed API¶
Returns a simple embed HTML for a single Twitter Moment specified by a Moment URL, in an oEmbed-compatible response JSON format.
The Moment markup is meant to be cached on your servers for up to the suggested cache lifetime specified by the cache_age
property.
Resource URL¶
https://publish.twitter.com/oembed
Resource Information¶
Response formats | JSON |
Requires authentication? | No |
Rate limited? | No |
Query parameters¶
Parameter | Description | Example value |
---|---|---|
url | The URL of the Twitter Moment to be embedded | https://twitter.com/i/moments/650667182356082688 |
maxwidth | Set the maximum width of the displayed embed in whole pixels Minimum value: 220 | 450 |
limit | Display up to N items, where N is a value between 1 and 20 inclusive | 6 |
chrome | Remove the footer display component | nofooter |
lang | A supported Twitter language code | es |
dnt | When set to true, the Moment and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads | true |
omit_script | Do not include Twitter’s widgets JavaScript in the response | 1 |
Example Requests¶
GET https://publish.twitter.com/oembed?url=https://twitter.com/i/moments/650667182356082688
twurl -H publish.twitter.com "/oembed?url=https://twitter.com/i/moments/650667182356082688"
Example Result¶
{
"url": "https://twitter.com/i/moments/650667182356082688",
"title": "The Obamas' wedding anniversary",
"html": "<a class=\"twitter-moment\" href=\"https://twitter.com/i/moments/650667182356082688\">The Obamas' wedding anniversary</a>\n<script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>",
"width": 550,
"height": null,
"type": "rich"
"cache_age": "3153600000",
"provider_name": "Twitter",
"provider_url": "https://twitter.com",
"version": "1.0"
}