New Releases
Explore newly released albums using the Spotify API.
We'll cover the following
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 |
| Optional | Integer | This limits the number of items to be returned in the response. Its value ranges from |
| 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 |
| 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.
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 |
| String | This defines the album's type. |
| String | We can use this link to redirect the user to the requested item on Spotify. |
| String | This is the Spotify ID of the requested item. |
| String | This is the name of the requested item. |
| String [array] | This is a list of countries where the album is available. |
| Object [array] | This array contains the links of images associated with the albums and their dimensions. |
| String | This is the release date of the album. |
| Integer | This is the number of tracks the album contains. |