Skip to content

Haptique Music API

The Haptique Music API lets developers build local music remotes, room panels, automation apps, now-playing displays, playback endpoint bridges, and agent workflows against a Haptique OS controller.

This API is part of the Haptique OS local flow. It does not replace the Fleet cloud backend or legacy Fleet integration routes.

Base URL

Use the OS API base path for new developer apps:

text
http://<haptique-host>:8080/v1/os

Equivalent local OS API mirrors may exist at /app/os and /api/os, but external developer apps should prefer /v1/os.

Authentication

Most requests require a bearer token:

http
Authorization: Bearer <token>

Obtain a token with:

http
POST /v1/os/auth/login
Content-Type: application/json

{
  "email": "admin@example.com",
  "password": "your-password"
}

Successful responses use the standard Haptique envelope:

json
{
  "status": true,
  "message": "Human readable message",
  "data": {}
}

Developer Use Cases

The Music API is intended for:

  • Mobile or tablet remotes
  • Wall-mounted now-playing dashboards
  • Hardware controllers for volume, transport, and mute
  • Automation apps that start music, switch rooms, or run presets
  • Search and browse experiences for local library and connected services
  • Music Bridge endpoints that register as playback targets
  • AI or MCP tools that need normalized media-player control

Quick Start

1. List playable media players

http
GET /v1/os/media/players
Authorization: Bearer <token>

Response shape:

json
{
  "status": true,
  "message": "Media players loaded.",
  "data": {
    "players": [
      {
        "id": "logical-device-id",
        "label": "Living Room",
        "available": true,
        "playable": true,
        "capabilities": {
          "transport": true,
          "volume": true,
          "seek": true
        },
        "nowPlaying": {
          "title": "Track Title",
          "artist": "Artist",
          "playback": "playing",
          "positionMs": 42000,
          "durationMs": 214000,
          "artworkUrl": "/app/os/media-services/library/artwork/cache/example.jpg"
        }
      }
    ],
    "summary": {
      "total": 1,
      "playing": 1
    }
  }
}

2. Send a transport command

http
POST /v1/os/media/players/{playerId}/command
Authorization: Bearer <token>
Content-Type: application/json

{
  "action": "pause"
}

Supported normalized player actions:

ActionPayload
pause{ "action": "pause" }
resume{ "action": "resume" }
next{ "action": "next" }
previous{ "action": "previous" }
seek{ "action": "seek", "positionMs": 42000 }
set_volume{ "action": "set_volume", "volume": 35 }
mute{ "action": "mute" }
unmute{ "action": "unmute" }

3. Search music

http
POST /v1/os/media-services/search
Authorization: Bearer <token>
Content-Type: application/json

{
  "query": "Kind of Blue",
  "serviceKey": "LOCAL_LIBRARY"
}

Common serviceKey values:

Service keyPurpose
LOCAL_LIBRARYHaptique indexed local files
INTERNET_RADIOSaved internet radio stations
SPOTIFYConnected Spotify account
APPLE_MUSICConnected Apple Music account
TIDALTidal source provider when configured
QOBUZQobuz source provider when configured

4. Play content on a target

http
POST /v1/os/media-services/play
Authorization: Bearer <token>
Content-Type: application/json

{
  "serviceKey": "LOCAL_LIBRARY",
  "contentType": "track",
  "contentId": "track-id",
  "targetType": "logical_device",
  "targetId": "logical-device-id"
}

For provider-backed content, include provider IDs or URIs returned by search or browse:

json
{
  "serviceKey": "SPOTIFY",
  "contentType": "playlist",
  "contentId": "spotify-playlist-id",
  "uri": "spotify:playlist:...",
  "contextUri": "spotify:playlist:...",
  "targetType": "logical_device",
  "targetId": "logical-device-id"
}

5. Read and manage the queue

http
GET /v1/os/media-services/queue/{targetId}?offset=0&limit=50
Authorization: Bearer <token>

Queue mutation endpoints:

MethodPathPurpose
POST/v1/os/media-services/queue/addAdd content to a target queue
POST/v1/os/media-services/queue/removeRemove a queue item
POST/v1/os/media-services/queue/moveReorder a queue item
POST/v1/os/media-services/queue/clearClear a target queue
POST/v1/os/media-services/queue/selectSelect and play a queue item
POST/v1/os/media-services/queue/save-playlistSave the current queue as a playlist

