Compás Developers

Remote Control

Control the player from a phone, a computer or your own script.

Apps (the Android companion, Compás Tools, a browser or a script) control the player through its Remote Control HTTP API over Wi-Fi, Bluetooth Classic or USB. Audio stays on the player.

Turn the service on at Wireless, Remote Control or with the quick drawer tile. It is off again after every restart. The same screen shows the connection PIN.

Connect

Wi-Fi

What Value
Base URL http://<player-ip>:8899. The player also answers on port 80 when it can bind it.
mDNS Service _compas-remote._tcp.local, port 8899, TXT api=1. Resolve the SRV target and address. Announced only while Wi-Fi has an IPv4 address.
UDP Send 32 bytes to UDP port 8899: COMPAS_REMOTE_DISCOVER_V1 padded with zero bytes. A reply COMPAS_REMOTE_V1 8899\n means a player is there. Use the datagram's source address as the host. Only private IPv4 senders (10/8, 172.16/12, 192.168/16, 169.254/16) get a reply.
QR code The Remote Control screen shows http://<player-ip>:8899 as a QR code.

Wi-Fi is plain HTTP, so the PIN and responses are not encrypted. Use a trusted network. A third simultaneous connection gets an empty 503.

Bluetooth Classic

Pair the phone with the player first. Then find the RFCOMM service by UUID 9d2f8a7e-6b4c-4d51-8e43-38f7a2c0b719 (SDP name compás). Do not use the Serial Port Profile UUID.

  • The player publishes RFCOMM channel 21 in SDP.
  • The service is advertised only while Remote Control is on and Bluetooth is ready. The Remote Control screen says when it is not.
  • The service requires an authenticated (paired) link.
  • One HTTP request and one response per socket. Close the socket after reading the response.
  • Method, path, query, status, headers and body are the same as on Wi-Fi.
  • Wi-Fi file upload is refused over Bluetooth.
  • The player serves one Bluetooth request at a time and rejects a second RFCOMM connection.

USB (adb)

Compás Tools runs adb forward tcp:0 tcp:8899 and talks to the forwarded local port. The player sees a loopback peer and labels settings changes it makes as usb. Nothing else differs: the PIN is still required, and file upload works because the connection is TCP.

GET /api/v1/status HTTP/1.1
Host: compas
X-Compas-PIN: 123456
Connection: close

Sign in

Every request needs the header X-Compas-PIN: <pin>, except GET / (the browser page), GET /api/v1/capabilities and, on a trusted Bluetooth link, everything.

  • The player makes a random 6-digit PIN the first time it needs one and keeps it across restarts and updates. Older builds may have saved 4 to 12 digits, so accept that range.
  • The user can replace the PIN with the refresh icon next to Connection PIN. That immediately invalidates the old PIN, clears any lockout and removes all Bluetooth trust. Ask for the PIN again.
  • Never put the PIN in a URL, query string or log. A missing, repeated, empty or oversized PIN header or a wrong PIN returns 401 with {"error":"unauthorized","code":"pin_required"}; only wrong PINs count toward the lockout.
  • Five different wrong PINs within a minute lock PIN checks for a minute, for all clients and transports. Sending the same wrong PIN again counts once. While locked, even the correct PIN gets 429 with Retry-After: 60 and {"error":"rate_limited","code":"pin_rate_limited","retryAfterSeconds":60}. Trusted Bluetooth devices are unaffected.

Browser session

A browser can send the PIN once to POST /api/v1/session and get an HttpOnly, SameSite=Strict cookie compas_pin (204, one year). Later requests without the header use the cookie. POST /api/v1/session/clear removes it and needs no PIN. The cookie never counts for settings, plugin or layout changes, which need the header. Apps should just send the header.

Bluetooth trusted devices

A paired phone can skip the PIN. Trust is Bluetooth only; Wi-Fi is never trusted.

A device becomes trusted when:

  • the user taps Pair on the player's pairing popup, after checking that both screens show the same code, or
  • the device sends a valid PIN once over Bluetooth.

