Napster API Version 1 Overview

V1 is an old version of our API that is no longer actively supported or maintained. Take advantage of our awesome new features and switch to 2.2, our latest stable version, as soon as possible.

Versioning

All of our APIs are versioned in the URL (here, v1):

curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/art.954"

Getting Started

The first thing you'll need is an API key. All of our metadata requests (e.g., artist details, album listings, and so on — all listed at left) require an API key as a header in request:

curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/top"

You can get one by creating an app.

We've provided an API key in these docs in order to make it easy for you to get started. Resist the temptation to use it in your app! It's throttled, and you'll be missing out on some additional features and analytics as well.

Note that, throughout this documentation, there are links that have API set as a parameter but, in practice, you should always set it in the apikey header of your request.
This enables you to better take advantage of caching.

Additionally, calls made on a member's behalf — e.g., adds to library, playlist manipulation, favorites, etc. — require an OAuth access token. See below for documentation and examples.


Common Features

Paging

Most of the APIs you'd expect to support paging, do (charts lists, etc.). Use limit and offset parameters to get what you want, like so:

curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/top?limit=5"
curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/top?limit=5&offset=5"

Cross-Origin Resource Sharing (CORS)

In general, we're CORS-friendly.

International Catalog

Unless otherwise specified, all metadata requests will be routed to the US catalog. If you'd like to use a specific catalog other than US, just pass in the two-letter country code (which is case-sensitive):

curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/art.978/bio?limit=5&catalog=DE"
curl -X GET -H "apikey: {api_key}" "https://api.napster.com/v1/artists/art.978/bio?limit=5&catalog=US"

Authenticated requests (e.g., those made with OAuth access tokens) will be routed automatically to the member's default catalog.

Napster uses ISO 3166-1 alpha-2 country codes to identify different countries' catalogs.

Pretty Print JSON

All the API calls are minified by default. You can pretty print the JSON object if you add pretty=true parameter to API calls.

Errors

Napster API attempts to return appropriate HTTP status codes for every request.

Status codes
Code Text Description
200 OK Success!
201 Created The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the Location HTTP header field of the response.
202 Accepted The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.
204 No Content The server has fulfilled the request but does not need to return an entity-body
400 Bad Request The request was invalid or cannot be otherwise served. A response error message may explain reasons in more detail.
401 Unauthorized Authentication credentials were missing or incorrect. If you are accessing metadata API endpoints only with apikey, check that it is valid.
403 Forbidden The request is understood, but it has been refused or access is not allowed. This status code is used when you try to modify or access resources you do not have permission for.
404 Not Found The URI requested is invalid or the resource requested does not exist.
405 Method Not Allowed The method specified in the request is not allowed for the resource identified by the request URI. See response headers for allowed methods.
409 Conflict The request could not be completed due to a conflict with the current state of the resource you were trying to update.
413 Payload Too Large The attached object was too large. Try again with a smaller object.
429 Too Many Requests Used when a request cannot be served due to the rate limit having been exhausted (throttling).
500 Internal Server Error Something is broken. Please email all relevant details to api-feedback@napster.com.

For a more detailed and general list of status codes with explanations see here.

Error messages

When Napster API's return an error message it is in JSON format and might look something like this:

{
  code: "ResourceNotFound",
  message: "Unable to find an artist with ID 'art.test'."
}
It is very useful to observe the code (HTTP status code name) and message fields while observing or debugging responses.

API Rate Limits

Our Rate limit is 500 requests per second per application.

If you have exceeded the rate limit, you will receive a 429 error similar to the following:

{"code":"TooManyRequestsError","message":"Rate of 2/sec has been exceeded for this application"}

Authentication (OAuth 2.0)

Napster supports the OAuth 2 standard for making API calls on behalf of a member. In general, you will need an OAuth access token for any endpoint that begins with /me . We currently support the two most common flows:

  • Implicit (a.k.a., the "three-legged" OAuth flow), and
  • Resource Owner Password Credentials (a.k.a., the "password-grant" OAuth flow)

Implicit (Recommended)

See what it looks like for a client to integrate 3 legged Oauth with the code sample provided here: https://jsfiddle.net/napstercat/zf0wjup7/

In this flow, your application directs the member (in a Web browser) to a Napster-hosted sign-in form, where she's prompted to authorize your application:

  "https://api.napster.com/oauth/authorize?client_id={api_key}&redirect_uri=http://yourdomain.com/somepath&response_type=code"

