The SysexDB API
An HTTP API for MIDI software (librarians, editors, MIDI monitors). Without a user, an app reads the catalog: manufacturers with their MIDI Manufacturer ID, devices, and the public SysEx files with an analysis of their bytes. With the user's permission it also lists the user's own files, private ones included, and downloads SysEx files.
The first version of the API is online. Addresses under /api/v1 do not change
in an incompatible way: fields can be added, not removed. Tell us what you are building, and what you miss.
Specification
Everything lives under https://www.sysexdb.com/api/v1. The OpenAPI description is generated from the server
code: read it at https://www.sysexdb.com/api/v1/openapi.yaml, or in the
public repository on GitHub, where
issues and pull requests are welcome.
Example client, with source code
SyxLibEd.Next is a small Windows program that uses this API exactly as any external app would: it signs in with the device flow, searches the catalog, lists and downloads SysEx files and sends them to a MIDI port. Its source code is public under the MIT licence: read how each call is made, or copy the parts you need.
Get a client ID
Every app has its own client ID, assigned by the staff. Ask for one through the contact form or by email at info@sysexdb.com, and state clearly:
- the name of your program;
- a link where we can see it: its website, its source repository or its download page;
- in a few words, what it will do with the API.
A client ID is not issued to unknown projects or to requests without a specific project: we need to be able to see what the program is before registering it.
If the app opens the browser and receives the answer on a local port, add its redirect URIs (for example
http://127.0.0.1:7890/callback). You get a client ID such as my-librarian.
There is no client secret: desktop and command-line apps could not keep it.
Read the catalog
Calls without a user identify the app with a header:
curl -H "SysexDB-Client-Id: my-librarian" https://www.sysexdb.com/api/v1/devices?q=dx7
Act for a user
With OAuth 2.0. The user approves the app on SysexDB; the app never sees the user's password. Desktop and command-line apps should use the device flow:
POST https://www.sysexdb.com/connect/devicewithclient_idandscope(for exampleprofile sysex.read).- Show the user the
user_codeand the addresshttps://www.sysexdb.com/activate. -
Poll
POST https://www.sysexdb.com/connect/tokenwithgrant_type=urn:ietf:params:oauth:grant-type:device_code, thedevice_codeand theclient_id, every few seconds, until the user has approved. - Call the API with
Authorization: Bearer <access token>.
Apps that open the browser can use the authorization code flow with PKCE (S256) at
https://www.sysexdb.com/connect/authorize. Access tokens last one hour; the refresh token
lasts 90 days and changes at every use. Revoke tokens with POST https://www.sysexdb.com/connect/revoke
when the user logs out of your app.
| Scope | Allows |
|---|---|
profile | See your user name and profile page |
sysex.read | List and download your SysEx files, including private ones |
sysex.write | Upload SysEx files for you, public or private, and edit, publish or delete the ones you uploaded. Descriptions you write through the app are published under CC BY-SA 4.0 |
Users see the apps they connected, and disconnect them, on their Connected apps page. Changing the password disconnects every app.
Upload for a user
With sysex.write an app uploads, edits, publishes and deletes the files of its user, with the
rules of the website. Uploads are multipart/form-data to POST https://www.sysexdb.com/api/v1/sysex;
the answer has the analysis of the bytes, so you can warn the user when the Manufacturer ID does not match
the device. A private file needs privateStorageTermsAccepted=true: show the user that the
private storage is not a backup and that they should keep their own copy. A public file cannot become
private again: to withdraw it, delete it. The staff sees which app uploaded each file.
Files can be .syx or Standard MIDI Files (.mid) with only SysEx messages and meta
events. A MIDI file is kept and downloaded as uploaded, and its fileFormat is mid;
add ?format=syx to the download to get only its SysEx messages.
Limits
- With a token: 120 requests a minute for each user.
- Without a token: 60 requests a minute from each address, and 600 a minute for the whole app.
- Downloads follow the limits of the website: 30 different files a minute and 50 an hour for each user.
Past a limit the answer is 429 with a Retry-After header. Errors are Problem
Details (RFC 9457). Please cache what does not change often, such as manufacturers and message types.
Terms and licence
Using the API means accepting the API terms of use. The data licence says what you may do with the data: the catalog is CC0, and every SysEx description says its own licence.