A trusted device needs no X-Compas-PIN header, including for changes. For it, /capabilities reports "authRequired":false.

Trust survives restarts (up to 8 devices) and ends when the device is removed on the player, pairs again, or the PIN is replaced. The first request right after pairing can take up to 3 seconds.

Requests and responses

  • Prefix paths with /api/v1. The older /api/... paths still work with the same rules (except /capabilities, which exists only under /api/v1), but new apps should use /api/v1.
  • Every response has Content-Length (never chunked) and Connection: close. JSON responses are application/json. Playback controls return text/plain OK. Artwork is image/jpeg, image/png or image/bmp.
  • Send Content-Length on every body; a duplicate or malformed one, or Transfer-Encoding, gives 400. The request line is at most 4,095 bytes (414). The header block is at most 4,096 bytes and each header line under 512 bytes (431; long browser Cookie lines can hit this). A gap of 2 seconds between bytes, or 10 seconds in total, gives 408.
  • Query values are UTF-8, URL encoded. + means space.
  • Song index values are database IDs (1 to 2147483647 from clients), not array positions. Strings can be empty.
  • No keep-alive or push: poll GET /status (the web page polls once a second). 200 OK on a control means accepted, not finished. Wi-Fi serves two requests at a time, Bluetooth one, so keep requests serial.

Errors

Status Meaning
400 Bad or unsafe request.
401 PIN missing or wrong.
403 Read-only target (built-in playlist, read-only setting) or PIN header missing on a plugin change.
404 Unknown route or item. The original playback controls also return a text 404 for bad parameters.
405 Method not allowed.
409 Stale revision, name taken, busy. Reread, then retry.
411, 413 Missing Content-Length; body or artwork too large.
415 Body is not JSON where JSON is required.
422 A setting value failed validation.
429 PIN lockout.
500, 503 Player failure or a temporary resource problem. Retrying a 503 is fine.
501 Not supported (for example rename on this filesystem).
504 A plugin or layout change timed out waiting for the screen.

JSON errors carry error and code. Branch on code. Newer routes use "<family>_error" as error: catalog, folder, recent, favorite, queue, playlist, settings and plugin_api.

Version and features

GET /capabilities needs no PIN and exposes no playback or library data.

{"libraryId":"<uuid>","version":1,"authRequired":true,"authHeader":"X-Compas-PIN",
 "transports":["wifi","bluetooth_classic_rfcomm"],
 "features":["status","playback_controls","queue","library_browse","playlists","album_art","screenshots","catalog_sync_v1","folder_browse","recently_played","favorites_edit","queue_edit","playlist_edit","playlist_import","player_accent","device_info","collection_playback","shuffle_modes","library_sorting","wifi_import","wifi_import_files","settings_v1","plugin_store","plugin_management","player_layouts"],
 "settingsSchemaVersion":1}
  • version is the API version. mDNS api=1 matches it. Added fields do not change it, so ignore unknown fields.
  • Check a feature before using the routes it covers. transports lists what the player supports, not what is switched on.
  • libraryId is the catalog's ID and appears when the catalog is loaded.

Status and artwork

Request Response
GET /status One JSON object, fields below.
GET /art Embedded artwork of the playing file, or 404.
GET /art?index=<song-id> Embedded artwork of a library song, or 404. A non-numeric index falls back to the playing track. Folder images are only served by /catalog/art. Use the returned Content-Type; sizes vary.

Status fields:

Field Meaning
playing, paused Booleans.
title, artist, album Strings, empty when unknown.
position_seconds, duration_seconds Integers.
volume 0 to 1.
play_mode 0 sequential, 1 repeat all, 2 repeat one, 3 shuffle with repeat, 4 shuffle once (stops after every song played once). Use mode 4 only when shuffle_modes is listed.
codec, source_bit_depth, source_sample_rate The source file's format, "" and 0 when unknown.
catalog_revision Catalog token as a string, null while the catalog is unavailable.
bluetooth_audio_output True when Bluetooth is the requested output.
favorite Heart state of the current track.
accent_color Effective UI accent as #RRGGBB, or null before the first snapshot.
device_model HiBy R1, HiBy R3 Pro II, HiBy R3 II 2025 or TempoTec V1.
player_version Release label.
features {"plugin_store":true,"plugin_management":true,"player_layouts":true}.
settingsRevision, settingsEpoch Cursor for the settings API.
sort_modes Three sort modes: albums, artists, album artists.
collection_job {"id":N,"state":"idle|pending|done|error","error":"..."}.