An optional state parameter for this request is also supported as described by OAuth RFC 6749.

"https://api.napster.com/oauth/authorize?client_id={api_key}&redirect_uri=http://yourdomain.com/somepath&response_type=code&state={your_state_value}"

If the member accepts your request for authentication, we redirect back to your redirect_uri with a temporary code in the code query parameter. If originally passed in, the state parameter is also returned, unchanged.

http://yourdomain.com/somepath?code={temporary_code}&state={your_state_value}

Then, exchange this code for an access token, using your application secret:

curl -v -X POST -d "client_id={api_key}&client_secret={api_secret}&response_type=code&grant_type=authorization_code&redirect_uri={redirect_uri}&code={temporary_code}" "https://api.napster.com/oauth/access_token"

If the member cancels the authentication in the middle of the OAuth flow, the member is sent back to the redirect_uri with the error, error_reason and error_description parameters describing the error. If originally passed in, the state parameter is also returned, unchanged.

{redirect_uri}?error=access_denied&error_reason=user_denied&error_description=The%20user%20denied%20your%20request.&state={your_state_value}

Password Grant

In this flow, you exchange a member's username and password (which your application obtains directly from the member) for an access token and a refresh token. You can then safely store these two tokens in your application, and use them to make authenticated calls.

curl -v -X POST -u "{api_key}:{api_secret}" -d "username=user@domain.com&password=secret&grant_type=password" "https://api.napster.com/oauth/token"

Access Token Responses

In either flow, you'll receive an access_token and a refresh_token:

{
  "access_token" : "HYGIuQkfWHawATkDSfJC5acAl7ed",
  "refresh_token" : "YUPzO9xC0kfyWq8Vi8OIzpfaPW2PO6x9",
  "expires_in" : "86399"
}

Using these (example) tokens, you can make API requests on the member's behalf — for instance, to obtain the member's listening history, passing the access token value in an Authorization header (of type "Bearer"):

curl -v -H "Authorization: Bearer HYGIuQkfWHawATkDSfJC5acAl7ed" "https://api.napster.com/vonsole/v1/me/listens"

Token Expiration

Access tokens expire regularly, so your application should take steps to refresh them as needed. (Note the expires_in value above, which denotes that the associated token expires in 86399 seconds, or just under 24 hours.) To do so, simply call the access_token service, passing your client secret:

curl -v -X POST -d "client_id={api_key}&client_secret={api_secret}&response_type=code&grant_type=refresh_token&refresh_token={refresh_token}" "https://api.napster.com/oauth/access_token"

Metadata APIs

Metadata APIs provide information about musical and editorial content available through Napster.

Artists

GET Top Artists

Returns an optionally paged list of the top artists across all of Napster, driven by listening activity.

GET Artist Detail

Returns a given artist's name, ID and primary genre.

GET Artist Images

Returns a list of licensed images for an artist.

GET Bios & Blurbs

Returns biographical info for a given artist, including up to five short "blurbs" written by our editorial staff.

GET Discography

Returns the artist's full discography, sorted descendingly by release date.

GET New Releases by Artist

Returns a list of an artist's new releases (if any), updated weekly.

GET Top Albums for an Artist

Returns an optionally paged list of the artist's most popular albums, sorted descendingly by listening activity.

GET Top Tracks for an Artist

Returns an optionally paged list of the artist's most popular songs, sorted descendingly by listening activity.

GET Similar Artists

Returns a list of artists related to a given artist, grouped by relationship type. Hand-picked by our editorial staff.

GET Editorial Posts by Artist

Returns a list of blog posts and other features related to an artist, written by our editorial staff.


Albums

GET New Releases

Returns a list of all new releases, updated daily.

Optionally, pass in the guid parameter to get personalized new releases based upon recent listening history.

GET Staff Picks

Returns a list of the staff picked albums across Napster. Optionally paged. Defaults to the first 20.

GET Top Albums

Returns a list of the top albums across Napster, updated daily. Optionally paged.

GET Album Detail

Returns detailed information about a given album, including its tracks.

GET Album Images

Returns a list of licensed imagery for a given album.

GET Album Tracks

Returns a list of the specified album's tracks.

GET Similar Albums

Returns a list of albums similar to the one specified. Hand-picked by our editorial staff.

