Skip to main content

Spotify SDK for Python

A type-safe Python SDK for the Spotify Web API with full async support, automatic retries, and comprehensive error handling

Quick start

Get up and running with the Spotify SDK in minutes

1

Install the package

Install the SDK using pip or uv:
pip install spotify-sdk
2

Create a client

Initialize the client with your access token:
from spotify_sdk import SpotifyClient

client = SpotifyClient(access_token="your-access-token")
Need credentials? Get them from the Spotify Developer Dashboard
3

Make your first request

Fetch album details with full type safety:
album = client.albums.get("5K79FLRUCSysQnVESLcTdb")
print(f"{album.name} by {album.artists[0].name}")
# Output: "DeBÍ TiRAR MáS FOToS by Bad Bunny"

client.close()

Explore the SDK

Discover all the features and services available

Authentication

Learn about access tokens, client credentials, and authorization code flows

Async support

Use AsyncSpotifyClient for concurrent requests and better performance

Error handling

Handle rate limits, authentication errors, and server failures gracefully

Context managers

Manage resources cleanly with with and async with support

API services

Access all Spotify Web API endpoints with type-safe methods

Albums

Get albums, tracks, and discographies

Artists

Fetch artist details and top tracks

Playlists

Create and manage playlists

Tracks

Search and retrieve track information

Users

Access user profiles and preferences

Search

Search across all content types

Ready to build?

Start building your Spotify integration with our comprehensive SDK

Get Started Now

Build docs developers (and LLMs) love