Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Obtaining Artist Status, Personal Details, and Songs from Spotify User Authorization

Obtaining Artist Status, Personal Details, and Songs from Spotify User Authorization

Hello, Spotify developer community!

 

I'm reaching out to seek guidance on a specific aspect of my application's integration with the Spotify API. I have successfully implemented user authorization using Spotify, allowing users to connect their Spotify accounts to my app. Now, I'm looking to enhance the user experience by identifying whether a user is an artist on Spotify and accessing their personal details and songs. Here's what I'm trying to achieve:

1. Detecting Artist Status:

  • How can I determine whether a user who has authorized my app is an artist on Spotify? Is there a specific API endpoint or method to confirm their artist status?

2. Retrieving Personal Details:

  • Once I identify an artist, I'd like to access their personal details, including their name and profile image. What's the best way to obtain this information through the Spotify API?

3. Accessing Songs:

  • As part of the artist's profile, I want to retrieve their songs. Is there a way to access a list of songs associated with an artist, and can I filter these songs by different criteria?

Here are some details about my current implementation:

  • I'm using Node.js, and the Spotify Web API.
  • I have successfully completed the user authorization process, including obtaining access tokens.

I would greatly appreciate any guidance or examples that could help me achieve these goals. Your assistance will make a significant difference in improving my application's functionality.

Thank you in advance for your help!

Reply
5 Replies

Howldy good sir!
Certainly, I can help you with these aspects of integrating with the Spotify API without redirecting you to support or suggesting a generic troubleshooting approach.

  • Detecting Artist Status: To determine whether a user is an artist on Spotify, you can use the “Get Current User’s Profile” endpoint, which returns the user’s profile information. If a user is an artist, their profile will have a “product” field with the value “premium” or “artist_premium” (for artists). You can check this field to confirm their artist status.
  •  Retrieving Personal Details: To access an artist’s personal details like their name and profile image, you can use the same “Get Current User’s Profile” endpoint mentioned above. The response will include the display name and the profile image URL. You can access this information using the endpoint without the need for additional permissions.
  • Accessing Songs: To retrieve songs associated with an artist, you can use the “Get an Artist’s Top Tracks” endpoint by specifying the artist’s Spotify ID. This will return a list of the artist’s top tracks. You can also use other endpoints like “Get an Artist’s Albums” or “Get an Artist’s Related Artists” to explore more about the artist’s discography.

Here’s a brief example in Node.js to get an artist’s top tracks:

const fetch = require('node-fetch');

const artistId = 'YOUR_ARTIST_SPOTIFY_ID';
const accessToken = 'YOUR_ACCESS_TOKEN';

const url = `https://api.spotify.com/v1/artists/${artistId}/top-tracks?country=US`;

fetch(url, {
  headers: {
    'Authorization': `Bearer ${accessToken}`,
  },
})
  .then(response => response.json())
  .then(data => {
    // Process the list of top tracks here.
    console.log(data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Replace ‘YOUR_ARTIST_SPOTIFY_ID’ and ‘YOUR_ACCESS_TOKEN’ with your specific values. This example will give you the top tracks of the artist identified by their Spotify ID.

I hope this helps you enhance your application’s integration with the Spotify API. If you have any further questions feel free to bark more orders at me,

 

-Prague the Dog

Thanks Prague, but i think some points are missing. Like in the Detecting Artist Status for every artist the "product" field will be “artist_premium” , or any other value can also be possible? And in the Accessing Songs how can i get the artist’s Spotify ID? So what i am implementing is if my user is an artist on spotfiy then only he can login otherwise he cant login and then i am showing him all his songs with his profile picture and name and also *very important* his monthly listners

.

Hii Prague the dog, Thanks for your prev response, but i think some points are missing. Like in the Detecting Artist Status for every artist the "product" field will be “artist_premium” , or any other value can also be possible? And in the Accessing Songs how can i get the artist’s Spotify ID? So what i am implementing is if my user is an artist on spotfiy then only he can login otherwise he cant login and then i am showing him all his songs with his profile picture and name and also *very important* his monthly listners

Hi User,

It's not possible to get the monthly listeners of an artist using the Spotify Web API.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Have the list of possible strings in the "product" field changed since this post? I've tested this with an account that has Spotify for Artists access and it does not show "artist_premium" or "artist_free". Has it been recently deprecated?

Suggested posts