<titledata-react-helmet="true">IPlayableItem | SpotifyAPI-NET</title><metadata-react-helmet="true"property="og:url"content="https://johnnycrazy.github.io/SpotifyAPI-NET/docs/iplayableitem"><metadata-react-helmet="true"name="docusaurus_locale"content="en"><metadata-react-helmet="true"name="docusaurus_version"content="current"><metadata-react-helmet="true"name="docusaurus_tag"content="docs-default-current"><metadata-react-helmet="true"property="og:title"content="IPlayableItem | SpotifyAPI-NET"><metadata-react-helmet="true"name="description"content="When working with playlists or the current playing context, you will encounter the IPlayableItem type, which only contains a Type property. Spotify recently introduced shows/episodes to the API, and thus had to adapt API endpoints which previously just returned track objects. Now, playlists and the current playing context can include two types: tracks and episodes. To reflect this in our models, we introduced IPlayableItem."><metadata-react-helmet="true"property="og:description"content="When working with playlists or the current playing context, you will encounter the IPlayableItem type, which only contains a Type property. Spotify recently introduced shows/episodes to the API, and thus had to adapt API endpoints which previously just returned track objects. Now, playlists and the current playing context can include two types: tracks and episodes. To reflect this in our models, we introduced IPlayableItem."><linkdata-react-helmet="true"rel="shortcut icon"href="/SpotifyAPI-NET/img/favicon.ico"><linkdata-react-helmet="true"rel="canonical"href="https://johnnycrazy.github.io/SpotifyAPI-NET/docs/iplayableitem"><linkdata-react-helmet="true"rel="alternate"href="https://johnnycrazy.github.io/SpotifyAPI-NET/docs/iplayableitem"hreflang="en"><linkdata-react-helmet="true"rel="alternate"href="https://johnnycrazy.github.io/SpotifyAPI-NET/docs/iplayableitem"hreflang="x-default"><linkrel="stylesheet"href="/SpotifyAPI-NET/assets/css/styles.834af7f3.css">
</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">var playlist = await spotify.Playlists.Get("37i9dQZEVXbMDoHDwVN2tF");</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">foreach (PlaylistTrack<IPlayableItem> item in playlist.Tracks.Items)</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">{</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> // When was it added</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> Console.WriteLine(item.AddedAt);</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> // The only propety on item is item.Type, it's a IPlayableItem</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> Console.WriteLine(item.Track.Type);</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">}</span></span></code></pre><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>Now, this type per se is probably useless to you. You're interested in the name, uri or artist of the episode/track. To get that info, you have to type cast the <code>IPlayableItem</code> to the respective type:</p><divclass="codeBlockContainer_K1bP"><divclass="codeBlockContent_hGly csharp"><pretabindex="0"class="prism-code language-csharp codeBlock_23N8 thin-scrollbar"style="color:#bfc7d5;background-color:#292d3e"><codeclass="codeBlockLines_39YC"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">foreach (PlaylistTrack<IPlayableItem> item in playlist.Tracks.Items)</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">{</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> if (item.Track is FullTrack track)</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> {</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> // All FullTrack properties are available</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> Console.WriteLine(track.Name);</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> }</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> if (item.Track is FullEpisode episode)</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> {</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> // All FullTrack properties are available</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> Console.WriteLine(episode.Name);</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain"> }</span></span><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">}</span></span></code></pre><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_Ue-o clean-btn">Copy</button></div></div><p>To this day, <code>IPlayableItem</code> can only be <code>FullTrack</code> or <code>FullEpisode</code>.</p><h2><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_2LWZ"id="fields"></a>Fields<aclass="hash-link"href="#fields"title="Direct link to heading">#</a></h2><p>When requesting just a subset of fields using the <code>fields</code> query parameter, the call might fail with an exception similar to <code>Received unknown playlist element type</code>. For example, the following call fails:</p><divclass="codeBlockContainer_K1bP"><divclass="codeBlockContent_hGly csharp"><pretabindex="0"class="prism-code language-csharp codeBlock_23N8 thin-scrollbar"style="color:#bfc7d5;background-color:#292d3e"><codeclass="codeBlockLines_39YC"><spanclass="token-line"style="color:#bfc7d5"><spanclass="token plain">var playlistGetItemsRequest = new PlaylistGetItemsReq