Skip to main content

SpotAPI symbol

SpotAPI

Async Spotify for Python. No API key for public data.

Quickstart · Try Studio · Build with it · Guides

Search Spotify from your terminal or build a Python app with typed async results. Start with the public catalogue, then connect your account for saved music, playlist editing and live player events.

SpotAPI 2 is a breaking async release. Synchronous projects can pin spotapi==1.2.8. Migration guide · Release checks

Sponsor SpotAPI · Monthly placements with category exclusivity available.

Quickstart

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

To try an unreleased checkout, run python -m pip install -e . from its root.

spotapi get SPOTIFY_URL prints details as JSON. Both commands work anonymously.

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())

No login is needed. Search ten categories, resolve Spotify links, or stream tracks from a public playlist. Public cleans up its connections for you.

Try this next

From the checkout, run either example with the same install:

python -m examples.credit_trail
python -m examples.mix_map

Credit trail connects One More Time, Harder, Better, Faster, Stronger, and Starboy through shared contributor IDs. It shows where the same person is credited as a producer, writer, or lyricist. Mix map finds harmonically compatible transitions in a public playlist and tells you how far to shift the incoming track's tempo. Pass your own Spotify links to either script.

Studio

Explore a track's credits, follow links into artists and albums, or expand the typed data behind each view. Studio can also show public lyrics and 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 provide an audio renderer.

Studio guide · Terminal inspector · Small examples

For a keyboard-driven catalogue browser, run these commands from the checkout:

python -m pip install -e ".[demo]"
python -m examples.discover "Daft Punk"

Build with it

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

For several operations, reuse a Catalogue 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)

For your own account, Private opens and closes the authenticated session:

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)

See sign-in setup for Studio login or a local cookie. Use AsyncClient directly to share transports and configure connection options.

Import result types from spotapi.models. Optional metadata stays optional, and reading a model never makes hidden HTTP requests. Catch SpotAPIError for library failures. See the guides for ownership, cancellation and explicit mutations.

Guides

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

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

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

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.

Metadata

Release files for spotapi 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotapi 2.0.0
File Size Uploaded Provenance Actions
spotapi-2.0.0.tar.gz 950.3 kB With provenance Details for spotapi-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spotapi 2.0.0
File Interpreter ABI Platform Actions
spotapi-2.0.0-py3-none-any.whl Python 3 none any Details for spotapi-2.0.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / spotapi-2.0.0.tar.gz

Download URL spotapi-2.0.0.tar.gz
Size 950.3 kB
Tags Source
SHA-256 checksum
How to use checksums
334fb795aa7a8092bb217e378ef2718165e72c0530c9a3995797926b98c2bb34
BLAKE2b-256 checksum
How to use checksums
39258d07b22f6b01a0beb149bbb8affe69f7ccb76b3fb58994894d381d7a948c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / spotapi-2.0.0-py3-none-any.whl

Download URL spotapi-2.0.0-py3-none-any.whl
Size 175.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a94e29ba79f5990f500110285557347dd80db69bca6766bd51d3a49cfdc649fc
BLAKE2b-256 checksum
How to use checksums
8b4d304a11b71af5db8d0bc07bc990e70edcdf7043b04dd457f53ed30c340dc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for spotapi 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spotapi-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page