Every post, page and attachment hosted on WordPress.com or via Jetpack now supports the oEmbed format through our public API.

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

Endpoints:

Query string parameters:

  • for: [required] please set to your domain or company name so we can know who our friends are.
  • url: [required] any *.wordpress.com, wp.me/* and mapped [sub]domains hosted on WordPress.com, such as TechCrunch, CNN blogs and countless personal sites.
  • format: json or xml, defaults to json.
  • callback: when used with json, a javascript callback function you want wrapped around the output.
  • maxwidth and/or maxheight: max width and or height for images/thumbnails, defaults to 440x330px.
  • img_size: alternative to maxwidth/maxheight, as [width]x[height], defaults to 440x330px.
  • as_article: true or false, triggers the non-standard article extension for post/pages (see below).

The as_article parameter triggers a non-standard oEmbed output of type article. When content is served as_article, content can be found in a body property, instead of the standard html property. Other non-standard properties, such as related_topics, are also available. This output was originally made available for one of our partners, but is available to all.

Features:

  • in as_article mode, content is stripped of tags and limited to a ~256 characters excerpt (type=article, with body property).
  • in standard (as_article=false) mode, content is served as markup in full, or in excerpt if provided and as set by author (type=link, with html property).
  • supports posts and pages as link/html or article/body (see as_article argument).
  • supports attachments (picts/media/documents) as type link or type photo for images (gif, jpg, jpeg, png).
  • thumbnail for post and pages if present, from post thumb or 1st pict in content.
  • local and remote images are resized and/or re-cropped to desired dimensions, for consistency, then cached (including CDN) for speed.
  • support geolocation data, when made available by the author, through custom properties (geo_latitude, geo_longitude)
  • supports related_topics when as_article=true.

Response Examples:

Header tags:

We are now adding the related link tags to site headers, for posts, pages and attachments (for public sites only) so that 3rd-party sites can automatically discover the oEmbed representation equivalent of your content:

	<link href="http://public-api.wordpress.com/oembed/1.0/?format=json&url=http%3A%2F%2Ftekartist.org%2F2011%2F07%2F13%2Fyourself-truly-by-emma%2F&for=wpcom-auto-discovery" rel="alternate" type="application/json+oembed" />
	<link href="http://public-api.wordpress.com/oembed/1.0/?format=xml&url=http%3A%2F%2Ftekartist.org%2F2011%2F07%2F13%2Fyourself-truly-by-emma%2F&for=wpcom-auto-discovery" rel="alternate" type="application/xml+oembed" />