Endpoint Families

Media Players

Use these endpoints when building a normalized remote UI. The server decides which logical devices are playable.

MethodPathDescription
GET/v1/os/media/playersList playable media players
GET/v1/os/media/players/candidatesList included and excluded media-player candidates
POST/v1/os/media/players/{playerId}/commandSend a normalized command to one player

Media Services

Use these endpoints for service status, playback, search, source browsing, library, and queues.

MethodPathDescription
GET/v1/os/media-services/statusFull media service status: accounts, players, sessions, presets, targets, capabilities, pending commands
GET/v1/os/media-services/playersMusic Services player roster
GET/v1/os/media-services/endpointsAvailable local and provider endpoints
POST/v1/os/media-services/endpoints/discoverRefresh endpoint discovery
POST/v1/os/media-services/endpoints/updateUpdate endpoint label or enabled state
POST/v1/os/media-services/endpoints/airplay/pair/startStart AirPlay endpoint pairing
POST/v1/os/media-services/endpoints/airplay/pair/finishFinish AirPlay endpoint pairing
GET/v1/os/media-services/sourcesList source providers
GET/v1/os/media-services/sources/{providerKey}/browseBrowse a provider source
GET/v1/os/media-services/sources/{providerKey}/libraryProvider library browse alias
POST/v1/os/media-services/searchSearch content
POST/v1/os/media-services/playStart playback
POST/v1/os/media-services/commandSend target-level playback command
POST/v1/os/media-services/transferTransfer playback or queue to another target
POST/v1/os/media-services/presets/saveSave a media preset
POST/v1/os/media-services/presets/removeRemove a media preset

Library

Use library endpoints for local-library apps, browse pages, playlist tools, and metadata displays.

MethodPathDescription
GET/v1/os/media-services/libraryLocal library summary
GET/v1/os/media-services/browse/libraryBrowse local library
GET/v1/os/media-services/library/homeHome screen library sections
GET/v1/os/media-services/library/albumsList albums
GET/v1/os/media-services/library/albums/{id}Album detail
GET/v1/os/media-services/library/artistsList artists
GET/v1/os/media-services/library/artists/{id}Artist detail
GET/v1/os/media-services/library/tracksList tracks
GET/v1/os/media-services/library/playlistsList playlists
GET/v1/os/media-services/library/playlists/{id}Playlist detail
POST/v1/os/media-services/library/playlists/saveSave a playlist
POST/v1/os/media-services/library/playlists/tracks/addAdd a track to a playlist
GET/v1/os/media-services/library/folders/browseBrowse storage folders
POST/v1/os/media-services/library/folders/saveSave watched folders
POST/v1/os/media-services/library/rescanRescan local library
POST/v1/os/media-services/library/artwork/refreshRefresh cached artwork

The local OS app API also exposes POST /app/os/media-services/library/upload for multipart uploads with the tracks form field. Uploaded tracks are added to the local music library and trigger a scan.

Metadata Graph and Profiles

Use these endpoints for richer music-library experiences.

MethodPathDescription
GET/v1/os/media-services/library/metadata-graphFull metadata graph
GET/v1/os/media-services/library/smart-viewsSmart library views
GET/v1/os/media-services/library/graph/searchSearch graph entities
GET/v1/os/media-services/library/graph/artists/{id}Graph artist profile
GET/v1/os/media-services/library/graph/albums/{id}Graph album profile
GET/v1/os/media-services/library/graph/compositions/{id}Graph composition profile
GET/v1/os/media-services/profileCurrent music profile
POST/v1/os/media-services/profile/markers/saveSave a profile marker
POST/v1/os/media-services/profile/markers/removeRemove a profile marker
POST/v1/os/media-services/profile/filters/saveSave a profile filter
POST/v1/os/media-services/profile/filters/removeRemove a profile filter
POST/v1/os/media-services/library/identity-links/saveLink metadata identities
POST/v1/os/media-services/library/identity-links/splitSplit linked identities

Groups, DSP, and Remote Access

