BOAR Server API

The requests, responses, and behavior needed to build a server compatible with the BOAR app.

The app stores only a host name, then builds requests as https://{host}/{path}. Custom servers must be reachable over HTTPS at the root of the host. A path prefix such as https://example.com/boar/ is not supported by the app.

General Rules

GET/BOAR

Health check used before the app saves a custom server host.

Response

I am BOAR!

The body must equal I am BOAR! after trimming whitespace.

BOAR does not require a specific backend implementation. A compatible server may proxy YouTube Music, redirect to YouTube Music, or produce compatible JSON itself. What matters is the request and response shape seen by the app.

POST/v1/search

Searches artists or songs. The app sends a YouTube Music InnerTube-style JSON request.

Request

{
  "context": {
    "client": {
      "clientName": "WEB_REMIX",
      "clientVersion": "1.20251111.09.00"
    }
  },
  "query": "search text",
  "params": "..."
}

Response

Return a successful YouTube Music search-compatible JSON response. A 307 redirect that preserves the original POST body is also compatible if the final response is the YouTube Music JSON.

POST/v1/browse

Fetches artist pages, album pages, release shelves, and lyrics pages.

Request

{
  "context": {
    "client": {
      "clientName": "WEB_REMIX",
      "clientVersion": "1.20251111.09.00"
    }
  },
  "browseId": "MPREb_...",
  "params": "optional"
}

Response

Return a successful YouTube Music browse-compatible JSON response for the requested browseId. The app extracts artist metadata, album lists, album tracks, video IDs, thumbnails, and lyrics from this response.

GET/playlist/{playlist_id}

Returns lightweight metadata for a YouTube playlist without returning audio bytes.

Response

{
  "playlist_id": "PL...",
  "entries": [
    {
      "id": "youtubeVideoId",
      "title": "Song title",
      "channel": "Artist or channel",
      "thumbnail": "https://..."
    }
  ],
  "count": 1,
  "queued": false,
  "cached": false
}

playlist_id and entries are required. Each entry must include id. The app can tolerate missing title, channel, and thumbnail, but providing them gives better imported metadata.

POST/queue/{playlist_id}

Optional preload hint. The app calls this after opening an album when a playlist ID is known. Return 200 with any JSON body.

Example Response

{
  "playlist_id": "PL...",
  "queued": true
}

GET/{playlist_id}/{index}

Returns the playable audio file for a playlist entry. index is zero-based and follows the server playlist order. Prefer /video/{video_id} when a video ID is known; an album listing can differ from playlist order.

Response

Audio file bytes with a successful HTTP status.

GET/video/{video_id}

Returns the playable audio file for a single YouTube video ID.

Response

Audio file bytes with a successful HTTP status.

GET/cache/has?video_id={video_id}

Tells the app whether server-side audio for a video ID can be reused in a listening room or Shared Library. If your server does not support reusable cached audio, return {"cached": false}.

Response

{"cached": true}

GET/cover/has?video_id={video_id}&cover_hash={sha1}

Tells the app whether a cover image is already available on the server. At least one query parameter should be accepted. If your server does not support reusable cached covers, return {"cached": false}.

Response

{"cached": true}

Listening Rooms

Listening rooms use server-authoritative playback state. The app joins a room, receives a member_id, uploads or references tracks, repeatedly syncs room state, and downloads room audio from URLs supplied by the server.

Required Behavior

GET/rooms

Lists public active rooms.

Response

{"rooms": [RoomSummary]}

POST/rooms/version/check

Checks whether the current app build may use listening rooms. To allow the app, return ok: true.

Request

{"build": 42}

Response

{
  "ok": true,
  "build": 42,
  "min_build": null
}

GET/rooms/version

Legacy fallback used only if /rooms/version/check is unavailable or unusable. Implementing /rooms/version/check is enough for current app builds.

Response

{"min_version": "1.0"}

POST/rooms

Creates a room; creating does not join it. Optional library_locked: true selects a single-library private room, with optional library_name. Send library_loading: true while its creator is still contributing songs. Public rooms ignore library locking. A locked-room creation response includes a secret creator_token; supply it when the creator joins. Do not share that token with guests.

Request

{
  "name": "Friday Night",
  "public": false,
  "library_locked": false,
  "library_name": null
}

