searchForItem

suspend fun searchForItem(q: String, types: Set<SearchType>, market: CountryCode? = null, pagingOptions: PagingOptions = PagingOptions(), includeExternalAudio: Boolean = false): SpotifyApiResponse<SearchResponse>

Searches the Spotify catalog for albums, artists, tracks, playlists, and other item types.

Return

Wrapped Spotify API response with status code and parsed Spotify payload.

Parameters

q

Search query text sent to Spotify catalog search.

types

Resource types to include in the Spotify search (album, artist, track, playlist, etc.).

market

Market (country) code used to localize and filter content.

pagingOptions

Paging options (limit, offset) used for paged endpoints. As of February 2026, Spotify lowered the search limit maximum from 50 to 10 and the default from 20 to 5. Values above 10 will be rejected by Spotify with a 400 error.

includeExternalAudio

Whether to include externally hosted audio in search results (include_external=audio).