Skip to content

Albums

Album operations live under client.albums.

Methods

Method Returns Description
get(id, market=None) Album Fetch a single album by Spotify ID
get_several(ids, market=None) list[Album] Fetch multiple albums (max 20 IDs)
get_tracks(id, market=None, limit=20, offset=0) Page[SimplifiedTrack] Fetch tracks for an album
get_new_releases(limit=20, offset=0) Page[SimplifiedAlbum] Fetch new album releases

Market parameter

Pass an ISO 3166-1 alpha-2 country code to market when you need relinking for regional availability.

Examples

from spotify_sdk import SpotifyClient

with SpotifyClient(access_token="your-access-token") as client:
    album = client.albums.get("7ycBtnsMtyVbbwTfJwRjSP")
    tracks = client.albums.get_tracks(album.id, limit=10)
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)

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_new_releases(limit=20, offset=0) async

Get a list of new album releases on Spotify.

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

Returns:

Type Description
Page[SimplifiedAlbum]

Paginated list of new album releases.

get_several(ids, market=None) async

Get multiple albums by IDs.

Parameters:

Name Type Description Default
ids list[str]

List of Spotify album IDs. The Spotify API enforces a maximum of 20 IDs per request.

required
market str | None

An ISO 3166-1 alpha-2 country code for track relinking.

None

Returns:

Type Description
list[Album]

List of albums.

Raises:

Type Description
ValueError

If ids is empty.

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.