iFrame API for Tracks (not podcasts)

iFrame API for Tracks (not podcasts)


Hi Spotify Team! 


My Question or Issue

With the release of the iFrame API for podcasts, I was wondering if there's anything similar for non-podcasts, such as individual music tracks, or if there's anything planned down the line.



5 Replies


Embeds Intro Page :

Using an Embed, you can add a podcast, an album, or other audio content on your website that your users can listen to. It's a great way to promote your music, share your new podcast episodes with fans, or highlight your favorite album or playlist.

If the intention is to be able to play music tracks, why are non podcast URIs rejected in the iframe code? 


Source ball:

Function: "loadUri"

Error: "embed-iframe-api-v1.f175fcd3.js:formatted:1310 Uncaught Error: spotify:track:4fpxnJGDWFxjGvLJOqPPt8 is not a valid Spotify podcast URI."


T(this, "loadUri", (function(e) {
    if (e !== f.currentUri) {
        var t = a().from(e);
        if (!t || t.type !== a().Type.EPISODE && t.type !== a().Type.SHOW)
            throw new Error("".concat(e, " is not a valid Spotify podcast URI."));
        f.loading = !0;
        var r = "".concat(, "/embed-podcast/").concat(t.type, "/").concat(t.getBase62Id());
        if (f.options.startAt) {
            var n = parseInt(f.options.startAt, 10);
            isNaN(n) || (r += "?t=".concat(n))



Looking deeper, it seems like tracks use embed-legacy.js, which doesn't share the same code as the podcast's embed.js. Further, command messages are passed to the iFrame using contentWindow.postMessage, which seems to have issues where the iFrame does not receive and/or act on the messages.


I'd avoid this API until the dev team posts some updates.


any news on this subject ? 


I've been wondering the same. In your dev guides you advice us to use the code below. But as soon as you use a track URI (f.e. spotify:track:2hKdd3qO7cWr2Jo0Bcs0MA), it doesn't work anymore. Seems like we need to replace the script source. Would be great if the correct one could be provided.


    <script type="text/javascript">
      window.onSpotifyIframeApiReady = (IFrameAPI) => {
        let element = document.getElementById('embed-iframe');
        let options = {
            width: '60%',
            height: '200',
            uri: 'spotify:episode:3jv36updcfHw2rBFwZCcVu'


Same issue here, the docs do mention support for track, album, playlist embeds, but only the podcast use-case is shown. Without a documented alternative to the "" script for non-podcast content this API is unfortunately misleading and unusable.

Suggested posts

Env: prod