Response

{
  "code": "123456",
  "name": "Friday Night",
  "public": false,
  "library_locked": false,
  "library_name": null
}

POST/rooms/{code}/join

Joins a room and returns the current snapshot plus the caller's member_id.

Request

{"member_name": "Listener", "creator_token": "optional-token-from-create"}

Guests omit creator_token. Only a member joined with the valid creator token can upload to a locked library room or finish its loading phase.

Response

RoomSnapshot with "member_id"

POST/rooms/{code}/leave

Removes the member. For a single-library room, close the room when its library owner leaves. Return 404 on subsequent sync requests so remaining listeners exit playback. Return whether the member was removed and whether the room was deleted.

Request

{"member_id": "member-id"}

Response

{
  "left": true,
  "room_deleted": false
}

POST/rooms/{code}/heartbeat

Refreshes member presence without returning a full snapshot.

Request

{"member_id": "member-id"}

Response

{"ok": true}

GET/rooms/{code}/sync?since={version}

Requires X-BOAR-Member-ID (the legacy member_id query parameter is also accepted). Refreshes member presence. since is an optional nonnegative revision: return 204 with no body when it matches the current revision; otherwise return a snapshot. An older or newer supplied revision receives the current snapshot.

Response

RoomSnapshot

GET/rooms/{code}/tracks

Requires the member header. Returns metadata for tracks in the current queue and queue order, not necessarily every song retained by the room.

Response

{
  "tracks": [RoomTrack],
  "queue": ["track-id"]
}

POST/rooms/{code}/upload

Uploads one playable audio file to a room. This endpoint uses multipart/form-data.

Multipart Fields

FieldRequiredValue
member_idYesRoom member ID.
metadataNoJSON text matching UploadTrackMetadata.
fileYesPlayable audio with a matching extension and MIME type: audio/mp4 for m4a/mp4, audio/mpeg for mp3, or audio/aac for aac.
coverNoJPEG cover image.

Response

RoomSnapshot with "added_track_id" and "added"

POST/rooms/{code}/add_cached

Adds server-cached audio to a room without uploading audio bytes. If you return {"cached": false} from /cache/has, the app will normally use /upload instead.

Request

{
  "member_id": "member-id",
  "video_id": "youtubeVideoId",
  "metadata": UploadTrackMetadata
}

Response

RoomSnapshot with "added_track_id" and "added"

If the audio exists but the requested cover does not, return 412 so the app can fall back to /upload.

POST/rooms/{code}/state

Updates synchronized playback state. client_version is the last revision seen by the client; return the authoritative snapshot after handling the request. The current app sends next for skipping and disables previous-song skips.

position is seconds into the track and playback_rate is a speed multiplier. client_time is the client's Unix timestamp; server_time_offset estimates server time minus client time. These fields allow you to account for transit time when applying a playing position.

Shuffle visits every known unplayed track before starting another cycle. Skipping counts the current track as visited. Explicit track selections may replay songs. A library room that exhausts its upload buffer pauses with waiting_for_library: true rather than restarting. The creator sends {"member_id":"member-id","library_loading":false} only after all contributions succeed. Accept repeated completion requests without restarting playback. Only wait for completion when library_loading: true was supplied at creation.

Request Fields

FieldTypeRequired
member_idstringYes
client_versionintegerNo
commandnext or previousNo
track_idstringNo
queue_indexintegerNo
statusplaying or pausedNo
positionnumberNo
playback_ratenumberNo
lyrics_openbooleanNo
library_loadingfalse, creator completion onlyNo
client_timenumberNo
server_time_offsetnumberNo

Response

RoomSnapshot

POST/rooms/{code}/force_track

Starts playback of an existing room track. If the track is not already in the queue, append it or otherwise make it the current queue item.

Request

{
  "member_id": "member-id",
  "track_id": "track-id",
  "position": 0,
  "playback_rate": 1.0,
  "status": "playing",
  "client_time": 1767311999.95,
  "server_time_offset": 0.12,
  "client_version": 5
}

Response

RoomSnapshot

POST/rooms/{code}/replace_current

Replaces the current queue item with an existing room track. BOAR uses this for private rooms. Public rooms may reject it with 403.

