UP | HOME

spotify api

1. getting credentials

  • go to dashboard
  • get client id
  • get client secret
  • use this to get an access token
curl -X POST "https://accounts.spotify.com/api/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"
  • you will get back an access code that looks like this
{
  "access_token": "access_token",
  "token_type": "Bearer",
  "expires_in": 3600
}

2. getting playlist data

curl --request GET \
  --url https://api.spotify.com/v1/playlists/<url>/tracks \
  --header 'Authorization: Bearer <token>'

Created: 2024-07-15 Mon 01:38