MusicBrainz

Music API · Works globally · Comprehensive music database

TL;DR

MusicBrainz is an open-source music encyclopedia with deeply detailed metadata for millions of artists, albums, recordings, and labels. Unlike streaming service APIs, MusicBrainz is community-curated — think Wikipedia for music. Search by artist, album, or track name via their XML/JSON web service. Returns release dates, track listings, recording IDs, label info, barcodes, and community-applied tags. Free, no API key required, with a well-documented query language.

Quick start: https://musicbrainz.org/ws/2/artist/?query=beatles&fmt=json

No API key needed — just make a request!

Search for The Beatles: https://musicbrainz.org/ws/2/artist/?query=beatles&fmt=json

How to Use This API

1. Search Artists

Use Lucene-style query syntax:

https://musicbrainz.org/ws/2/artist/?query=beatles&fmt=json

2. Search Recordings (Songs)

https://musicbrainz.org/ws/2/recording/?query=artist:radiohead+track:creep&fmt=json

3. Get Artist with Releases

Include release groups in the response using the inc parameter:

https://musicbrainz.org/ws/2/artist/a74b1b7f-71a5-4011-9441-d0b5e4122711?inc=release-groups&fmt=json

4. JavaScript — Search Artist Discography

async function searchArtist(name) {
  const resp = await fetch(
    `https://musicbrainz.org/ws/2/artist/?query=${encodeURIComponent(name)}&fmt=json`
  );
  const data = await resp.json();
  
  if (data.artists?.length) {
    const artist = data.artists[0];
    console.log(`Found: ${artist.name}`);
    console.log(`Type: ${artist.type}`);
    console.log(`Country: ${artist.country}`);
    console.log(`Born: ${artist['life-span']?.begin || '?'}`);
  }
}

searchArtist('radiohead');

5. Python — Get Album Tracklist

import requests

params = {
    'query': 'artist:miles+davis+album:kind+of+blue',
    'fmt': 'json',
    'limit': 1
}
resp = requests.get(
    'https://musicbrainz.org/ws/2/release/',
    params=params
)
release = resp.json()['releases'][0]
print(f"Album: {release['title']}")
print(f"Date: {release.get('date', '?')}")
print(f"Tracks: {release.get('track-count', '?')}")

# Get track list using the release ID
rid = release['id']
tracks = requests.get(
    f'https://musicbrainz.org/ws/2/release/{rid}',
    params={'inc': 'recordings', 'fmt': 'json'}
).json()
for track in tracks.get('media', [{}])[0].get('tracks', []):
    print(f"  {track['number']}. {track['title']}")

Frequently Asked Questions

What entity types can I search?
Artist, release (album), recording (track), label, work (composition), event, series, place, and instrument — each with its own endpoint and query syntax.
What is the MusicBrainz ID (MBID)?
Every entity in MusicBrainz has a permanent UUID identifier. Once you find an artist, you can use their MBID for precise lookups without text searches.
Do I need an API key?
No. MusicBrainz is open source and the public API is free without authentication. However, you should set a User-Agent header identifying your application.
Are there rate limits?
Rate limits are enforced primarily through monitoring — the service asks that you limit requests to 1 per second and set a meaningful User-Agent header.
What format does the response use?
XML by default. Add &fmt=json to get JSON output. JSON is more convenient for JavaScript and Python applications.
Can I get cover art from MusicBrainz?
Cover art is provided by the separate Cover Art Archive API. Use the release MBID to query https://coverartarchive.org/release/{mbid}/front.

API Details

API URL
https://musicbrainz.org/ws/2
Documentation
musicbrainz.org/ws/2
Category
Music
Authentication
Not Required
Geographic Coverage
Global — all genres and regions

What You Can Build