Request

{
  "member_id": "member-id",
  "track_id": "track-id",
  "position": 0,
  "playback_rate": 1.0,
  "status": "playing",
  "client_time": 1767311999.95,
  "server_time_offset": 0.12,
  "client_version": 5
}

Response

RoomSnapshot

POST/rooms/{code}/chat

Adds a chat message and returns recent chat messages.

Request

{
  "member_id": "member-id",
  "text": "hello"
}

Response

{"chat": [RoomMessage]}

GET/rooms/{code}/track/{track_id}

Returns the playable room audio file for a track. Send the member header; the member must still belong to the room. The legacy member query parameter is also accepted.

Response

Audio file bytes with a successful HTTP status.

GET/rooms/{code}/cover/{track_id}

Requires the member header (or legacy member query parameter). Returns a JPEG cover image for a track. If cover_url is present in RoomTrack, this URL should return bytes beginning with JPEG magic bytes.

Response

JPEG file bytes with a successful HTTP status, or 404 if no cover exists.

Shared Libraries

Shared Libraries let devices share a persistent track list and synchronize additions, removals, and renames. Requests identify the library by its ID without room member IDs or creator tokens. Treat the invite link as access to the library. Leaving in the app removes the local subscription and does not send a server deletion request.

Invite links use boar://shared/{payload}, where payload is the unpadded URL-safe Base64 encoding of https://{host}/shared-libraries/{id}. The app requires the invite host to match its configured server. Use the opaque ID returned by creation. Generate IDs that are URL-safe and cannot be guessed.

POST/shared-libraries

Creates an empty persistent library. Request: {"name":"My Library"}. Returns SharedLibrarySnapshot with a nonnegative integer revision.

GET/shared-libraries/{id}?since={revision}

Returns SharedLibrarySnapshot. Optional since is a nonnegative integer. Returns 204 with no body only when the revision matches; otherwise returns the complete active track list. A missing library returns 404.

POST/shared-libraries/{id}/mutate

{"base_revision": 7, "name": "Optional new name", "remove_track_ids": ["track-id"]}

base_revision is required and nonnegative; name and removal list are optional. Apply the requested edits and return the resulting snapshot. Use base_revision to handle offline edits without deleting a track added again by another device after that revision. Increment the revision when the library changes.

POST/shared-libraries/{id}/tracks/cached

{"video_id":"youtubeVideoId", "metadata": SharedLibraryUploadMetadata}

Reuses cached audio. Requires a valid video ID, either in metadata or at the top level. Returns a snapshot with added_track_id and added. Return 404 if the audio is unavailable so the app can fall back to uploading. If a requested cover is unavailable, you may return 412 to trigger a fallback.

POST/shared-libraries/{id}/tracks/upload

Multipart fields: required file, optional JSON text metadata matching SharedLibraryUploadMetadata, and optional image cover. No member ID is sent. Returns a snapshot with added_track_id and added. Accept the same audio formats as room uploads.

Keep track IDs stable across retries. Repeated contributions of the same audio or catalog video ID should not create duplicate entries. Preserve known metadata when a retry omits it, and keep distinct recordings separate even when their titles match.

GET/shared-libraries/{id}/track/{track_id}

Returns playable audio for an active track, or 404 if unavailable. No room member header is required.

GET/shared-libraries/{id}/cover/{track_id}

Returns a JPEG cover for an active track, or 404 if unavailable.

SharedLibrarySnapshot

{
  "id": "opaque-library-id",
  "name": "My Library",
  "revision": 7,
  "updated_at": 1767312000.123,
  "tracks": [SharedLibraryRemoteTrack],
  "added_track_id": "track-id",
  "added": true
}

id, name, revision, and tracks are required. updated_at is optional to the app. Added-track fields occur on upload/cached-add responses. Return each active track once; the app uses this list for both the invite count and the tracks saved on the joining device.

SharedLibraryRemoteTrack

{
  "id": "track-id",
  "title": "Song title",
  "artist": "Artist",
  "album": "Album",
  "duration": 214.2,
  "video_id": "youtubeVideoId",
  "cover_hash": "sha1-of-cover-bytes",
  "lyrics": LyricsInfo,
  "import_source": "file",
  "download_url": "/shared-libraries/library-id/track/track-id",
  "cover_url": "/shared-libraries/library-id/cover/track-id"
}