Playback

All are POST and return 200 with OK. A bad parameter returns a text 404.

Path Effect
/playback/toggle Play or pause.
/playback/next, /playback/prev Skip.
/playback/mode Cycle the mode. ?mode=0 to ?mode=4 sets it.
/playback/seek?seconds=<n> Seek to whole seconds, 0 or more.
/playback/volume?percent=<n> Volume 0 to 100, capped by the player's maximum volume and ignored while the user drags the slider on the player.
/playback/play?index=<song-id> Play a song. Add catalog_revision=<rev> to detect a stale catalog (409 revision_mismatch). Context for the queue: playlist=<key>, or artist=<name>&album=<name>, or album_artist=<name>&album=<name>. Without context the queue is All Songs.
/playback/queue?index=<song-id> Add a song to the queue. Also takes catalog_revision.
/screenshot Ask the player for a screenshot. It is saved as a PNG under <SD card>/Screenshots/. The reply only says it was queued.

A bad catalog_revision returns 400 invalid_catalog_action; an unloaded library returns 503 temporary_unavailable.

Library

Lists use offset and limit. Song lists default to 50 and cap at 100; stop when the returned count reaches total.

Request Response
GET /library?offset=0&limit=50&q=<text> {"total":N,"songs":[{"index":ID,"title":"...","artist":"..."}]}
GET /library?artist=<n>&album=<n> Same, filtered. album_artist=<n> can replace artist.
GET /library?genre=<name> Same, by exact case-insensitive genre (up to 599 bytes). Combines with the other filters. Songs without a genre are not in any genre.
GET /library/artists, /library/album_artists {"artists":[{"name":"...","count":N,"index":ID,"album_artist":"..."}]}
GET /library/genres {"genres":[{"name":"...","count":N,"index":ID,"album_artist":""}]}
GET /library/albums?artist=<n> {"albums":[...]} same row shape. album_artist=<n> also works.

Only the genre list is capped, at 2,000 entries; artists, album artists and albums return everything. If the library changes during a walk you get 503 library_unavailable. index in a group row is a representative song, good for artwork. q, artist, album and album_artist are limited to 127 bytes (400 query_parameter_too_long).

Sorting and whole-collection playback

Needs library_sorting and collection_playback.

Request Response
GET /library/sorting {"albums":{"configured":0,"effective":0,"available":[true,true,true]},"artists":{...},"album_artists":{...}}. Modes: 0 default, 1 recent, 2 release year. effective falls back to 0 when the chosen sort is not available.
POST /library/sorting?scope=<scope>&mode=<0..2> scope is albums, artists or album_artists. 202 {"accepted":true}. 409 sorting_busy, 409 sort_unavailable, 400 invalid_sorting. Read it again to see the result.
GET /library/albums?scope=albums&offset=0&limit=25 {"total":N,"offset":0,"next_offset":25,"revision":"...","groups":[...]} sorted globally; limit caps at 25. scope=artists&artist=<n> or scope=album_artists&album_artist=<n> limit it to one artist. There is no revision parameter. Compare the returned revision between pages and restart at 0 if it changes; 409 library_changed only means the catalog changed during that request. Errors: 400 invalid_album_query (also a limit over 100), 400 invalid_offset, 503 response_too_large, library_unavailable or allocation_failed.
POST /playback/collection?scope=<s>&mode=<0..4>&catalog_revision=<rev>&name=<n> 202 {"id":N}. Scopes: all, album, artist, album_artist, genre, playlist, favorites, recently_added, recently_played. mode and catalog_revision are required. name names the album, artist, album artist, genre or playlist key. The album scope also needs artist=<n> or album_artist=<n> (empty allowed, for albums with no album artist). One job at a time (409 collection_busy). Sending both artist and album_artist gives 400 invalid_collection. 400 conflicting_filters means the scope's name conflicts with the other filter (for example scope=album_artist&name=X&artist=Y).

