You can query the Instagram oEmbed endpoint to get an Instagram post’s embed HTML and basic metadata in order to display the post in another website or app. Supports photo, video, Reel, and Feed posts.
Visit the Instagram Help Center to learn how to get the embed code from a public Instagram post or profile.
All endpoints can be accessed via the graph.facebook.com
host.
You can make up to 1,000 requests every hour.
You can get an embed HTML programmatically or in the Instagram app.
To programmatically get an Instagram post's embed HTML, send a request to:
GET /instagram_oembed?url=<URL_OF_THE_POST>
Replace <URL_OF_THE_POST>
with the URL
of the Instagram post that you want to query.
Upon success, the API will respond with a JSON object containing the post's embed HTML and additional data. The embed HTML will be assigned to the html
property.
Refer to the Instagram oEmbed reference
for a list of query string parameters
you can include to augment the request. You may also include the fields
query string parameter to specify which fields
you want returned. If omitted, all default Fields will be included in the response.
curl -X GET \
"https://graph.facebook.com/ v25.0
/instagram_oembed?url=https://www.instagram.com/p/fA9uwTtkSN/"
curl -i -X GET \
"https://graph.facebook.com/ v25.0
/instagram_oembed?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FfA9uwTtkSN"
Some values truncated with an ellipsis ( ...
) for readability.
{
"version": "1.0",
"provider_name": "Instagram",
"provider_url": "https://www.instagram.com/",
"type": "rich",
"width": 658,
"html": "<blockquote class=\"instagram-media\" data-instgrm-ca...",
}
The url
query string parameter accepts the following URL formats:
https://www.instagram.com/p/{media-shortcode}/
https://www.instagram.com/reel/{media-shortcode}/
https://www.instagram.com/{username}
The embed HTML contains a reference to the Instagram embed.js
JavaScript library. When the library loads, it scans the page for the post HTML and generates the fully rendered post. If you want to load the library separately, include the omitscript=true
query string parameter in your request. To manually initialize the embed HTML, call the instgrm.Embeds.process()
function after loading the library.
The embedded post is responsive and will adapt to the size of its container. This means that the height will vary depending on the container width and the length of the caption. You can set the maximum width by including the maxwidth
query string parameter in your request.