GET Album Reviews

Returns a list of reviews of the specified album.

GET Editorial Posts by Album

Returns a list of blog posts and other features related to an album, written by our editorial staff.


Tracks

GET Top Tracks

Returns a list of the top tracks across Napster, updated daily.

GET Track Detail

Returns detailed information about a track, including artist and album and genre information.


Genres

GET All Genres and Subgenres

Returns a hierarchical map of all genres and subgenres.

Use optional lang parameter to specify a language for the response.

Napster uses IETF RFC 5646 language codes to identify different languages.

GET Genre Detail

Returns detailed information about a genre, including description.

Use optional lang parameter to specify a language for the response.

Napster uses IETF RFC 5646 language codes to identify different languages.

GET Editorial Posts by Genre

Returns a list of blog posts and other features by genre, written by our editorial staff.

GET Programmed Stations by Genre

Returns a list of editorially-programmed radio stations by genre.

GET Top Artists by Genre

Returns an optionally paged list of the most popular artists by genre, updated daily.

GET Top Albums by Genre

Returns an optionally paged list of the most popular albums by genre, updated daily.

GET New Release Albums by Genre

Returns a list of all new releases by genre.

GET Top Tracks by Genre

Returns an optionally paged list of the most popular tracks by genre and subgenre, updated daily.


Playlists

GET Playlists of the Day Curated by Editorial

GET Featured Playlists

GET Playlist Detail

GET Playlist Tracks

Returns a list of the tracks comprising a playlist.

GET Tags Used in a Playlist

Returns a list of tags to describe a published playlist.

GET Editorial Posts by Playlist

Returns a list of blog posts written by our editorial staff associated with the playlist.


Stations

Stations, also referred to as 'programmed stations', are continuously streaming options which are seeded with by editorial staff or members and provide hours of uninterrupted listening content.

GET Top Stations

Returns an optionally paged list of popular stations.

GET Decade Stations

Returns a list of stations themed around musical decades.

GET Station Detail

Returns information about a given station.


Editorial Posts

Posts are rich content created by our editorial staff. Each post focuses on an artist, genre, album, musical movement, concert, or special exclusive content and provides listening content along with descriptive material about the content.

GET All Posts

Returns an optionally paged list of all featured editorial posts, sorted by date.

GET Post Categories

Returns a list containing all post categories for display in a menu.

GET Posts by a Category

Returns all Posts grouped under a Category

GET Post Detail

Returns a full post.


Editorial Tags

Provides information about editorial (id-based) tags. These tags are associated with tracks or playlists and serve to associate content with information about Genres (such as Soul/R&B), Themes (such as Summer), or even Activity (such as Travel). Editorial tags are labels in the system that have an associated id which start with 'tag.' such as 'tag.152196532'.

GET All Tags

Returns a list of all tags.

GET Featured Tags

Returns a list of featured tags.

GET Tag Details

Returns a tag with details

GET Tag Details by Shortcut

Returns a tag with details using its shortcut.

GET Playlists by a Tag

Returns a listed of playlists by a tag



Geographic Location

GET Detect Geographic Location

Returns the geographic location of the member.


Member APIs

Authenticated Member APIs provide information about Napster members. Any calls to these /me endpoints require OAuth access tokens to access data on behalf of the member. See Authentication Section for details on how to obtain an access token.

Account

GET Member Account Details

Get the account and subscription information for a member's account. See below for explanation of logic for client interpretation.

curl -v -X GET -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/account"

This returns the member's account subscription and account information. Within this returned data, the following must be checked:

  1. If either the value of the isSuspended element is true, or the value of the state element is "EXPIRED", you should message the member that there is a problem with their account and direct them to http://www.napster.com if possible.
  2. Must look to canStream* entitlements for your specific integration type (Web, Home Audio Device, etc.) For example, if your integration is for a home audio streaming product, you will need to check to ensure that the value of the canStreamOnHomeDevice element is true. If this is false you cannot permit streaming on the device, should message the member that they need to upgrade their account to use on the device, and direct them to http://www.napster.com if possible.

Favorites

GET Member Favorite Tracks

Returns a list of first 20 favorite tracks in a member's library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/favorites"
curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/favorites?limit=5&offset=5"

GET Check If Track Is a Favorite

Returns the favorite track id if the track is a favorite in the member's library, otherwise will return a 404 error.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/favorites/{track_id}"

