Skip to content

Welcome

PyPI version Python versions Actions status License

spotify-sdk is a modern, type-safe Python SDK for the Spotify Web API. Fetch albums, artists, tracks, and more with both sync and async clients.

Get Started View on GitHub


  • Installation


    Install with pip or uv and start building in seconds.

    Install

  • Quickstart


    Learn the basics with sync and async examples.

    Get started

  • API Reference


    Explore clients, services, and method signatures.

    Reference

  • Configuration


    Customize timeouts, retries, and client behavior.

    Configure

  • Auth


    Client credentials, custom providers, and token caching.

    Auth

  • Error Handling


    Handle rate limits, auth errors, and API failures gracefully.

    Learn more


Features

  • Type-safe - Full type hints with Pydantic models for all API responses
  • Sync and async - Dedicated SpotifyClient and AsyncSpotifyClient classes
  • Automatic retries - Exponential backoff with jitter for rate limits and transient errors
  • Context managers - Clean resource management with with and async with support

Quick Example

from spotify_sdk import SpotifyClient

with SpotifyClient(access_token="your-access-token") as client:
    album = client.albums.get("7ycBtnsMtyVbbwTfJwRjSP")
    print(f"{album.name} by {album.artists[0].name}")  # (1)!
  1. Output: To Pimp A Butterfly by Kendrick Lamar

See more examples


Community Project

This is an independent, community-developed library and is not affiliated with or endorsed by Spotify.