Using the oEmbed API
Overview
oEmbed is an API that allows third-party websites and apps to fetch and display basic information about a Spotify URL and Embeds. It commonly powers link previews, or link 'unfurling' functionality on websites with messaging and user-created posts.
Discovering oEmbed URIs
Detecting the <link> element
Most pages on open.spotify.com support oEmbed. If your application parses a Spotify web page then it can discover the corresponding oEmbed URI by searching the document for a <link>
element with the type set to application/json+oembed
. For example, the source of the NerdOut@Spotify podcast includes this HTML:
_10<link rel="alternate" type="application/json+oembed" href="https://open.spotify.com/oembed?url=https%3A%2F%2Fopen.spotify.com%2Fshow%2F5eXZwvvxt3K2dxha3BSaAe" />
Using oEmbed data from Spotify in your app
The oEmbed response is a JSON object that contains the title of the entity, an Embed code snippet, and (if available) a thumbnail image associated with the entity. You can find a sample oEmbed response below, or learn more about the oEmbed response properties through the oEmbed API reference documentation.
_13{_13 "html": "<iframe width=\"100%\" height=\"152\" title=\"Spotify Embed: My Path to Spotify: Women in Engineering \" style=\"border-radius: 12px\" frameborder=\"0\" allowfullscreen allow=\"autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture\" src=\"https://open.spotify.com/embed/episode/7makk4oTQel546B0PZlDM5?utm_source=oembed\"></iframe>\n",_13 "width": 456,_13 "height": 152,_13 "version": "1.0",_13 "provider_name": "Spotify",_13 "provider_url": "https://spotify.com",_13 "type": "rich",_13 "title": "My Path to Spotify: Women in Engineering",_13 "thumbnail_url": "https://i.scdn.co/image/ab67656300005f1ff8141e891abf749375772343",_13 "thumbnail_width": 300,_13 "thumbnail_height": 300_13}
Use cases
Common use cases for oEmbed include:
- Displaying the title of a Spotify link in an app or website
- Displaying the title and preview image of a Spotify link in an app or website
- Displaying an Embed in your app or website