MethodPathDescription
GET/v1/os/media-services/groupsList music groups
POST/v1/os/media-services/groups/saveCreate or update a group
POST/v1/os/media-services/groups/removeRemove a group
GET/v1/os/media-services/dsp/profilesList DSP profiles
POST/v1/os/media-services/dsp/profiles/saveSave a DSP profile
POST/v1/os/media-services/dsp/profiles/removeRemove a DSP profile
GET/v1/os/media-services/remote-access/statusRemote-access capability/status
POST/v1/os/media-services/remote-access/enableEnable remote access where supported
POST/v1/os/media-services/remote-access/disableDisable remote access
POST/v1/os/media-services/remote-access/sessionCreate a remote access session
POST/v1/os/media-services/remote-access/session/verifyVerify a remote access session
POST/v1/os/media-services/remote-access/reachability/probeRecord a remote reachability probe

Internet Radio

MethodPathDescription
GET/v1/os/media-services/radioInternet Radio catalog
GET/v1/os/media-services/radio/catalogInternet Radio catalog alias
GET/v1/os/media-services/radio/channelsInternet Radio channel alias
GET/v1/os/media-services/sources/INTERNET_RADIO/stationsSaved stations
POST/v1/os/media-services/sources/INTERNET_RADIO/stations/saveSave a station
POST/v1/os/media-services/sources/INTERNET_RADIO/stations/removeRemove a station

Music Bridge Endpoints

Music Bridge lets a developer app or device register itself as a Haptique playback target.

Register a bridge endpoint

http
POST /v1/os/media-services/bridge/endpoints/register
Authorization: Bearer <token>
Content-Type: application/json

{
  "id": "kitchen-display",
  "label": "Kitchen Display",
  "subtitle": "Raspberry Pi endpoint",
  "controlUrl": "http://192.168.1.40:4545",
  "streamBaseUrl": "http://192.168.1.40:4545/streams",
  "capabilities": {
    "canPlay": true,
    "canPause": true,
    "canSeek": true,
    "canSetVolume": true,
    "canMute": true,
    "canChangeTrack": true,
    "localStreamSupport": true,
    "supportedProtocols": ["hos_music_bridge", "http_stream"],
    "codecs": ["mp3", "aac", "flac"],
    "supportsLossless": true
  },
  "metadata": {
    "platform": "linux-arm64",
    "agentVersion": "1.0.0"
  }
}

After registration, Haptique discovers the endpoint as a music_bridge:<id> target. When playback starts, Haptique sends commands to:

text
POST <controlUrl>/commands

Example command delivered to the endpoint:

json
{
  "action": "play_media",
  "targetId": "music_bridge:kitchen-display",
  "endpointId": "kitchen-display",
  "payload": {
    "streamUrl": "http://haptique-host:8080/v1/os/media-services/library/stream/track-id",
    "transport": {
      "mode": "pull_url",
      "url": "http://haptique-host:8080/v1/os/media-services/library/stream/track-id",
      "title": "Track Title",
      "subtitle": "Artist - Album",
      "artworkUrl": "http://haptique-host:8080/..."
    }
  }
}

The endpoint should acknowledge commands with a JSON response:

json
{
  "ok": true,
  "acknowledged": true,
  "sessionId": "kitchen-display-session-1"
}

Bridge management endpoints:

MethodPathDescription
GET/v1/os/media-services/bridge/endpointsList registered bridge endpoints
POST/v1/os/media-services/bridge/endpoints/registerRegister or update a bridge endpoint
POST/v1/os/media-services/bridge/endpoints/removeRemove a bridge endpoint

Live State

For live app updates, use the OS state stream:

http
GET /v1/os/state/stream?accessToken=<token>

Use /v1/os/media-services/status as the snapshot refresh endpoint when the app reconnects or needs to reconcile player, queue, and account state.

OpenAPI

The interactive OpenAPI document is available in the wiki at:

text
/haptique-os-api.openapi.json

The current OpenAPI includes the canonical media-player endpoints and the core media-service search/play/control endpoints. This wiki page documents the broader music API surface exposed by the running Haptique OS server.

Implementation Notes

  • Prefer /v1/os/media/players for remote-control player rosters because it returns normalized playable devices.
  • Use /v1/os/media-services/status for full music-service state, service accounts, sessions, presets, targets, and capabilities.
  • Use server-confirmed state from status or state stream instead of assuming playback succeeded only because a command request returned status: true.
  • Treat available, playable, and capabilities as runtime values. They can change when devices disconnect, providers expire, or endpoints re-register.
  • Keep third-party apps on the Haptique OS local API. Do not call Fleet-era /integration/* routes unless you are intentionally building Fleet compatibility.