The API is built with the design principles of REST in mind, exposing resources which can be manipulated using the HTTP methods GET, POST, PUT and DELETE.
Every call requires a valid Consumer Key to be passed with all requests. You can request a Consumer Key via email: api@musescore.com.
Once you have a key, you can pass it as a parameter into your requests. With your consumer key, you can access all the public resources. To access private resources, you need to authenticate the user with OAuth.
Endpoint
All the resources on MuseScore.com are accessible via the following endpoint
http://api.musescore.com/services/rest
Return format
The return format for every call is specified as an extension. MuseScore.com currently supports XML, JSON and JSONP.
You can construct the source URL to score files once you know its ID and its secret, as returned by many API methods.
The URL takes the following format:
http://static.musescore.com/{id}/{secret}/score.{extension}
Where extension can be anything in pdf, mid (General MIDI), mxl (Compressed MusicXML), mscz (MuseScore file), mp3.
For sets of files, such as PNGs the URL takes the following format:
http://static.musescore.com/{id}/{secret}/score_{page_number}.png
Where {page_number} is a zero-indexed integer.
A thumbnail is available for each score at:
http://static.musescore.com/{id}/{secret}/thumb.png
PNG files are transparent and with 100dpi resolution.
A number of resources do not require a user to be a authenticated. Only the application needs a valid Consumer Key. You can request a Consumer Key via email: api@musescore.com. Once you have a key, you can pass it as a parameter in a cURL request, or connect to MuseScore.com using just the key.
Examples:
Using cURL:
$ curl 'http://api.musescore.com/services/rest/score?oauth_consumer_key=your_consumer_key
Note that this won’t let you access protected resources. To do that, you’ll need OAuth.
OAuth
To access protected resources you must authenticate with MuseScore.com using OAuth 1.0, a standard to give third party applications the authority to act on a user’s behalf.
If you’re not already familiar with OAuth, please read more on oauth.net, where there is also a Getting started.
MuseScore.com API is currently private. If you need an OAuth keypair let us know
Terminology
Service Provider
MuseScore.com
Consumer
Your Application
User
The user registered with MuseScore.com using your application
The score object is represented in XML or in JSON and GET calls to the MuseScore.com API will send back a single object or an array.
JSON example
{"id":"1111","vid":"152152","dates":{"posted":"1370593443","lastupdate":"1370593602","revised":"1370593603"},"secret":"b364acd291","uri":"https:\/\/api.musescore.com\/services\/rest\/score\/1111","permalink":"https:\/\/musescore.com\/score\/1111","custom_url":"https://musescore.com\/nicolas\/great-score","user":{"uid":"400","username":"Mozart","custom_url":"https://musescore.com\/nicolas"},"status":"ready","sharing":"public","comment_count":"0","favoriting_count":0,"user_favorite":0,"view_count":"14","playback_count":"6","download_count":4,"genre":"","format":"","tags":"tag1, tag2","license":"publicdomain","language":null,"title":"Wilder Reiter","description":"Album f\u00fcr die Jugend (Album for the Young), Op. 68, was composed by Robert Schumann in 1848 for his three daughters. The album consists of a collection of 43 short works. The Wild Rider (Wilder Reiter) in A minor is more commonly known in English as The Wild Horseman.","metadata":{"title":"My First score","subtitle":null,"composer":"WA Mozart","poet":null,"pages":"9","measures":"102","lyrics":"0","chordnames":"0","keysig":"0","duration":"474","dimensions":"210x297","parts":[{"part":{"name":"Flute","program":"73"}},{"part":{"name":"Piano","program":"0"}}]}}
id
The score id, an integer. It’s a unique identifier for the score
vid
Version id of the score, an integer. It will change if the score is updated.
posted
The date when the score has been posted in seconds, unix time.
lastupdate
The date when score was last updated. The score file has changed or any metadata such as title.
revised
The date when score file was last updated.
secret
The secret of the score, a unique string
uri
API endpoint for this score
permalink
Permalink to the score page on MuseScore.com, suitable for human
custom_url
the current nice url for the score
uid
The unique identifier of the owner of this score
username
The user screen name of the owner of this score
custom_url
the current nice url for the user
status
The status of the score, currently only “ready” scores are presented through the API
sharing
either public or private
comment_count
Number of comments on this score
favoriting_count
Number of users who favorited this score
user_favorite
If a user is authentified, 1 if the scores if favorited. Otherwise 0.
view_count
Number of views for this score
playback_count
Number of plays for this score
download_count
Number of downloads for this score
genre
:
format
:
tags
The comma separated list of tags
license
The license of the score
* all-rights-reserved
* publicdomain
* cc-zero
* cc-by
* cc-by-sa
* cc-by-nd
* cc-by-nc
* cc-by-nc-sa
* cc-by-nc-nd
language
Language of the lyrics as provided by the user. It’s a 2 letters language code, null or empty if the user did not provide it
title
Title of the score, as filed by the user when uploading the score. This title can be different from the one in metadata
description
Description of the score, as file by the user when uploading or updating the score
Metadata
Metadata are automatically extracted from the score file
title
The first title text of the score file
subtitle
The first subtitle text in the score file
composer
The first composer text in the score file
poet
The first poet/lyricist text in the score file
pages
The number of pages in the score, when the score is displayed as the user sees it in MuseScore
measures
The number of measures in the score
lyrics
0 if the score has no lyrics, 1 otherwise
chordnames
0 if the score has no chord names, 1 otherwise
keysig
The first key signature of the score. [-7;+7] it’s the number of flat/sharps for the first key signature, first staff of the score.
duration
duration of the score in seconds, including repeats
dimensions
paper size of the score in mm and formatted widthxheight
parts
An array describing the parts of the score. Each part has a name and a midi program number, zero based indexed.
elid is the zero based index of the measure. The same id is used in the space representation.
position is a time position in ms and is in sync with the MP3 and the MIDI file provided by the API
Creates a score belonging to the logged in user. Since a file asset is attached the request must be a multipart/form-data request. This method is only available if the user is logged in. See Authentication
This request will resolve and redirect to the API resource URL for the score http://musescore.com/nicolas/scores/583. Just follow the redirect and you will get the representation you want.
oEmbed is an open standard for embedding external content into a website. In the case of MuseScore.com, it will embed the score player for a given score. You can use any URL of any score to obtain the embed code for it. To find out more about oEmbed, view the spec or check out Webmonkey’s Get Started With oEmbed tutorial.
API Endpoints
You can use the API endpoint to request the embed code for a score from its URL. The response format can be either xml, json or js (for JSONP).
http://musescore.com/oembed/endpoint
MuseScore.com currently supports embedding of scores only. The accepted URL schemes are:
http://musescore.com/*
http://mus.cr/*
Discovery
No discovery yet
Arguments
All arguments are sent as query parameters and must be urlencoded (as per RFC 1738).
Argument
Definition
url
The MuseScore.com URL for a score.
format
(optional) Either json, xml or jsonp. Defaults to json.
maxwidth
(optional) The maximum width for the player. Defaults to 100%
maxheight
(optional) The maximum height for the player. Defaults to 394.
callback
(optional) In case you request a jsonp response by setting format=jsonp, this callback function will be executed
A simple example, using jQuery, is available. Check and fork the code.
Example Responses
As mentioned above, the default width for the player is 100%. The current oembed specification requires the returned data to specify the width in pixels, which is not practical. Therefore if you did not specify a maxwidth the returned width parameter will be 100%. If you require the width to be correctly set to an integer, please provide a maxwidth.
<oembed><type>rich</type><version>1.0</version><provider_name>MuseScore.com</provider_name><width>100%</width><height>394</height><provider_url>http://musescore.com</provider_url><html><iframewidth="100%"height="394"src="http://musescore.com/node/439/embed"frameborder="0"></iframe><span><ahref="http://musescore.com/nicolas/scores/439">Héléna</a> by <ahref="http://musescore.com/user/5">Nicolas</a></span></html><title>Héléna</title><author_name>Nicolas</author_name><author_url>http://musescore.com/nicolas</author_url><original_url>http://musescore.com/nicolas/scores/439</original_url></oembed>