id, title, and download_url are required. Other fields are optional. import_source is file, youtube, or null. A supplied cover URL may still return 404.

SharedLibraryUploadMetadata

Uses the same title, artist, album, duration, video_id, cover_hash, lyrics, and import_source fields as the remote track, excluding id and URLs. The app supplies title; other metadata fields are optional.

Additional App Endpoints

GET/video/{video_id}/metadata

{"video_id":"youtubeVideoId","title":"Song title","artists":["Artist"],"album":null,"thumbnail_url":"https://...","duration":214.2}

Fetches display metadata without returning audio. Unavailable metadata returns 404.

POST/report

Receives feedback as a plain-text request body. Return a successful HTTP status after accepting the message; the app does not require a particular response body.

Shared Schemas

RoomSummary

{
  "code": "123456",
  "name": "Friday Night",
  "public": true,
  "members": 3,
  "tracks": 12,
  "current_track_title": "Track title",
  "current_track_artist": "Artist name"
}

code, name, public, members, and tracks are required. Current track fields may be null.

RoomSnapshot

{
  "room": RoomInfo,
  "state": RoomState,
  "queue": ["track-id"],
  "tracks": [RoomTrack],
  "members": [RoomMember],
  "chat": [RoomMessage],
  "server_time": 1767312000.456,
  "member_id": "member-id",
  "added_track_id": "track-id",
  "added": true
}

room, state, queue, tracks, and members are required. member_id is needed in the join response. added_track_id and added are needed in upload/add-cached responses. chat and server_time are recommended in every snapshot.

RoomInfo

{
  "code": "123456",
  "name": "Friday Night",
  "public": false,
  "library_locked": false,
  "library_name": null
}

RoomState

{
  "version": 5,
  "status": "playing",
  "playback_rate": 1.0,
  "lyrics_open": false,
  "track_id": "track-id",
  "queue_index": 0,
  "position": 42.35,
  "updated_at": 1767312000.123,
  "rewind_floor_index": 0,
  "waiting_for_library": false
}

track_id may be null or absent for an empty room. rewind_floor_index and waiting_for_library are optional. Other fields shown are required. Use status: "playing" or "paused". position is seconds.

RoomTrack

{
  "id": "track-id",
  "title": "Song title",
  "artist": "Artist",
  "duration": 214.2,
  "owner_id": "member-id",
  "size": 3456789,
  "hash": "content-hash",
  "lyrics": LyricsInfo,
  "download_url": "/rooms/123456/track/track-id",
  "cover_url": "/rooms/123456/cover/track-id"
}

id, title, and download_url are required. artist, duration, owner_id, size, hash, lyrics, and cover_url may be null or omitted when unavailable.

RoomMember

{
  "id": "member-id",
  "name": "Listener"
}

RoomMessage

{
  "id": "message-id",
  "member_id": "member-id",
  "member_name": "Listener",
  "text": "hello",
  "timestamp": 1767312000.123
}

UploadTrackMetadata

{
  "title": "Song title",
  "artist": "Artist",
  "duration": 214.2,
  "video_id": "youtubeVideoId",
  "cover_hash": "sha1-of-cover-bytes",
  "lyrics": LyricsInfo
}

The app always sends title. Other fields may be null or absent.

LyricsInfo

{
  "status": "available",
  "text": "Lyrics text",
  "source": "embedded"
}

status must be available or notAvailable. For unavailable lyrics, use {"status":"notAvailable","text":null,"source":null} or omit the whole lyrics field.

Errors

StatusMeaning
200Successful JSON or file response.
204Room or Shared Library revision is unchanged; no response body.
307Allowed for search/browse redirects when the original POST body is preserved.
400Missing or invalid required field.
403Member is missing from a room or the action is not allowed.
404Room, track, playlist, video, cover, or cached file not found.
412Cached audio exists but the requested cached cover is missing.
429Rate limit exceeded.
500Unexpected server failure.

Use a non-success HTTP status for failures. A JSON body such as {"description":"Room expired."} lets the app display a useful message. Room sync 404 is terminal: the app exits the room. Temporary network failures retry.