SearchAPI

class minim.api.spotify.SearchAPI(client: APIClient, /)[source]

Bases: SpotifyResourceAPI

Search API endpoints for the Spotify Web API.

Important

This class is managed by SpotifyWebAPIClient and should not be instantiated directly.

Parameters:
clientminim.api._shared.APIClient

API client instance used to make HTTP requests.

Methods

search

Search > Search for Item: Search for albums, artists, playlists, tracks, shows, episodes, and/or audiobooks in the Spotify catalog.

search(query: str, /, item_types: str | Collection[str], *, external_content: str | None = None, country_code: str | None = None, limit: int | None = None, offset: int | None = None) dict[str, Any][source]

Search > Search for Item: Search for albums, artists, playlists, tracks, shows, episodes, and/or audiobooks in the Spotify catalog.

Important

Audiobooks are only available in the US, UK, Canada, Ireland, New Zealand, and Australia markets.

Parameters:
querystr, positional-only

Search query.

Tip

Searches can be narrowed using field filters, such as album, artist, track, year, upc, tag:hipster, tag:new, isrc, and genre. Each filter applies only to certain result types:

  • artist and year can be used when searching albums, artists and tracks. The year filter accepts a year or a range (e.g., "year:1955-1960").

  • album can be used when searching albums and tracks.

  • genre can be used when searching artists and tracks.

  • isrc and track can be used when searching tracks.

  • upc, tag:new, and tag:hipster can be used when searching albums. The tag:new filter returns albums released in the past two weeks, and the tag:hipster filter returns albums in the lowest 10% popularity.

Example: "remaster track:Doxy artist:Miles Davis".

item_typesstr or Collection[str]

Types of items to return.

Valid values: "album", "artist", "playlist", "track", "show", "episode", "audiobook".

Examples: "artist", "track,episode", ["album", "playlist"].

external_contentstr; keyword-only; optional

Externally hosted content that the client can play.

Valid value: "audio".

country_codestr; keyword-only; optional

ISO 3166-1 alpha-2 country code. If provided, only content available in that market is returned. When a user access token accompanies the request, the country associated with the user account takes priority over this parameter.

Note

If neither a country code is provided nor a country can be determined from the user account, the content is considered unavailable for the client.

Example: "ES".

limitint; keyword-only; optional

Maximum number of items to return.

Valid range: 1 to 10.

API default: 5.

offsetint; keyword-only; optional

Index of the first item to return. Use with limit to get the next batch of items.

Valid range: 0 to 1_000.

Minimum value: 0.

API default: 0.

Returns:
itemsdict[str, Any]

Page of Spotify metadata for the matching catalog items.