PUT Add Track to Favorites

Add a track to the member's favorites. A list of one or more tracks can be favorited at a time. The whole track object may be used but the track id is the only required property.

curl -v -X PUT -H "Authorization: Bearer {access_token}" -H "Content-Type: application/json" -d '{ "favorites": [{ "id": "Tra.139755200" }] }'  "https://api.napster.com/v1/me/favorites"

DELETE Remove Track from Favorites

Deletes a track from the member's favorites.

curl -v -X DELETE -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/favorites/Tra.139755200"

Library

Library is a collection of content a member has curated by 'adding to library'. A member's library contains tracks, artists, albums, and stations.

Library APIs require OAuth access tokens over HTTPS.

GET All Artists in Library

Returns a list of all artists in the member's library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/artists"

WARNING Depending on the size of the member’s library this request could take a considerable amount of time to respond. It is recommended that you use the limit and offset parameters to incrementally get all the data.

GET All Artist's Albums in Library

Returns a list of albums in a member’s library by the artist. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/artists/art.954/albums?limit=3&offset=3"

GET All Artist's Tracks in Library

Returns a list of all tracks by a given artist in the member's library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/artists/art.954/tracks"

GET All Albums in Library

Returns a list of albums in a member’s library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/albums"

WARNING Depending on the size of the member’s library this request could take a considerable amount of time to respond. It is recommended that you use the limit and offset parameters to incrementally get all the data.

POST Add Album to Library

Adds an album to the member's library.

curl -v -X POST -H "Authorization: Bearer {access_token}" -d "id=alb.42020471" "https://api.napster.com/v1/me/library/albums"

DELETE Remove Album from Library

Deletes an album from the member's library.

curl -v -X DELETE -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/albums/alb.42020471"

GET Get Album's Tracks in Library

Retrieves a list of tracks for a specific album in the member's library.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/albums/alb.42020471/tracks"

GET All Tracks in Library

Returns a list of all tracks in the member's library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/tracks?limit=5&offset=2"

WARNING Depending on the size of the member’s library this request could take a considerable amount of time to respond. It is recommended that you use the limit and offset parameters to incrementally get all the data.

POST Add Track to Library

Adds a track to the member's library.

curl -v -X POST -H "Authorization: Bearer {access_token}" -d "id=tra.5156528" "https://api.napster.com/v1/me/library/tracks"

DELETE Remove Track from Library

Deletes a track from the member's library.

curl -v -X DELETE -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/library/tracks/tra.5156528"

GET All Playlists in Library

Returns a list of all playlists in a member's library. It is recommended that you use the limit and offset parameters to incrementally get all the data.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists"
curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists?limit=5&offset=5"

GET Details for Playlist in Library

Returns a specific playlist, including its tracks.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists/mp.152031586"

POST Create a Playlist and Add to Library

Creates a new playlist, given a name.

curl -v -X POST -H "Authorization: Bearer {access_token}" -d "name=My+New+Playlist" "https://api.napster.com/v1/me/playlists"

PUT Rename Playlist in Library

Renames a playlist.

curl -v -X PUT -H "Authorization: Bearer {access_token}" -d "name=My+Renamed+Playlist"  "https://api.napster.com/v1/me/playlists/mp.152031586"

DELETE Remove Playlist from Library

Deletes a playlist.

curl -v -X DELETE -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists/mp.152031586"

GET Tracks for Playlist in Library

Returns only the tracks of a given playlist.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists/mp.152031586/tracks"

POST Add Track to Playlist in Library

Adds a track to a playlist.

curl -v -X POST -H "Authorization: Bearer {access_token}" -d "id=tra.5156528" "https://api.napster.com/v1/me/playlists/mp.152031586/tracks"

PUT Update/Reorder Playlist in Library

Updates/reorders the tracks in a given playlist (including deletes).

curl -v -X PUT -H "Authorization: Bearer {access_token}" -d "id=tra.5156528&id=tra.2169032"  "https://api.napster.com/v1/me/playlists/mp.152031586/tracks"

DELETE Remove Tracks from Playlist in Library

Deletes all tracks from an existing playlist.

curl -v -X DELETE -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/playlists/mp.152031586/tracks"

GET All Programmed Stations in Library