A failed job leaves the old queue. Poll collection_job in /status; 202 only means accepted. Bad or missing parameters return 400 invalid_collection.

Catalog sync

Feature catalog_sync_v1. Sync the whole song list and artwork into a local database. Pages default to 50; a limit over 100 is rejected with 400 invalid_paging. Every response has library_id and an opaque revision string. Use the first page's revision for the rest; 409 means the library changed, so restart at 0. library_id changes when the catalog is rebuilt, so cache artwork under it.

Request Response
GET /catalog?offset=0&limit=50&revision=<rev> {"library_id":"...","revision":"...","total":N,"offset":0,"songs":[{"id":ID,"title":"...","artist":"...","artists":["..."],"album":"...","album_artist":"...","genre":"...","track_number":1,"disc_number":null,"album_key":"a2-<16 hex>"}],"next_offset":50}. revision may be left out on the first request. album is always a string. Missing track or disc numbers are null. album_artist falls back to artist. album_key is opaque and null when there is no representative.
GET /catalog/covers?offset=0&limit=50&revision=<rev> revision is required (400 invalid_revision). {"library_id":"...","revision":"...","total":M,"offset":0,"covers":[{"album_key":"...","representative_id":ID,"cover_key":"s-<16 hex>","available":true}],"next_offset":50}. cover_key is s-<16 hex> for a sidecar image (available:true) or e-<16 hex> for embedded art (available:null, not inspected yet). available is never false.
GET /catalog/art?revision=<rev>&representative_id=<id>&cover_key=<key> The original image bytes with a fixed Content-Length.

Art errors: 409 revision_or_cover_stale, 404 artwork_missing, 413 artwork_too_large (sidecar over 8 MiB), 413 embedded_artwork_too_large (over 4 MiB), 503 source_unavailable, artwork_unavailable, embedded_artwork_invalid or artwork_busy, 400 invalid_art_key. Other catalog codes: invalid_paging, invalid_revision, revision_mismatch, temporary_unavailable. Retry 503; restart after 409.

Queue

Request Response or effect
GET /queue?offset=0&limit=25 {"total":N,"offset":0,"revision":R,"songs":[{"offset":0,"index":ID,"title":"...","artist":"..."}]}. Upcoming songs only, limit caps at 25. index is -1 when the song is not in the library.
POST /queue/remove?offset=<n>&revision=<R> Remove one upcoming song.
POST /queue/clear?revision=<R> Clear the upcoming queue.
POST /queue/move?from=<n>&to=<n>&revision=<R> Move a song so it ends at to (queue_edit).
POST /queue/play?offset=<n>&revision=<R> Play an upcoming song without replacing the queue (queue_edit).

All return 200 OK. The revision changes after every queue change, so reread /queue before the next edit. Only one edit can wait per revision. Errors are {"error":"queue_error","code":...}: 400 invalid_request, 400 invalid_offset, 409 revision_mismatch, 409 edit_pending. The player checks the revision again when it applies the edit and drops it if the queue moved. For remove and clear, missing or non-numeric parameters return a text 404.

Playlists

