The API discussed here is an interface to the MusicBrainz Database. It is aimed at developers of media players, CD rippers, taggers, and other applications requiring music metadata. The API's architecture follows the REST design principles. Interaction with the API is done using HTTP and all content is served in a simple but flexible format, be it XML or JSON.
- 1 General FAQ
- 2 Application rate limiting and identification
- 3 Introduction
- 4 Lookups
- 5 Non-MBID Lookups
- 6 Browse
- 7 Release (Group) Type and Status
- 8 Submitting data
- 9 Libraries
- What can I do with the MusicBrainz API?
- You can look up information about a particular MusicBrainz entity ("give me info about The Beatles"), browse the data to find entities connected to a particular entity ("show me all releases by The Beatles"), or search for entities matching a specific query ("show me all artists matching the query 'Beatles' so I can find the one I want and ask for more data").
- Who can use the MusicBrainz API? Is it free?
- Non-commercial use of this web service is free; please see our commercial plans or contact us if you would like to use this service commercially.
- Do I need an API key?
- Currently, no. But you must have a meaningful user-agent string.
- Do I need to provide authentication?
- Data submission, as well as requests that involve user information, require digest authentication.
- Which formats can I get the data in?
- The API was originally written to return XML, but nowadays it can also return JSON.
- Is there any significant difference between the XML and JSON APIs?
- For requesting data, the XML and JSON API are effectively equivalent. The XML API is the only one that allows submitting data to MusicBrainz (but keep in mind only ratings, tags, barcodes and ISRCs can be submitted via the API at all; for most data additions you should use the website instead).
- Is there a limit to the number of requests I can make per second?
- Yes. See our rate limiting rules.
- This seems very complicated, can I see some examples?
- Yes, we have an example page showcasing some queries and showing the returned format you can expect for each.
- Are there language bindings for the API?
- Yes, in many different languages. See our list of external libraries.
- What should I do if I encounter unexpected behaviour not covered in these docs?
- You can ask question in IRC or in the forums.
- Check to see if a ticket has been filed in the bug tracker, and if not consider writing one.
- What else should I know before I start using the API?
- It'd probably be helpful to know:
- So you're on version 2 of the API then? What happened to version 1?
- The version 1 of the API was designed with the data structure of the original (pre-2011) version of the MusicBrainz database in mind. It was deprecated in 2011 when we changed to our current data schema, and after running (without further updates) for several years to avoid breaking any tools using it, it was finally taken down in 2019.
- Do you ever make breaking changes?
- We try to avoid that, but sometimes we might need to do so. In those cases, they will be announced on our blog, so consider following that!
Application rate limiting and identification
All users of the API must ensure that each of their client applications never make more than ONE call per second. Making more than one call per second drives up the load on the servers and prevents others from using the MusicBrainz API. If you impact the server by making more than one call per second, your IP address may be blocked preventing all further access to MusicBrainz. Also, it is important that your application sets a proper User-Agent string in its HTTP request headers. For more details on both of these requirements, please see our rate limiting page.
The API root URL is
We have 13 resources on our API which represent core entities in our database:
area, artist, event, genre, instrument, label, place, recording, release, release-group, series, work, url
We also provide an API interface for the following non-core resources:
rating, tag, collection
And we allow you to perform lookups based on other unique identifiers with these resources:
discid, isrc, iswc
On each entity resource, you can perform three different GET requests:
lookup: /<ENTITY_TYPE>/<MBID>?inc=<INC> browse: /<RESULT_ENTITY_TYPE>?<BROWSING_ENTITY_TYPE>=<MBID>&limit=<LIMIT>&offset=<OFFSET>&inc=<INC> search: /<ENTITY_TYPE>?query=<QUERY>&limit=<LIMIT>&offset=<OFFSET>
... except that browse and search are not implemented for genre entities at this time.
- Lookups, non-MBID lookups and browse requests are documented in following sections.
- Searches are more complex and are documented on the search documentation page.
You can perform a lookup of an entity when you have the MBID for that entity:
Note that unless you have provided an MBID in exactly the format listed, you are not performing a lookup request. If your URL includes something like artist=<MBID>, then please see the Browse section. If it includes query=<QUERY>, please see the Search page.
The inc= parameter allows you to request more information to be included about the entity. Any of the entities directly linked to the entity can be included.
/ws/2/area /ws/2/artist recordings, releases, release-groups, works /ws/2/collection user-collections (includes private collections, requires authentication) /ws/2/event /ws/2/genre /ws/2/instrument /ws/2/label releases /ws/2/place /ws/2/recording artists, releases, isrcs, url-rels /ws/2/release artists, collections, labels, recordings, release-groups /ws/2/release-group artists, releases /ws/2/series /ws/2/work /ws/2/url
In addition, Relationships are available for all entity types except genres via inc parameters.
To include more than one subquery in a single request, separate the arguments to
inc= with a + (plus sign), like
All lookups which include release-groups allow a type= argument to filter the release-groups by a specific type. All lookups which include releases also allow the type= argument, and a status= argument is allowed.
Note that the number of linked entities returned is always limited to 25. If you need the remaining results, you will have to perform a browse request.
Linked entities are always ordered alphabetically by gid.
Note: In the XML API, when including
recordings with a
tracks listed in
media have no
title if that doesn’t differ from recording’s title, to reduce the size of the response.
inc= arguments which affect subqueries
Some additional inc= parameters are supported to specify how much of the data about the linked entities should be included:
- discids include discids for all media in the releases - media include media for all releases, this includes the # of tracks on each medium and its format. - isrcs include isrcs for all recordings - artist-credits include artists credits for all releases and recordings - various-artists include only those releases where the artist appears on one of the tracks, but not in the artist credit for the release itself (this is only valid on a /ws/2/artist?inc=releases request).
Misc inc= arguments
- aliases include artist, label, area or work aliases; treat these as a set, as they are not deliberately ordered - annotation include annotation - tags, ratings include tags and/or ratings for the entity - user-tags, user-ratings same as above, but only return the tags and/or ratings submitted by the specified user - genres, user-genres include genres (tags in the genres list): either all or the ones submitted by the user, respectively
Requests with user-tags, user-genres and user-ratings require authentication. You can authenticate using HTTP Digest, use the same username and password used to access the main https://musicbrainz.org website.
- area-rels - artist-rels - event-rels - instrument-rels - label-rels - place-rels - recording-rels - release-rels - release-group-rels - series-rels - url-rels - work-rels
By default, these 'inc=' arguments will only load relationship for the requested entity. When you are loading a release, you might want to load relationships for all its recordings and also works linked to the recordings. This is useful to get full release credits. There are additional arguments that can be used only on release and (for work-level-rels) recording requests and allow you to specify for which entities to load relationships:
- recording-level-rels - work-level-rels
With relationships included, entities will have
<relation-list> nodes for each target entity type. As an example, requesting
inc=series-rels for a work might produce the following relation-list as a child of the work:
<relation-list target-type="series"> <relation type="part of" type-id="b0d44366-cdf0-3acb-bee6-0f65a77a6ef0"> <target>59c5f4e8-1308-4eff-8845-aa90b92ddc86</target> <ordering-key>26</ordering-key> <direction>backward</direction> <attribute-list> <attribute type-id="a59c5830-5ec7-38fe-9a21-c7ea54f6650a" value="op. 26">number</attribute> </attribute-list> <series id="59c5f4e8-1308-4eff-8845-aa90b92ddc86" type="Catalogue" type-id="49482ff0-fc9e-3b8c-a2d0-30e84d9df002"> <name>Works of Jean Sibelius by opus number</name> </series> </relation> </relation-list>
<attribute-list> nodes will contain any attributes specified on a relationship. (Here, there's an attribute for the number of the work in a series.) Note that an
<attribute> node's text value is the name of the attribute type (here "number"), and the 'type-id' XML attribute (conflicting terminology!) is the UUID of the relationship attribute type ("number"). Relationship attributes always have a type, and some may have an associated value ("op. 26" here). They may also have a 'credited-as' XML attribute indicating a user-entered name. As an example, the attribute below specifies that the piano being played was a Steinway.
<attribute-list> <attribute credited-as="Steinway piano" type-id="b3eac5f9-7859-4416-ac39-7154e2e8d348">piano</attribute> </attribute-list>
Instead of MBIDs, you can also perform lookups using several other unique identifiers. However, because clashes sometimes occur, each of these lookups return a list of entities (there is no limit, all linked entities will be returned, paging is not supported).
discid lookup returns a list of associated releases, the 'inc=' arguments supported are identical to a lookup request for a release.
If there are no matching releases in MusicBrainz, but a matching CD stub exists, it will be returned. This is the default behaviour. If you do not want to see CD stubs, pass 'cdstubs=no.' CD stubs are contained within a <cdstub> element, and otherwise have the same form as a release. Note that CD stubs do not have artist credits, just artists.
If you provide the "toc" query parameter, and if the provided disc ID is not known by MusicBrainz, a fuzzy lookup will done to find matching MusicBrainz releases. Note that if CD stubs are found this will not happen. If you do want TOC fuzzy lookup, but not CD stub searching, specify "cdstubs=no". For example:
Will look for the disc id first, and if it fails, will try to find tracklists that are within a similar distance to the one provided.
It's also possible to perform a fuzzy TOC search without a discid. Passing "-" (or any invalid placeholder) as the discid will cause it to be ignored if a valid TOC is present:
By default, fuzzy TOC searches only return mediums whose format is set to "CD." If you want to search all mediums regardless of format, add 'media-format=all' to the query:
The TOC consists of the following:
- First track (always 1)
- total number of tracks
- sector offset of the leadout (end of the disc)
- a list of sector offsets for each track, beginning with track 1 (generally 150 sectors)
isrc lookup returns a list of recordings, the 'inc=' arguments supported are identical to a lookup request for a recording.
iswc lookup returns a list of works, the 'inc=' arguments supported are identical to a lookup request for a work.
Browse requests are a direct lookup of all the entities directly linked to another entity ("directly linked" here meaning it does not include entities linked by a relationship). For example, you may want to see all releases on the label ubiktune:
Note that browse requests are not searches: in order to browse all the releases on the ubiktune label you will need to know the MBID of ubiktune.
Browsed entities are always ordered alphabetically by gid. If you need to sort the entities, you will have to fetch all entities (see "Paging" below) and sort them yourself.
The following list shows which linked entities you can use in a browse request:
/ws/2/area collection /ws/2/artist area, collection, recording, release, release-group, work /ws/2/collection area, artist, editor, event, label, place, recording, release, release-group, work /ws/2/event area, artist, collection, place /ws/2/instrument collection /ws/2/label area, collection, release /ws/2/place area, collection /ws/2/recording artist, collection, release, work /ws/2/release area, artist, collection, label, track, track_artist, recording, release-group /ws/2/release-group artist, collection, release /ws/2/series collection /ws/2/work artist, collection /ws/2/url resource
As a special case, release also allows track_artist, which is intended to allow you to browse various artist appearances for an artist. It will return any release where the artist appears in the artist credit for a track, but NOT in the artist credit for the entire release (as those would already have been returned in a request with artist=<MBID>).
The URL endpoint's 'resource' entity is for providing a URL directly, rather than a URL MBID (for example, https://musicbrainz.org/ws/2/url?resource=http://www.madonna.com/ versus https://musicbrainz.org/ws/2/url/b663423b-9b54-4067-9674-fffaecf68851). This URL will need to be appropriately URL-escaped for inclusion as a query parameter; this means that URLs that include url-escaped parameters, or query parameters of their own, will need to be escaped a second time.
Release-groups can be filtered on type, and releases can be filtered on type and/or status. For example, if you want all the live bootleg releases by Metallica:
Or all albums and EPs by Autechre:
Browse requests are the only requests which support paging: any browse request supports an 'offset=' argument to get more results. Browse requests also support 'limit=': the default limit is 25, and you can increase that up to 100.
Just like with normal lookup requests, the server can be instructed to include more data about the entity using an 'inc=' argument. Supported values for inc= are:
/ws/2/area aliases /ws/2/artist aliases /ws/2/event aliases /ws/2/instrument aliases /ws/2/label aliases /ws/2/place aliases /ws/2/recording artist-credits, isrcs /ws/2/release artist-credits, labels, recordings, release-groups, media, discids, isrcs (with recordings) /ws/2/release-group artist-credits /ws/2/series aliases /ws/2/work aliases /ws/2/area aliases /ws/2/url (only relationship includes)
In addition to the inc= values listed above, all entities support:
annotation, tags, user-tags, genres, user-genres
All entities except area, place, release, and series support:
In addition, Relationships are available for all entity types via inc parameters, as with lookup requests.
Release (Group) Type and Status
Any query which includes release-groups in the results can be filtered to only include release groups of a certain type. Any query which includes releases in the results can be filtered to only include releases of a certain type and/or status. Valid values are:
status official, promotion, bootleg, pseudo-release. type album, single, ep, other (primary types) / audio drama, audiobook, broadcast, compilation, dj-mix, interview, live, mixtape/street, remix, soundtrack, spokenword (secondary types).
See [Release#Status|the release status documentation] and [Release_Group/Type|the release group type documentation] for info on what these values mean.
You can use the API to submit certain kinds of data. Currently tags (including genres), ratings and ISRCs can be entered through the API.
All POST requests require authentication. You should authenticate using HTTP Digest, using the same username and password you use to access the main https://musicbrainz.org website. The realm is "musicbrainz.org".
POST requests should always include a 'client' parameter in the URL (not the body). The value of 'client' should be the ID of the client software submitting data. This has to be the application's name and version number, not that of a client library (client libraries should use HTTP's User-Agent header). The recommended format is "application-version", where version does not contain a - character.
You can submit tags (including genres) and ratings through the XML API using POST requests. As described above, the client software needs to identify itself using the 'client=' parameter. In the following examples I will use 'example.app-0.4.7' as the client identifier; this is obviously a fictitious client.
To submit tags (including genres), perform a POST request to the /ws/2/tag url, like this:
The body of your request should be an XML formatted list of entities with <user-tag> elements.
An example request is reproduced below:
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"> <artist-list> <artist id="a16d1433-ba89-4f72-a47b-a370add0bb56"> <user-tag-list> <user-tag><name>female</name></user-tag> <user-tag><name>korean</name></user-tag> <user-tag><name>jpop</name></user-tag> </user-tag-list> </artist> </artist-list> <recording-list> <recording id="047ea202-b98d-46ae-97f7-0180a20ee5cf"> <user-tag-list> <user-tag><name>noise</name></user-tag> </user-tag-list> </recording> </recording-list> </metadata>
Because you're sending XML in the body of your POST request, make sure to also set the Content-Type to "application/xml; charset=utf-8".
Our tag functionality includes the ability to upvote and downvote tags (including genres). This terminology can be confusing. Whenever you tag something, you are in fact "upvoting" it (which will add 1 to the vote count for the tag). Downvoting is the inverse operation, and will subtract 1 from the tag's vote count. Tags that you downvote will be hidden from the UI for you (and if their total vote count drops to 0 or below, they'll be hidden for everyone). The "user-tag" elements can include a "vote" attribute that specifies what action you want to take:
<user-tag vote="upvote"><name>noise</name></user-tag> <user-tag vote="downvote"><name>pop</name></user-tag> <user-tag vote="withdraw"><name>rock</name></user-tag>
The "withdraw" vote will remove any upvote or downvote that you previously added (as if you had never voted).
If you do not supply any "vote" attributes in your request (as in the example above), then the list of tags you submit will be treated as upvotes and will completely replace all existing upvoted tags you have on that entity. (So, tags that are not included in the request will be withdrawn, if they were previously upvoted. Downvoted tags are left in place.) This is a legacy behavior that we maintain from before we had tag voting. Including any "vote" attribute in the request will cause it to only apply those votes that you specified.
To submit ratings, perform a POST request to the /ws/2/rating url, like this:
The body of your request should be an XML formatted list of entities with <user-rating> elements.
An example request is reproduced below:
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"> <artist-list> <artist id="455641ea-fff4-49f6-8fb4-49f961d8f1ad"> <user-rating>100</user-rating> </artist> </artist-list> <recording-list> <recording id="c410a773-c6eb-4bc0-9df8-042fe6645c63"> <user-rating>20</user-rating> </recording> </recording-list> </metadata>
To add or remove releases (for example) from your collection, perform a PUT or DELETE request to /ws/2/collection/<gid>/releases, respectively:
PUT /ws/2/collection/f4784850-3844-11e0-9e42-0800200c9a66/releases/455641ea-fff4-49f6-8fb4-49f961d8f1ad;c410a773-c6eb-4bc0-9df8-042fe6645c63?client=example.app-0.4.7 DELETE /ws/2/collection/f4784850-3844-11e0-9e42-0800200c9a66/releases/455641ea-fff4-49f6-8fb4-49f961d8f1ad;?client=example.app-0.4.7
Other types of entities supported by collections can be submitted, too; just substitute "releases" in the URI with one of: areas, artists, events, labels, places, recordings, release-groups, or works, depending on the type of collection.
You may submit up to ~400 entities in a single request, separated by a semicolon (;), as the PUT example above shows. You are restricted to a maximum URI length of 16kb at the moment (which roughly equates to 400 gids).
To get the description of a collection, perform a lookup request with the collection MBID:
To get the description and the summarized contents of a collection, perform a lookup request with the collection MBID and the appropriate entity subquery:
GET /ws/2/collection/4a0a2cd0-3b20-4093-bd99-92788045845e/areas GET /ws/2/collection/f4784850-3844-11e0-9e42-0800200c9a66/releases ...
To get the contents of a collection, perform a browse request on the appropriate entity endpoint, using the collection MBID as a parameter:
GET /ws/2/area?collection=4a0a2cd0-3b20-4093-bd99-92788045845e GET /ws/2/release?collection=f4784850-3844-11e0-9e42-0800200c9a66 ...
To get a list of collections for a given user (including the number of entities in each collection), you can browse the collection endpoint by editor name:
This will only return collections that rob has made public. If you wish to see private collections as an authenticated user, do:
Barcodes may be associated with releases by issuing an XML POST request to:
The body of the request must be an XML document with a list of <releases>s in a <release-list>, and a single barcode in a <barcode> element for each release. For example:
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"> <release-list> <release id="047ea202-b98d-46ae-97f7-0180a20ee5cf"> <barcode>9780262560933</barcode> </release> </release-list> </metadata>
Upon issuing this request MusicBrainz will create a single edit in the edit queue for applying these changes. These changes will not be automatically applied, though they will be applied if either no one votes against your changes, or once your changes expire.
ISRCs may be associated with recordings by issuing an XML POST request to:
The body of the request must be an XML document with a list of <recording>s in a <recording-list>, and a list of <ISRC>s in a <isrc-list> to be associated with the recordings. For example:
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"> <recording-list> <recording id="b9991644-7275-44db-bc43-fff6c6b4ce69"> <isrc-list count="1"> <isrc id="JPB600601201" /> </isrc-list> </recording> <recording id="75c961c9-6e00-4861-9c9d-e6ca90d57342"> <isrc-list count="1"> <isrc id="JPB600523201" /> </isrc-list> </recording> </recording-list> </metadata>
The API can be accessed with our C++ library, libmusicbrainz, or any of the following third party libraries:
- Python: python-musicbrainzngs Python2/3 bindings
- Java: musicbrainzws2-java
- PHP: mikealmond/MusicBrainz, a fork of phpbrainz
- Objective-C: libmusicbrainz-objc
- common lisp: cl-musicbrainz
- Perl: WebService::MusicBrainz