oEmbed Endpoints for Embeddable Facebook Content

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.

Endpoint URLs

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

https://www.facebook.com/plugins/post/oembed.json/?url={content-url}

Video

https://www.facebook.com/plugins/video/oembed.json/?url={content-url}

Content URLs

Public Facebook posts and videos can use one of these URL schemes:

  • Posts:
  • 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}
  • Videos:
  • 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.

Example

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&amp;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%"
}

Parameters

All parameters need to be sent URL-encoded.

Parameter Description

url

The URL of the post or video (required)

maxwidth

The maximum width of the embedded resource (optional). Note that the maxheight parameter is not supported. This is because the embed code is responsive and its height varies depending on its width.

callback

A JSON callback to be invoked (optional)

omitscript

If set to true, the embed code does not include the script tag (optional)