Skip to content

API Contracts ​

TuneCamp exposes a RESTful API for webapp–backend communication, plus dedicated endpoints for ActivityPub and the Subsonic protocol. The full OpenAPI specification is in openapi.yml.

Authentication ​

Most endpoints require a JWT (JSON Web Token) in the Authorization header:

Authorization: Bearer <token>

Obtain a token by posting credentials to POST /api/auth/login.


Core Endpoints ​

Authentication (/api/auth) ​

MethodPathDescription
POST/api/users/registerRegister a new user
POST/api/auth/loginAuthenticate and receive a JWT
GET/api/auth/statusReturn the current session and user profile

Music Catalog (/api/catalog, /api/tracks, /api/albums) ​

MethodPathDescription
GET/api/albumsList all local albums. Returns status (draft | published) and is_release (boolean) to distinguish library content from official releases
GET/api/albums/:idAlbum details including the track list
GET/api/artistsList all artists
GET/api/tracks/:idTrack metadata
GET/api/tracks/:id/streamBinary audio stream (supports Range for cloud tracks)
GET/api/waveform/:idWaveform data for visualisation
GET/api/releases/:id/artwork/:filenameServe additional release artwork securely

Payments & Monetisation (/api/payments) ​

MethodPathDescription
POST/api/payments/stripe/create-sessionCreate a Stripe Checkout session for fiat purchases
GET/api/payments/onramp-configStripe Crypto Onramp configuration
POST/api/payments/verifyVerify an on-chain transaction (ETH/USDC) on Base
GET/api/payments/download/:trackId?code=...Download a purchased track via unlock code
GET/api/payments/rate/USDCurrent ETH/USD exchange rate

Storage & Cloud (/api/storage) ​

MethodPathDescription
GET/api/storage/gdrive/authStart the Google Drive OAuth2 flow
GET/api/storage/gdrive/filesList files and folders on Google Drive
POST/api/storage/gdrive/importImport a Drive file as a gdrive:// reference
POST/api/storage/gdrive/localize/:idPermanently download a cloud file to the local server

Metadata & External Search (/api/metadata) ​

MethodPathDescription
GET/api/metadata/search?q=...Search album metadata across external providers (MusicBrainz, Discogs, iTunes, TheAudioDB)
GET/api/metadata/lyrics?artist=...&title=...Fetch song lyrics via Lyrics.ovh
POST/api/metadata/applyApply selected metadata to a local track

Social, Comments & Posts (/api/artists, /api/comments, /api/ap) ​

MethodPathDescription
GET/api/artists/:id/postsList an artist's public posts
POST/api/admin/postsCreate a new post (admin only)
GET/api/comments/track/:trackIdList comments for a specific track
POST/api/comments/track/:trackIdAdd a comment (requires authentication)
GET/api/ap/timeline/:artistIdRecent activity from followed actors
GET/api/ap/users/:slugActivityPub profile (actor) for a local user
POST/api/ap/inboxReceive incoming remote ActivityPub messages
POST/api/releases/:id/reportReport a release for copyright or inappropriate content
GET/api/admin/reportsList all active release reports (admin only)
DELETE/api/admin/reports/:idResolve or dismiss a report (admin only)

Administration (/api/admin) ​

MethodPathDescription
GET/api/admin/system/usersList registered users (admin only)
POST/api/admin/system/rescanTrigger a full library rescan
POST/api/admin/upload/additional-artworksUpload multiple additional artworks/booklets for a release (admin/artist only)
GET/api/admin/statsServer and database usage statistics
GET/api/admin/system/resourcesLive process/host resource snapshot β€” CPU, memory, host RAM, SQLite DB size, and running background tasks (root admin only)
GET/api/admin/storage/overviewInstance-wide disk usage and per-user breakdown (root admin only)
GET/api/admin/torrentsList active and completed torrents
POST/api/admin/torrents/addAdd a magnet link to the download queue
DELETE/api/admin/torrents/:hashRemove a torrent and optionally its downloaded data

Radio (/api/radio) ​

A single always-on station that streams the instance's catalog. Start/stop is admin-only; the stream and feeds are public.

MethodPathDescription
GET/api/radioCurrent station status (playing track, listener count)
POST/api/radio/startStart the station (admin only)
POST/api/radio/stopStop the station (admin only)
GET/api/radio/stream.m3uM3U playlist for external players
GET/api/radio/feed.rssRSS feed of the station
GET/api/radio/hls/:fileHLS playlist/segments for in-browser playback

Third-Party Protocols ​

Subsonic API (/rest) ​

TuneCamp implements the Subsonic protocol (v1.16.1) for compatibility with existing mobile clients such as DSub, Symfonium, Tempo, and Substreamer.

  • Base path: /rest/*.view
  • Supported methods include: getAlbumList, getMusicDirectory, stream, and more.

See SUBSONIC.md for the full compatibility table.

Model Context Protocol (/api/mcp) ​

TuneCamp implements MCP so that external AI clients can query the catalog and server statistics.

MethodPathDescription
GET/api/mcp/sseOpen the async SSE channel. Requires Bearer tc_... authentication
POST/api/mcp/messageSend a JSON-RPC request from client to server

See mcp-setup-guide.md for client configuration.


Response Format ​

All API responses (except audio streams) are JSON. On error, the server returns an appropriate HTTP status code and an error object:

json
{
  "error": "Descriptive error message"
}

Released under the MIT License.