Request Response or effect
GET /playlists {"playlists":[{"name":"Favorites","key":"@favorites","internal":true,"writable":false},...]}. Built-ins: @favorites, @most_played (at most 20 songs), @recently_played (when recently_played is listed). User playlists are .m3u files in the Playlists folder: key is the file name without extension, writable is true. Show name, pass key.
GET /playlists/songs?name=<key>&offset=<n> {"writable":true,"revision":"p-<16 hex>","songs":[{"index":ID,"title":"...","artist":"...","position":0}],"total":N,"next_offset":N}. Built-ins return "writable":false,"revision":null. Songs no longer in the library are skipped, so position can have gaps. A page holds what fits in about 64 KiB; continue with offset=<next_offset> while next_offset < total.
POST /playlists?name=<n>&index=<song-id> Create a playlist with one song. 500 if the name exists.
POST /playlists/add?name=<key>&index=<song-id> Add a song. A duplicate is skipped with 200 text Song already in playlist. A built-in returns 403 text Playlist is read-only.
POST /playlists/create?name=<n> Empty playlist (playlist_edit).
POST /playlists/rename?name=<key>&new_name=<n> Rename.
POST /playlists/delete?name=<key> {"key":"Gym","deleted":true}
POST /playlists/remove?name=<key>&position=<n>&revision=<R> Remove an entry.
POST /playlists/move?name=<key>&from=<n>&to=<n>&revision=<R> Move an entry so it ends at to.
POST /playlists/import?name=<n>, body = the file Store an .m3u or .m3u8 as <n>.m3u (playlist_import). Send Content-Length. At most 256 KiB, no NUL bytes. Stored unchanged. Reply: {"key":"Road","name":"Road.m3u","revision":"...","entries":N,"matched":M}. matched counts entries that resolve to library songs; paths on the phone will not match.

create, rename, remove and move return {"key":"Gym","name":"Gym.m3u","revision":"p-..."}. revision is null if the file could not be reread; reload the playlist then. Edits by position need the revision from /playlists/songs; it changes on every entry edit, and a stale one returns 409.

Names are a file name without extension: 1 to 127 bytes, none of / \ : * ? " < > |, no control bytes, no leading ., no trailing space or dot, no .., not ending in .m3u or .m3u8. A name that differs from an existing one only by case counts as existing. Names starting with @, Favorites and Most Played are reserved.

Errors: 400 invalid_name, reserved_name, invalid_request, invalid_position, invalid_playlist, incomplete_body (body stalled for 2 seconds); 403 read_only; 404 playlist_not_found; 409 name_exists, revision_mismatch; 411 length_required; 413 playlist_too_large; 500 read_failed, write_failed. On an early error the player still discards the body, so always read the response.

Folders, recent and favorites

Features folder_browse, recently_played and favorites_edit. Paged routes take offset (default 0) and limit (default 50, at most 100) as plain digits, and return next_offset; keep going while next_offset < total. Malformed % escapes and %00 return 400.

Folders

The only root is the SD card, id sd. A path is relative to it: "" or / is the root, otherwise names joined by /, with no empty, ., .. or hidden (leading dot) part, no trailing slash, backslash or control bytes. root defaults to sd.

Request Response
GET /folders/roots {"roots":[{"id":"sd","name":"SD card","available":true}]}
GET /folders?root=sd&path=<rel>&offset=0&limit=50 {"root":"sd","path":"Artist/Album","parent":"Artist","total":N,"folder_count":D,"offset":0,"entries":[{"type":"folder","name":"CD1"},{"type":"playlist","name":"mix.m3u"},{"type":"track","name":"01.flac","index":ID,"title":"...","artist":"..."}],"next_offset":3}. Folders first, then files, sorted by name ignoring case. Only folders, .m3u and .m3u8 playlists and audio files. parent is null at the root. A track's index is -1 when it is not in the library; title is then the file name. Read from the card on every request.
POST /folders/play?root=sd&path=<rel file> Play the file with its folder as the queue, like tapping it in Files. Returns OK once accepted.

Errors (folder_error): 400 invalid_path, invalid_paging, not_playable; 404 folder_not_found, track_not_found; 503 storage_unavailable, folder_too_large (over 4,096 entries), folder_unavailable, temporary_unavailable.

Recently played

GET /recent?offset=0&limit=50 returns {"total":N,"offset":0,"songs":[{"index":ID,"title":"...","artist":"...","last_played":1758844800}],"next_offset":50}, newest first. last_played is the player clock in Unix seconds. Each song appears once, with its latest play time. Only library songs; at most the newest 500. Errors (recent_error): 400 invalid_paging, 503 temporary_unavailable.