Returns a list of all programmed stations in a member's library. Accepts optional parameters limit and offset to select a range of results.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/stations"
curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/stations?limit=5"
curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/stations?limit=5&offset=5"

POST Add Programmed Station to Library

Adds a programmed station to the member's library.

curl -v -X POST -H "Authorization: Bearer {access_token}" -d "id={ID}" "https://api.napster.com/v1/me/stations"

Listening History

GET Recent Tracks

Returns the last 150 songs listened to.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/listens"

Charts

The charts api provides information about a member's most played tracks, albums, genres and artists. Charts APIs require OAuth access tokens over HTTPS.

GET Top Played Tracks

Returns a list of most played tracks, ordered by play count, updated daily. Defaults to limit of 20.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/tracks"

Use optional range parameter with supported values: week, month, year, life to determine the most played tracks over a specific time period. Defaults to range of week.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/tracks?range=month"

GET Top Played Artists

Returns a list of most played artists, ordered by play count, updated daily. Defaults to limit of 20.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/artists"

Use optional range parameter with supported values: week, month, year, life to determine the most played tracks over a specific time period. Defaults to range of week.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/artists?range=month"

GET Top Played Albums

Returns a list of most played albums, ordered by play count, updated daily. Defaults to limit of 20.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/albums"

Use optional range parameter with supported values: week, month, year, life to determine the most played tracks over a specific time period. Defaults to range of week.

curl -v -H "Authorization: Bearer {access_token}" "https://api.napster.com/v1/me/charts/albums?range=month"

Playback

In order to enable full track playback, you need to use one of our supported Napster SDKs.

If your platform is not currently supported, please send us an email with information about your request to api-inquiries@napster.com. We will evaluate all inquiries, but not all requests will be accepted. Also, due to volume there may be a delay in response time.


Images

To improve performance of the service, most APIs return light metadata, which, for all but albums, does not contain image URLs. For any items requiring an image, the client should use the imageserver service, which provides deterministic URLs for images that the client can programmatically generate for the target content item.

Napster image server supports jpg images.

If there are specific image sizes required for your implementation please let your Napster representative know for confirmation of support or addition to the service.

Artists

GET Get an Artist Image

Generate a valid request URL for an artist image.

Use one of the following sizes for the image.

  • 70x47
  • 150x100
  • 356x237
  • 633x422
http://direct.napster.com/imageserver/v2/artists/{artist_id}/images/{size}.{extension}

Tracks and Albums

GET Get a Track or Album Image

Generate a valid request URL for a track or album image. Tracks use the image for their parent album. For any endpoints where track metadata is returned, the album id is also returned. This id should be used to get the appropriate image for the track.

Use one of the following sizes for the image.

  • 70x70
  • 170x170
  • 200x200
  • 300x300
  • 500x500
http://direct.napster.com/imageserver/v2/albums/{album_id}/images/{size}.{extension}

Playlists

GET Get a Playlist Image

Generate a valid request URL for a playlist image. There are no associated images available in metadata for member playlists, so a montage of the playlist’s content items is generated.

Accepted montage parameter values are "3x2" or "2x2". By default, the order of the images depends the playlist's track order. If you specify order parameter value to "frequency", the order of the images will depend on the occurance of the artist in the playlist instead.

Use one of the following sizes for the image.

  • 230x153
  • 1200x400
  • 1800x600
http://direct.napster.com/imageserver/v2/playlists/{playlist_id}/artists/images/{size}.{extension}

Genres

GET Get a Genre Image

Generate a valid genre image. There are no associated images available in metadata for genres, so a montage of the genre’s artists is generated. It is not required to display genre images in association with the genre name.

Use one of the following sizes for the image.

  • 161x64
  • 240x160
http://direct.napster.com/imageserver/images/{genre_id}/{size}.{extension}

Stations

GET Get a Station Image

Generate a valid request URL for an station image.

Use one of the following sizes for the image.

  • 230x153
  • 400x400
  • 500x500
http://direct.napster.com/imageserver/v2/stations/{station_id}/images/{size}.{extension}

Image IDs

GET Constructing URL to Images from Image IDs

Some API calls contain image IDs that looks like "imgs.70051876". You can construct an image url by following the pattern below.

Use one of the following sizes for the image.

  • 70x70
  • 170x170
  • 200x200
  • 300x300
  • 500x500
http://direct.napster.com/imageserver/v2/imagesets/{image_ids}/images/{size}.jpg