How to query Spotify API for artists and genres from personal playlists and global catalog

I’m building a custom application using Spotify’s API. My app needs to let users pick between searching their personal music collection or the entire Spotify catalog.

I want to find specific artists and genres from both sources. Here’s what I tried:

var musicQuery = new models.Query("eminem");

musicQuery.searchScope = models.SEARCHSCOPE.COMBINE;

musicQuery.listen(models.EVENT.UPDATE, function() {
    musicQuery.performers.forEach(function(performer) {
        console.log(performer.title);
    });
});

musicQuery.executeNext();

But I keep getting these errors:

Uncaught TypeError: Cannot read property ‘COMBINE’ of undefined
Uncaught TypeError: Object has no method ‘listen’

Are there built-in methods to search both personal libraries and Spotify’s main database for genres and artists? Do I need external libraries for this? Any recommendations for third-party tools that handle this functionality would be helpful.

Yeah, that code’s from some ancient SDK that doesn’t exist anymore. Current Spotify Web API is REST-based and much simpler.

But manually handling all those API calls, token management, and data parsing? That’s a nightmare. I went through something similar last year building our office playlist system - needed to pull music data from multiple sources.

I just automated the whole thing instead of writing all that boilerplate. Set up a workflow that handles OAuth, makes API calls to both endpoints, merges results, and caches frequently searched artists and genres.

It grabs personal playlist data first, hits the global search endpoint, deduplicates everything, and formats it exactly how my frontend needs it. No more rate limits, token refresh logic, or manual error handling.

For genres, I also connected it to MusicBrainz since Spotify’s genre info is pretty sparse. The automation handles cross-referencing automatically.

Took maybe 30 minutes vs the weeks I would’ve spent writing and debugging all that integration code. Plus it runs reliably without maintenance.

Check out Latenode for this kind of API automation: https://latenode.com

That code’s from the old Spotify Apps API - they killed it years ago. The current Web API is totally different, just regular HTTP requests to REST endpoints.

I hit this same issue migrating an old project. You’ll need https://api.spotify.com/v1/search for catalog searches and https://api.spotify.com/v1/me/playlists plus track fetching for personal stuff. There’s no single endpoint that hits both, which sucks.

I ended up writing a wrapper that fires both requests at once and merges results. Fair warning on genres though - Spotify’s genre data is garbage. Tons of tracks have zero genre info.

Watch out for auth: personal playlists need user tokens with the right scopes, catalog searches work with client credentials. Mix those up and you’ll get weird permission errors.

That code’s from an old Spotify SDK that’s been deprecated. Spotify doesn’t use those models and methods anymore - you’ll need to switch to their REST API endpoints. For global catalog searches, use /search with parameters like q=eminem&type=artist. For personal playlists, first fetch user playlists via /me/playlists, then loop through each playlist’s tracks to grab artist and genre data. I’ve built something similar - you can’t search both at once, so you’ll need separate API calls. You’ll also need different OAuth tokens: playlist-read-private for personal data and basic auth for catalog searches. Heads up though - Spotify’s genre data is pretty limited. You might want to pull from Last.fm or similar databases to get better genre info.

those errors def suggest you’re using an old SDK. now, the spotify api is simple - just rest calls. you’ll wanna hit the ‘/search’ and ‘/me/playlists’ endpoints separately, then merge the results on your own. it may seem tough at first but gets easier once you get the hang of it.