Audiobooks
Audiobook operations live under client.audiobooks.
Methods
| Method | Returns | Description |
|---|---|---|
get(id, market=None) |
Audiobook |
Fetch a single audiobook by Spotify ID |
get_chapters(id, market=None, limit=20, offset=0) |
Page[SimplifiedChapter] |
Fetch chapters for an audiobook |
get_saved(limit=20, offset=0) |
Page[SavedAudiobook] |
Fetch current user's saved audiobooks |
Market parameter
Pass an ISO 3166-1 alpha-2 country code to market to ensure availability.
Limited availability
Audiobooks are currently available only in select markets.
Required scopes
Spotify requires user-scoped access tokens for saved audiobook access.
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:
audiobook = await client.audiobooks.get("7iHfbu1YPACw6oZPAFJtqe")
chapters = await client.audiobooks.get_chapters(audiobook.id, limit=10)
saved_audiobooks = await client.audiobooks.get_saved(limit=10)
asyncio.run(main())
API details
The sync client mirrors these methods, minus the await keywords.
Bases: AsyncBaseService
Operations for Spotify audiobooks.
get(id, market=None)
async
Get an audiobook by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Spotify ID for the audiobook. |
required |
market
|
str | None
|
An ISO 3166-1 alpha-2 country code for availability. |
None
|
Returns:
| Type | Description |
|---|---|
Audiobook
|
The requested audiobook. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If id is empty. |
get_chapters(id, market=None, limit=20, offset=0)
async
Get an audiobook's chapters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Spotify ID for the audiobook. |
required |
market
|
str | None
|
An ISO 3166-1 alpha-2 country code for availability. |
None
|
limit
|
int
|
Maximum number of chapters to return (1-50, default 20). |
20
|
offset
|
int
|
Index of the first chapter to return. |
0
|
Returns:
| Type | Description |
|---|---|
Page[SimplifiedChapter]
|
Paginated list of chapters. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If id is empty. |
get_saved(limit=20, offset=0)
async
Get audiobooks saved in the current user's library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Maximum number of audiobooks to return (1-50, default 20). |
20
|
offset
|
int
|
Index of the first audiobook to return. |
0
|
Returns:
| Type | Description |
|---|---|
Page[SavedAudiobook]
|
Paginated list of saved audiobooks. |