Skip to content
Aran404Public

Repository files navigation

SpotAPI symbol

SpotAPI

Spotify for Python. Async, typed, and no API key for public data.

Start · Demos · Studio · Integrate · Guides

Sponsored placements available · Sponsor SpotAPI


Search the Spotify catalogue from your terminal, or build a Python app on top of fully typed async results. Start with public data, no signup and no developer dashboard. Connect your account later for saved music, playlist editing and live player events.

SpotAPI 2 is a breaking async release. Synchronous projects can pin spotapi==1.2.8. See the migration guide and the release checks.

30-second start

Requires Python 3.11 or newer.

python -m pip install spotapi
spotapi search "Daft Punk"

Running spotapi search Daft Punk returns track names and Spotify URIs

That's it. No key, no login, no config.

Prefer Python?

import asyncio
from spotapi import Public


async def main() -> None:
    results = await Public.search("Daft Punk", limit=5)
    for track in results.tracks:
        print(track.name, track.uri)


asyncio.run(main())

Public searches ten categories, resolves Spotify links and streams tracks from public playlists. It cleans up its own connections.

Why SpotAPI

  • No API key for public data. Search, lookups, credits, lyrics and playlists work anonymously.
  • Typed and async. Every result is a model you can autocomplete, not a dict you have to guess at.
  • No surprises. Reading a model never triggers a hidden HTTP request. Optional metadata stays optional.
  • Duplicate-aware playlists. Edit one occurrence of a track without touching its twin.
  • Your account when you want it. Liked songs, rankings, playlist edits and live player events.
  • A CLI that does real work. Search, credits, playlists, library and player control from one command.
  • No developer-dashboard limits No Client ID, no Premium requirement and no user cap for public data. See the comparison.

SpotAPI vs the official Web API

In February 2026, Spotify tightened Development Mode for its official Web API. Libraries built on that API, such as Spotipy, work within those limits. SpotAPI's public/private catalogue features don't use a developer app, so none of them apply.

Official Web API (Development Mode) SpotAPI, public data
Developer app / Client ID Required, one per developer Not needed
Spotify account Premium required Not needed
Authorized users Up to five per Client ID No cap to manage
Intended use Non-commercial personal projects and learning Your call, subject to the legal notice
Setup Create an app, then wire up credentials pip install spotapi

Spotify says Development Mode is for tinkering and shouldn't be the foundation of a business. If you're building something people will actually use, that's the gap SpotAPI fills.

Based on Spotify's February 2026 announcement. The Premium requirement, user cap and one-Client-ID limit apply to existing integrations too. Spotify may change these rules again, so check the post for the latest.

See it in action

Clone the repo and run any of these from its root. Install once:

python -m pip install -e ".[demo]"
Demo What you get Run it
Discover ⭐ A keyboard-driven terminal UI for browsing Spotify's public search. No login. Start here. python -m examples.discover "Daft Punk"
Credit trail Connects One More Time, Harder, Better, Faster, Stronger and Starboy through shared contributor IDs, showing where one person is credited as producer, writer or lyricist. python -m examples.credit_trail
Mix map Finds harmonically compatible transitions in a public playlist and tells you how far to shift the incoming track's tempo. python -m examples.mix_map

Credit trail and Mix map accept your own Spotify links. Discover takes a search query.

Studio

Open a track, read its credits, follow links into artists and albums, or expand the typed data behind every view. Studio also shows public lyrics and can seek to a timed line on a connected Spotify player.

SpotAPI Studio: the listening desk

python -m pip install -e ".[studio]"
python -m examples.studio

Use Connect Spotify to sign in through Spotify's normal login window, or set SPOTIFY_COOKIE in a local .env. Cookies stay in Python. Playback controls an existing Spotify device; Studio does not render audio.

Studio guide · Small examples

Go beyond search

The CLI also looks up credits, lists playlist occurrences, manages liked tracks and controls an existing Spotify player:

spotapi search "Daft Punk" --type artist --json
spotapi get SPOTIFY_URL
spotapi credits 0DiWol3AO6WpXZgp0goxAV
spotapi playlist items PLAYLIST_ID --limit 10
spotapi library list
spotapi player status

search and get work anonymously. Library and player commands, playlist edits and playlist items --private read SPOTIFY_COOKIE from your environment. See sign-in setup.

Run spotapi playlist --help, spotapi library --help or spotapi player --help for every action. Playlist remove and move take occurrence IDs from playlist items, so duplicate tracks can be edited individually.

Build it into your app

Pick the idea closest to yours:

Your idea Start with
A DJ crate with tempo and harmonic keys Playlist crate
A credits rabbit hole Song credits
A playlist discovery companion Public.get_radio() · Public.get_playlist_recommendations()
Your own music dashboard Account, rankings and saved music
A duplicate-aware playlist curator Playlist.items() · Playlist.move_occurrences() · Playlist.remove_occurrences()
A live now-playing display Player example · Lyrics example

Public data: reuse one Catalogue

For several operations, share a single context inside your async application:

from spotapi import Catalogue

async with Catalogue() as spotify:
    results = await spotify.search("Daft Punk")
    artist = await spotify.get_artist(results.artists[0].uri)

Your own account: Private

Private opens and closes the authenticated session for you:

import os

from spotapi import Private

async with Private.from_cookies(os.environ["SPOTIFY_COOKIE"]) as spotify:
    favorites = await spotify.stats.get(time_range="medium_term", limit=5)
    for track in favorites.tracks:
        print(track.name)

Production details

  • Import result types from spotapi.models.
  • Catch SpotAPIError for library failures.
  • Use AsyncClient directly to share transports and configure connection options.
  • See the guides for ownership, cancellation and explicit mutations.

Guides

Catalogue · Account · Player · API layout · Migration from v1

Sponsorship

Sponsor SpotAPI's maintenance and development. Monthly placements include a labeled spot above Quickstart and, where relevant, a link in the guide your customers would use. Category exclusivity is available by agreement.

Contact aran.inbox.personal@gmail.com to discuss a placement and arrange payment directly through PayPal. See sponsorship details.

Contributing

Contributing · Tests · Release review · Legal notice · GPL-3.0

If SpotAPI helps you build something, a ⭐ helps other developers find it.

Releases

Packages

Used by

Contributors

Languages