New Releases

Explore newly released albums using the Spotify API.

Is it boring to listen to the same old music over and over? The Get New Releases endpoint of the Spotify API can help get rid of boredom.

The base URL https://api.spotify.com/v1/browse/new-releases is used to get a list of newly released albums featured on Spotify.

Request parameters

The information obtained by calling this endpoint can be filtered using the following query parameters:

Query parameter

Category

Type

Description

limit

Optional

Integer

This limits the number of items to be returned in the response. Its value ranges from 0 to 50 and the default value is 20.

market

Optional

String

This is an ISO 3166-1 alpha-2 country code that we can use to fetch only the content available in a specific country. Some examples of country codes are us for the United States, es for Spain, and fr for France. If we send an auth code access token in the request header, the user's country will take priority over the country specified in this parameter.

offset

Optional

Integer

This parameter can be used to offset the first item we get in response.

The following code uses this endpoint to get the information about newly released albums via the client credentials access token for authorization.

Press + to interact
const endpointUrl = new URL('https://api.spotify.com/v1/browse/new-releases');
headerParameters = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{CLIENT_CREDENTIALS_ACCESS_TOKEN}}'
}
const options = {
method: 'GET',
headers: headerParameters
};
async function fetchNewReleases() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
}
catch (error) {
printError(error);
}
}
fetchNewReleases();

Let's look at the code explanation:

  • Line 1: We set the URL to https://api.spotify.com/v1/browse/new-releases.

  • Lines 13–21: We define a function named fetchNewReleases() that calls the defined endpoint and prints the response.

We can use the limit parameter to limit the number of albums we get in response. Let's say we want to get only ten albums in response. In that case, we append ?limit=10 to the base URL in line 1.

Note: If we use the authorization code access token for verification, we'll get a different list of albums. This list will be filtered based on the country associated with our ID since we ourselves are the users who granted the permission for this token.

Response fields

Given below are some important response fields from the code above:

Response field

Type

Description

album_type

String

This defines the album's type.

spotify

String

We can use this link to redirect the user to the requested item on Spotify.

id

String

This is the Spotify ID of the requested item.

name

String

This is the name of the requested item.

available_markets

String [array]

This is a list of countries where the album is available.

images

Object [array]

This array contains the links of images associated with the albums and their dimensions.

release_date

String

This is the release date of the album.

total_tracks

Integer

This is the number of tracks the album contains.