Favorites

Favorites are the per-song heart flag, the same one the player's heart sets. @favorites follows it.

Request Response
GET /favorites/state?ids=<id>,<id> {"songs":[{"index":7,"found":true,"favorite":true}]}. 1 to 100 IDs, in request order.
POST /favorites/add?index=<id>, /favorites/remove?index=<id> {"index":ID,"favorite":true}. Optional catalog_revision.
POST /favorites/add?current=1, /favorites/remove?current=1 The playing track. index is -1 if it is not a library song.

200 means the change is on the card. The latest change wins, from the app or the player. Errors (favorite_error): 400 invalid_target (send exactly one of index or current=1), invalid_index, invalid_ids; 404 song_not_found, nothing_playing; 409 revision_mismatch; 503 write_failed, temporary_unavailable.

Wi-Fi file import

Features wifi_import (sessions) and wifi_import_files (file routes). Start a session, then browse and change files in the music folder.

Request Response
POST /import/start, POST /import/stop 202 {"accepted":true}. Repeating the current state is safe. 409 with code busy if a start or stop is already running.
GET /import {"state":"ready","error":null,"port":8899}. state is stopped, starting, ready, stopping or error. When state is error, error is one of wifi_disabled, sd_card_unavailable, player_storage_busy, file_import_busy, radio_sleep, import_start_failed, remote_control_unavailable or file_import_stop_failed.

The on-player Import screen shares this session. Starting remotely does not move the player to that screen.

File routes need state ready (else 409 import_not_ready). Paths are relative to the music root, use /, and have no leading or trailing slash. No absolute names, empty or dot parts, protected leading-dot names, backslashes, controls or parts over 255 bytes. Unknown or repeated query parameters are rejected.

Request Response
GET /import/files?path=<dir>&offset=0&limit=50 {"path":"...","entries":[{"name":"...","path":"...","isDirectory":false,"size":123}],"offset":0,"next_offset":50,"total":N}. Regular files and folders only. Limit caps at 100. next_offset is null on the last page.
POST /import/files/upload?path=<dir>&name=<leaf> Raw body (not multipart), Content-Length required, up to 4,294,967,295 bytes. 201 {"ok":true,"path":"...","name":"...","bytes":N}. Wi-Fi only. Never overwrites. A failed upload removes its partial file.
POST /import/files/rename?path=<item>&name=<new> {"ok":true}; 409 if the target exists.
POST /import/files/delete?path=<item> {"ok":true}; 409 for a non-empty folder.
POST /import/files/mkdir?path=<parent>&name=<leaf> 201 {"ok":true}

An upload times out after 12 seconds without network progress, or six hours in total. An upload in progress may show in listings.

File route errors:

Status Codes
400 invalid_query, invalid_path, invalid_paging, invalid_path_or_name, open_failed, upload_failed, rename_failed, delete_failed, mkdir_failed, directory_not_found (also 404)
403 wifi_only
404 directory_not_found, item_not_found
409 import_not_ready, name_exists, directory_not_empty, storage_busy, import_stopping
411, 413 length_required, file_too_large
414 uri_too_long
500 directory_read_failed
501 rename_not_supported
503 import_stopped, storage_busy

Settings

Feature settings_v1. Read and change the player's settings. Reads need the PIN. Changes need the PIN in the header (trusted Bluetooth devices excepted), Content-Type: application/json and a body of at most 4,096 bytes.

Request Response
GET /settings/schema The description of every setting. See below.
GET /settings?since=<rev>&epoch=<e> {"epoch":E,"revision":R,"full":true,"writable":true,"values":{"key":value}}. With a valid since only settings changed after it are listed and full is false. since=0 returns everything with full true. Without since, or if since is ahead or epoch differs, you get everything. Unavailable settings are left out.
POST /settings Apply changes.
POST /settings/actions/library.rescan Start a music database update. 202 {"accepted":true}, or 409 rescan_running. Needs the header and JSON content type; the body is ignored.

