<svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav><ulclass="sidebar-links"><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading open"><span>Library</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/SpotifyAPI-NET/web/library.html#savetracks"class="sidebar-link">SaveTracks</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#savetrack"class="sidebar-link">SaveTrack</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#getsavedtracks"class="sidebar-link">GetSavedTracks</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#removesavedtracks"class="sidebar-link">RemoveSavedTracks</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#checksavedtracks"class="sidebar-link">CheckSavedTracks</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#savealbums"class="sidebar-link">SaveAlbums</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#savealbum"class="sidebar-link">SaveAlbum</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#getsavedalbums"class="sidebar-link">GetSavedAlbums</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#removesavedalbums"class="sidebar-link">RemoveSavedAlbums</a></li><li><ahref="/SpotifyAPI-NET/web/library.html#checksavedalbums"class="sidebar-link">CheckSavedAlbums</a></li></ul></section></li></ul></aside><mainclass="page"><divclass="theme-default-content content__default"><h1id="library"><ahref="#library"aria-hidden="true"class="header-anchor">#</a> Library</h1><h2id="savetracks"><ahref="#savetracks"aria-hidden="true"class="header-anchor">#</a> SaveTracks</h2><blockquote><p>Save one or more tracks to the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs</td><td><code>new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">SaveTracks</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span><spanclass="token keyword">string</span><spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"3Hvu1pq89D4R0lyPBoujSv"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="savetrack"><ahref="#savetrack"aria-hidden="true"class="header-anchor">#</a> SaveTrack</h2><blockquote><p>Save one track to the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>id</td><td>A Spotify ID</td><td><code>"3Hvu1pq89D4R0lyPBoujSv"</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">SaveTrack</span><spanclass="token punctuation">(</span><spanclass="token string">"3Hvu1pq89D4R0lyPBoujSv"</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="getsavedtracks"><ahref="#getsavedtracks"aria-hidden="true"class="header-anchor">#</a> GetSavedTracks</h2><blockquote><p>Get a list of the songs saved in the current Spotify user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>[limit]</td><td>The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50.</td><td><code>20</code></td></tr><tr><td>[offset]</td><td>The index of the first object to return. Default: 0 (i.e., the first object)</td><td><code>0</code></td></tr><tr><td>[market]</td><td>An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</td><td><code>DE</code></td></tr></tbody></table><p>Returns a <code>Paging<SavedTrack>**, **SavedTrack</code> contains 2 properties, <code>DateTime AddedAt</code> and <code>FullTrack Track</code></p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code>Paging<spanclass="token operator"><</span>SavedTrack<spanclass="token operator">></span> savedTracks <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">GetSavedTracks</span><spanclass="token punctuation">(</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="removesavedtracks"><ahref="#removesavedtracks"aria-hidden="true"class="header-anchor">#</a> RemoveSavedTracks</h2><blockquote><p>Remove one or more tracks from the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs.</td><td><code>new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">RemoveSavedTracks</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span><spanclass="token keyword">string</span><spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"3Hvu1pq89D4R0lyPBoujSv"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="checksavedtracks"><ahref="#checksavedtracks"aria-hidden="true"class="header-anchor">#</a> CheckSavedTracks</h2><blockquote><p>Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs.</td><td><code>new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }</code></td></tr></tbody></table><p>Returns a <code>ListResponse<bool></code> which contains a property, <code>List<bool> List</code></p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code>ListResponse<spanclass="token operator"><</span><spanclass="token keyword">bool</span><spanclass="token operator">></span> tracksSaved <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">CheckSavedTracks</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span>String<spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"3Hvu1pq89D4R0lyPBoujSv"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
Console<spanclass="token punctuation">.</span><spanclass="token function">WriteLine</span><spanclass="token punctuation">(</span><spanclass="token string">"The track is in your library!"</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="savealbums"><ahref="#savealbums"aria-hidden="true"class="header-anchor">#</a> SaveAlbums</h2><blockquote><p>Save one or more albums to the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs</td><td><code>new List<String> { "1cq06d0kTUnFmJHixz1RaF" }</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">SaveAlbums</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span><spanclass="token keyword">string</span><spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"1cq06d0kTUnFmJHixz1RaF"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="savealbum"><ahref="#savealbum"aria-hidden="true"class="header-anchor">#</a> SaveAlbum</h2><blockquote><p>Save one album to the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>id</td><td>A Spotify ID</td><td><code>"1cq06d0kTUnFmJHixz1RaF"</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">SaveAlbum</span><spanclass="token punctuation">(</span><spanclass="token string">"1cq06d0kTUnFmJHixz1RaF"</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="getsavedalbums"><ahref="#getsavedalbums"aria-hidden="true"class="header-anchor">#</a> GetSavedAlbums</h2><blockquote><p>Get a list of the albums saved in the current Spotify user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>[limit]</td><td>The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50.</td><td><code>20</code></td></tr><tr><td>[offset]</td><td>The index of the first object to return. Default: 0 (i.e., the first object)</td><td><code>0</code></td></tr><tr><td>[market]</td><td>An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</td><td><code>DE</code></td></tr></tbody></table><p>Returns a <code>Paging<SavedAlbum></code>, <strong>SavedAlbum</strong> contains 2 properties, <code>DateTime AddedAt</code> and <code>FullAlbum Album</code></p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code>Paging<spanclass="token operator"><</span>SavedAlbum<spanclass="token operator">></span> savedAlbums <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">GetSavedAlbums</span><spanclass="token punctuation">(</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="removesavedalbums"><ahref="#removesavedalbums"aria-hidden="true"class="header-anchor">#</a> RemoveSavedAlbums</h2><blockquote><p>Remove one or more albums from the current user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs.</td><td><code>new List<String> { "1cq06d0kTUnFmJHixz1RaF" }</code></td></tr></tbody></table><p>Returns a <code>ErrorResponse</code> which just contains a possible error. (<code>response.HasError()</code> and <code>response.Error</code>)</p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code><spanclass="token class-name">ErrorResponse</span> response <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">RemoveSavedAlbums</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span><spanclass="token keyword">string</span><spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"1cq06d0kTUnFmJHixz1RaF"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
</code></pre></div><hr><h2id="checksavedalbums"><ahref="#checksavedalbums"aria-hidden="true"class="header-anchor">#</a> CheckSavedAlbums</h2><blockquote><p>Check if one or more albums is already saved in the current Spotify user’s “Your Music” library.</p></blockquote><p><strong>Parameters</strong></p><table><thead><tr><th>Name</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ids</td><td>A list of the Spotify IDs.</td><td><code>new List<String> { "1cq06d0kTUnFmJHixz1RaF" }</code></td></tr></tbody></table><p>Returns a <code>ListResponse<bool></code> which contains a property, <code>List<bool> List</code></p><p><strong>Usage</strong></p><divclass="language-csharp extra-class"><preclass="language-csharp"><code>ListResponse<spanclass="token operator"><</span><spanclass="token keyword">bool</span><spanclass="token operator">></span> albumsSaved <spanclass="token operator">=</span> _spotify<spanclass="token punctuation">.</span><spanclass="token function">CheckSavedAlbums</span><spanclass="token punctuation">(</span><spanclass="token keyword">new</span><spanclass="token class-name">List</span><spanclass="token operator"><</span>String<spanclass="token operator">></span><spanclass="token punctuation">{</span><spanclass="token string">"1cq06d0kTUnFmJHixz1RaF"</span><spanclass="token punctuation">}</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>
Console<spanclass="token punctuation">.</span><spanclass="token function">WriteLine</span><spanclass="token punctuation">(</span><spanclass="token string">"The album is in your library!"</span><spanclass="token punctuation">)</span><spanclass="token punctuation">;</span>