The endpoints documented on this page were deprecated on October 24, 2020 and now return an error code 400
. Please use the new Facebook oEmbed endpoints instead.
oEmbed is an open format designed to allow embedding content from a website into another page. You can use the oEmbed standard for embedding Facebook posts and videos into your website.
You can use our API endpoint to request the embed code for public Posts and Videos, all responses are in json
format. Replace {content-url}
by your post or video url:
Type | Endpoint URL |
---|---|
Post |
|
Video |
|
Public Facebook posts and videos can use one of these URL schemes:
https://www.facebook.com/
{page-name}
/posts/
{post-id}
https://www.facebook.com/
{username}
/posts/
{post-id}
https://www.facebook.com/
{username}
/activity/
{activity-id}
https://www.facebook.com/photo.php?fbid=
{photo-id}
https://www.facebook.com/photos/
{photo-id}
https://www.facebook.com/permalink.php?story_fbid=
{post-id}
https://www.facebook.com/media/set?set=
{set-id}
https://www.facebook.com/questions/
{question-id}
https://www.facebook.com/notes/
{username}
/
{note-url}
/
{note-id}
https://www.facebook.com/
{page-name}
/videos/
{video-id}
/
https://www.facebook.com/
{username}
/videos/
{video-id}
/
https://www.facebook.com/video.php?id=
{video-id}
https://www.facebook.com/video.php?v=
{video-id}
Note: As our platform is constantly evolving this list may not be complete.
Let's say you want to get the oEmbed data for embedding the Facebook Developers video How to Share With Just Friends call the endpoint URL: https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F
The json
response should like this:
{ "author_name": "Facebook", "author_url": "https://www.facebook.com/facebook/", "provider_url": "https://www.facebook.com", "provider_name": "Facebook", "success": true, "height": null, "html": "<div id=\"fb-root\"></div>\n<script>(function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) return;\n js = d.createElement(s); js.id = id;\n js.src = \"https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9\";\n fjs.parentNode.insertBefore(js, fjs);\n}(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-video\" data-href=\"https://www.facebook.com/facebook/videos/10153231379946729/\"><div class=\"fb-xfbml-parse-ignore\"><blockquote cite=\"https://www.facebook.com/facebook/videos/10153231379946729/\"><a href=\"https://www.facebook.com/facebook/videos/10153231379946729/\">How to Share With Just Friends</a><p>How to share with just friends.</p>Posted by <a href=\"https://www.facebook.com/facebook/\">Facebook</a> on Friday, December 5, 2014</blockquote></div></div>", "type": "video", "version": "1.0", "url": "https://www.facebook.com/facebook/videos/10153231379946729/", "width": "100%" }
All parameters need to be sent URL-encoded.
Parameter | Description |
---|---|
| The URL of the post or video (required) |
| The maximum width of the embedded resource (optional). Note that the |
| A JSON callback to be invoked (optional) |
| If set to true, the embed does not include the script tag (optional) |
| Set to |