The revision starts at 0 on every start, so keep the epoch with it. A different epoch means the player restarted; reload everything.

Schema: {"schemaVersion":1,"device":{"model":"...","board":"r1","playerVersion":"..."},"groups":[{"id":"...","label":"...","labelId":"..."}],"settings":[...],"actions":[{"id":"library.rescan","group":"library","label":"...","labelId":"..."}]}. board is a short board id such as r1. Each setting has key, group, label, labelId (the English text, stable; label follows the player language), type (bool, enum, int, percent, preset, string), apply (live, next_track, next_use, next_boot) and available. When unavailable it has a reason. Optional: readOnly, min/max, unit, values (presets), options (value, label, labelId), dependsOn, confirmAbove. Settings marked readOnly cannot be changed; reason is device_only or would_lock_out_remote (Remote Control, Wi-Fi, hostname and USB mode). model matches device_model in /status.

Change request:

{"changes":{"some_key":true,"other_key":40},"acknowledge":["other_key"],"baseRevision":12,"epoch":3}
  • Booleans are true or false; every other setting is a whole number. Text settings cannot be changed.
  • A setting with confirmAbove needs its key in acknowledge when the value is above that number.
  • baseRevision and epoch are optional. With them, the change is refused (409 revision_mismatch) if a setting you are changing was changed after that revision, or the epoch differs.
  • Reply: {"epoch":E,"revision":R,"applied":["key"],"pending":[{"key":"k","reason":"next_track"}],"alsoChanged":["key"]}. pending settings take effect later, as reason says. alsoChanged lists settings changed as a side effect.

Errors (settings_error): 400 invalid_body, invalid_base_revision, body_required, body_unreadable; 401 header_auth_required; 405 method_not_allowed; 413 body_too_large; 415 json_required; 409 settings_busy; 503 player_busy (the screen did not pick it up in time, or applying took over 10 seconds, in which case the change may have been applied). The body must arrive within 4 seconds (body_unreadable). 409 revision_mismatch includes the current values in current. validation_failed carries errors:[{"key":"...","code":"..."}] (up to 16): unknown_key and invalid_type are 400, read_only is 403, unavailable is 409, and out_of_range (with min, max), not_an_option, confirmation_required (with confirmAbove) and dependency_unmet are 422. The status is that of the first error.

Plugins, store and layouts

Features plugin_store, plugin_management and player_layouts. All routes need the PIN. Changes also need the header (trusted Bluetooth excepted; a cookie is not enough, 403 pin_header_required), Content-Type: application/json (415 json_required) and a JSON object body of at most 4,096 bytes (413 body_too_large). Use {} for actions without fields. Unknown or repeated fields, and any query string, are rejected (400). There are no URLs, paths or Lua uploads.

Lists take only offset (default 0) and limit (default 50, at most 200). Stop when offset + array length >= total. Responses are at most 1 MiB.

Request Body and response
GET /plugin-store State, progress and catalog rows. See below.
POST /plugin-store/refresh {}. Download the catalog.
POST /plugin-store/install, /update {"id":"catalog.id","force":false}
POST /plugin-store/update-all {}
POST /plugin-store/uninstall {"id":"catalog.id"}
GET /plugin-store/preview?id=<catalog-id> 200 {"mime":"image/jpeg","data":"<base64>"}; 202 {"pending":true} while it downloads; 404 plugin_not_found or preview_not_found; 409 busy (also when the store is busy and the preview has not started); 503 preview_unavailable.
GET /plugins {"offset":0,"limit":50,"total":1,"truncated":false,"refresh_pending":false,"plugins":[{"id":"Example.lua","name":"Example","enabled":true,"loaded":true,"error":null,"player_layout":false,"theme_package":false,"can_open_settings":true}]}
POST /plugins/set-enabled {"id":"Example.lua","enabled":false}. 202 {"accepted":true,"refresh_requested":true}; the player reloads plugins itself. Unknown ID: 404 not_found.
POST /plugins/refresh {}. Reload plugins and rebuild the UI.
POST /plugins/open-settings {"id":"Example.lua"}. Open that plugin's Settings entry on the player.
GET /player-layouts {"current":"default","offset":0,"limit":50,"total":1,"layouts":[{"id":"default","name":"Default","source":"builtin_c","has_preview":false}]}. Sources: builtin_c, exported_c, xml_file.
GET /player-layouts/preview?id=<layout-id> 200 {"mime":"image/png","data":"<base64>"} (PNG up to 240 by 400); 404 layout_not_found or preview_not_found.
POST /player-layouts/select {"id":"layout.id"}. 202 {"accepted":true,"current":"layout.id"}

