Skip to the content

Music Player API: What You Can Build, and Where Playback Comes From

Music Player API: What You Can Build, and Where Playback Comes From

What Is a Music Player API?

Quick answer: "Music player API" is a search term, not one product. A music player needs a data layer (search, metadata, artwork, playlists, the user's library) and a playback layer (the audio stream and its controls). The streaming services license the audio, so playback comes from their own SDKs and embeds. MusicAPI is the data layer.

It helps to split the term in two before you pick tools:

LayerWhat it doesWho provides it
DataSearch, track metadata, artwork, playlists, liked tracks, albums, artistsMusicAPI, one API for 11 services
PlaybackThe audio stream, play, pause, skip, seek, volume, the queueThe streaming service: its SDK or its embedded player

What MusicAPI Does Not Do

We want to be exact here, because an earlier version of this article was not.

  • MusicAPI has no playback endpoints. There is no call for play, pause, skip, seek, volume or queue management.
  • MusicAPI does not stream audio. It holds no music licence and serves no full-length tracks.
  • MusicAPI does not control a user's player remotely. It cannot start or stop playback in a user's Spotify, Qobuz, Deezer or other app.

If your product needs these, you need the streaming service's own playback SDK. MusicAPI works next to it, as shown below.

What You Can Build with MusicAPI

Quick answer: Everything a player shows and manages, apart from the audio stream: catalog search, metadata and artwork, the user's playlists and library, playlist edits, transfers between services, and an embedded player from the service itself.

Search and Metadata

The catalog endpoints search the public catalogs of the services. They need no connected user, and the Client ID is enough, so they can run in a browser.

curl -X POST "https://api.musicapi.com/public/search" \
  -H "Authorization: Token $MUSICAPI_CLIENT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "track",
    "track": "Bezos I",
    "artist": "Bo Burnham",
    "sources": ["spotify", "appleMusic", "deezer"]
  }'

Each source answers with the same fields: name, artistNames, albumName, imageUrl, duration, isrc, url and previewUrl. That is the track title, the artwork and the duration that your player UI shows.

Related calls:

  • POST /public/inspect/url tells you what a shared link points at, with its metadata.
  • POST /public/search/match finds the same track, album or artist on other services.
  • GET /public/isrc/{isrc} finds the track of an ISRC on the stores that search by ISRC.

See Search and match the catalog.

The User's Library and Playlists

A user connects their account once through the hosted sign-in. You get an integrationUserUUID, and the same calls then work on every service:

const auth = Buffer.from(
  `${process.env.MUSICAPI_CLIENT_ID}:${process.env.MUSICAPI_CLIENT_SECRET}`
).toString("base64");

// The user's playlists
const playlists = await fetch(
  `https://api.musicapi.com/api/${integrationUserUUID}/playlists`,
  { headers: { Authorization: `Basic ${auth}` } }
).then((response) => response.json());

// The tracks of one playlist: name, artists, album, imageUrl, duration, isrc
const items = await fetch(
  `https://api.musicapi.com/api/${integrationUserUUID}/playlists/${playlists.results[0].id}/items`,
  { headers: { Authorization: `Basic ${auth}` } }
).then((response) => response.json());

Run these calls on your backend: they use your Client Secret. You can also create playlists, add, move and remove tracks, and read and change liked tracks, saved albums and followed artists. Not every service allows every write: the table in Services and features shows what works where. Start with the Core quickstart.

Transfers Between Services

MusicAPI Managed Transfers is a hosted, white-label flow that moves a user's playlists, liked tracks, albums and artists from the service they use now into yours. MusicAPI reads the source library, matches every item and writes it to the destination. If you prefer to build the flow yourself, the library and match endpoints above are the same building blocks.

The Embed Player

This is the one place where MusicAPI puts a player on your page, and it is the service's own player. Send a share link, and you get an iframe back:

curl -X POST "https://api.musicapi.com/public/embed/url" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://open.spotify.com/track/0pqnGHJpmpxLKifKRmU6WP"}'

The answer holds embedCode (the iframe), embedUrl, the available sizes and the defaultSize. The endpoint needs no credential. The audio, the controls and the sign-in inside the iframe belong to the streaming service: your code cannot send play or pause commands into it through MusicAPI. Try it on the embed player page.

Previews

Tracks carry a previewUrl when the service gives one. It is a short sample that a plain HTML <audio> element can play. It is often null (Spotify returns none), so treat previews as an extra, not as your playback layer.

Where Playback Comes From

Quick answer: From the streaming service. Each one has its own SDK or embed, with its own rules.

ServicePlayback optionGood to know
SpotifyWeb Playback SDK, iOS and Android SDKs, the Spotify embedFull playback needs a Spotify Premium account
Apple MusicMusicKit (JS, iOS, Android)Needs an Apple developer token and an Apple Music subscriber
YouTubeIFrame Player APIPlays the YouTube video player
Deezer, Tidal, SoundCloud and othersThe service's embedded widget, or its SDK where one existsTerms differ per service: read them first

The services license the audio, so full tracks play only through their own players. That is why MusicAPI offers no unified playback API.

How MusicAPI Fits Next to a Playback SDK

A typical multi-service player splits the work like this:

  1. Sign-in and library: MusicAPI. One hosted sign-in for every service. Your backend reads playlists, liked tracks and albums in one format.
  2. Search and matching: MusicAPI. One search across services, and the same track found on the service that this user can play.
  3. Playback: the service SDK. Take the track id from the MusicAPI answer (it is the service's own id) and hand it to that service's player, for example as spotify:track:<id> for the Spotify Web Playback SDK, or as the song id for MusicKit.
  4. A simple page with no SDK work: the embed. POST /public/embed/url gives you the service's iframe for a link.

The playback SDK signs the user in on its own terms and needs its own permissions for streaming. Plan for that sign-in in your player. MusicAPI can give your backend the user's service access token for calls that MusicAPI does not cover (Raw service tokens and refresh); whether that token may drive a playback SDK depends on the permissions of your developer app on that service.

Comparison Table: Ways to Build a Multi-Service Player

Service SDKs onlyMusicAPI + service SDKs
Sign-in, library and playlistsOne integration per serviceOne API, one response format
Catalog search and cross-service matchingYou build it per serviceIncluded
PlaybackService SDKService SDK (MusicAPI adds none)
Embedded playerPer-service embed codeOne endpoint returns the service's iframe
Moving a library between servicesYou build matching and retriesManaged Transfers, or the match endpoints

FAQ

Does MusicAPI have playback endpoints?

No. MusicAPI has no play, pause, skip, seek, volume or queue endpoints, and it does not stream audio. It gives you search, metadata, artwork, libraries, playlists, transfers and the embed player endpoint.

Can MusicAPI control playback in a user's Spotify, Qobuz or Deezer app?

No. Remote control of a user's player is not part of MusicAPI. Use the streaming service's own API or SDK for that, where the service offers one.

What does the embed player endpoint return?

An iframe of the streaming service's own player for a track, album or artist link, plus the sizes that player supports. The service plays the audio.

Can I build a player that works with several streaming services?

Yes. Use MusicAPI for the sign-in, the library and the search, so your UI and backend handle one data format. Use each service's own SDK or embed for the audio.

Can I play full tracks with the preview URL?

No. A previewUrl is a short sample, and many tracks have none. Full-length playback always goes through the streaming service's player.

Where do I start?

Read the overview, then run the Core quickstart: you connect one test account and read its playlists in about five minutes.