Build on the API
Every Music Assistant server offers the same API that its own frontend, the apps and the Home Assistant integration use. This page helps you connect to it and find the reference for what you build.
What you can work on
Section titled “What you can work on”- A client or a dashboard that browses the library and controls players and queues.
- An integration that connects Music Assistant to another system.
- A player: a device or an app that Music Assistant streams to.
- The Python client and the shared models themselves.
Start here
Section titled “Start here”- Open the API documentation of a server. Every server serves it at
/api-docs, such ashttp://localhost:8095/api-docs: a commands reference with examples, a schemas reference and a Swagger UI. - Get a token. Authentication is required, except through Home Assistant Ingress. Sign in with
POST /auth/login, or create a long-lived token in your profile in the web interface. - Connect.
- WebSocket at
/ws: send theauthcommand with your token first, then commands with amessage_ideach. You receive events, such asplayer_updated, without asking. - HTTP at
/api:POSTa command with the token in anAuthorization: Bearerheader. Use it for one-off commands.
- WebSocket at
- Check the schema version.
GET /info(no token needed), and the first message on a WebSocket connection, giveschema_versionandmin_supported_schema_version. Gate a feature of your client on theschema_versionthat introduced it. - Use the Python client if you write Python:
pip install music-assistant-client. The Home Assistant integration uses it too. Its models come frommusic-assistant-models, which the server shares.
For listings (sorting, filtering, paging and random order), follow the listing contract. For listening statistics, see the statistics API.
If you build a player
Section titled “If you build a player”Music Assistant streams to its own players with Sendspin. The Sendspin provider README explains how a browser, an app or a hardware device connects, and links the Sendspin protocol specification.
Where the details live
Section titled “Where the details live”- The API documentation at
/api-docson any server: the commands and models of that server version. - The webserver README: the routes, authentication, tokens, user roles and remote access.
API_SCHEMA_VERSIONinconstants.pysays when the server raises the schema version.- The client README: authentication and usage of the Python client.
- API and events: how the API works inside the server.
Who to talk to
Section titled “Who to talk to”- Ask questions on Discord.
- Report a bug in the API in the support repository.
- Ask for a command or a field you miss in Feature requests and ideas.
Music Assistant is a project of the Open Home Foundation.