Store routes take catalog IDs (example); plugin routes take file names from /plugins (Example.lua). The support module AsyncHttp.lua is hidden. The scan covers 400 files and sets truncated when it hits that. error in a plugin row is null for loaded or disabled plugins, load_limit_reached or load_failed otherwise. Preview requests take exactly one id, and previews are at most 512 KiB.

Store state

{"state":"ready","percent":100,"current_plugin":"","error":null,"changed":false,"refresh_required":false,"confirmation_required":false,"offset":0,"limit":50,"total":1,"plugins":[{"id":"example","name":"Example","version":"1.0.0","state":"available","incompatible":false,"needs_confirmation":false,"player_layout":false,"theme_pack":false,"description":"Example plugin","category":"utility","author":"Author","size":1024}]}
  • States: idle, refreshing, installing, updating, updating_all, uninstalling, ready, needs_confirm, failed. Row states: available, installed, update, manual, incompatible, removed.
  • Install, update, update-all and uninstall need a loaded catalog (409 catalog_required; refresh first). Unknown IDs return 404 plugin_not_found; bad IDs 400 invalid_plugin_id.
  • Store actions return 202 with accepted:true and a snapshot with no rows (limit 0). That only means the job started. Poll GET /plugin-store until the state is ready, needs_confirm or failed.
  • needs_confirm: an install or update would replace local files. Show the row's warning and, only with the user's consent, repeat with "force":true. For update-all, handle each row with needs_confirmation on its own. Never retry with force automatically.
  • The store state is shared with the player's own screen, not private to your app.
  • All plugin requests, GETs included, share one slot, so concurrent requests get 409 busy.
  • If .plugins/.store_installed on the SD card is damaged, state stays ready but error holds a localized message, and install, update and uninstall fail with it without changing anything. Show it; the fix is on the card.
  • After a change, when refresh_required is true, read any error or confirmation first (a refresh resets the store state), then call POST /plugins/refresh (not needed after set-enabled). It returns 202 {"accepted":true,"refresh_requested":true}. refresh_pending in GET /plugins stays true until the reload is done; wait for false, then reread plugins and layouts. Reloading resets plugin-owned audio controls (speed, loop) and can send the player to Home. It does not touch playback or the queue.
  • Changes return 409 busy (or store_busy) while the player's own store, setup, or a UI rebuild is running. Reads still work.

Opening a plugin's settings

can_open_settings is true when a live plugin has a row on any Settings page. Treat a missing field as false. POST /plugins/open-settings opens the plugin's first such row (Additional Tools is searched first, then the other Settings pages) and returns 202 {"accepted":true}. The screen is shown on the player; nothing is drawn in the app. Errors: 404 settings_not_found, 409 ui_not_ready.

Plugin errors

Errors are {"error":"plugin_api_error","code":"..."}: 400 invalid_query, invalid_body, body_required, body_unreadable, invalid_plugin_id; 403 pin_header_required; 404 not_found, plugin_not_found, settings_not_found, layout_not_found, preview_not_found; 405 method_not_allowed; 409 busy, store_busy, catalog_required, ui_not_ready; 413; 415; 500 out_of_memory; 503 response_too_large, storage_write_failed, store_start_failed, store_unavailable, preview_unavailable, ui_unavailable. Requests wait at most 10 seconds for the screen. 504 ui_timeout means it never started. 504 operation_in_progress means it started, so check with a GET before trying again.