Albums
Album operations live under client.albums.
Methods
| Method | Returns | Description |
|---|---|---|
get(id, market=None) |
Album |
Fetch a single album by Spotify ID |
get_tracks(id, market=None, limit=20, offset=0) |
Page[SimplifiedTrack] |
Fetch tracks for an album |
get_saved(limit=20, offset=0, market=None) |
Page[SavedAlbum] |
Fetch current user's saved albums |
Market parameter
Pass an ISO 3166-1 alpha-2 country code to market when you need
relinking for regional availability.
Required scopes
Spotify requires user-scoped access tokens for library endpoints.
Ensure your auth flow requests user-library-read when using
get_saved.
Examples
import asyncio
from spotify_sdk import AsyncSpotifyClient
async def main() -> None:
async with AsyncSpotifyClient(access_token="your-access-token") as client:
album = await client.albums.get("7ycBtnsMtyVbbwTfJwRjSP")
tracks = await client.albums.get_tracks(album.id, limit=10)
saved_albums = await client.albums.get_saved(limit=10)
asyncio.run(main())
API details
The sync client mirrors these methods, minus the await keywords.
Bases: AsyncBaseService
Operations for Spotify albums.
get(id, market=None)
async
Get an album by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Spotify ID for the album. |
required |
market
|
str | None
|
An ISO 3166-1 alpha-2 country code for track relinking. |
None
|
Returns:
| Type | Description |
|---|---|
Album
|
The requested album. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If id is empty. |
get_saved(limit=20, offset=0, market=None)
async
Get albums saved in the current user's library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Maximum number of albums to return (1-50, default 20). |
20
|
offset
|
int
|
Index of the first album to return. |
0
|
market
|
str | None
|
An ISO 3166-1 alpha-2 country code. |
None
|
Returns:
| Type | Description |
|---|---|
Page[SavedAlbum]
|
Paginated list of saved albums. |
get_tracks(id, market=None, limit=20, offset=0)
async
Get an album's tracks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Spotify ID for the album. |
required |
market
|
str | None
|
An ISO 3166-1 alpha-2 country code for track relinking. |
None
|
limit
|
int
|
Maximum number of tracks to return (1-50, default 20). |
20
|
offset
|
int
|
Index of the first track to return. |
0
|
Returns:
| Type | Description |
|---|---|
Page[SimplifiedTrack]
|
Paginated list of tracks. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If id is empty. |