Skip to content

API reference

Audience: Users and maintainers scripting against the local FastAPI app. Goal: Summarize endpoint families and key payload rules. Type: reference

The API is local and unauthenticated by design. Bind the server carefully. Use 127.0.0.1 unless you intentionally expose it on a LAN.

The backend schemas below are the active v7 contract. The checked-in React client still uses pre-v7 payloads and has not yet been ported, so this page does not claim frontend compatibility.

Database

MethodPathPurpose
GET/api/database/currentcurrent SQLite selection
POST/api/database/switchswitch to a path
POST/api/database/dialogopen native database picker
POST/api/database/cleardelete SQLite library records

/api/database/clear does not delete audio files.

Database state returns path, artifacts_path, evaluation_path, catalog_uuid, and selected. A fresh path creates schema-v7 Core plus mandatory Artifacts. Evaluation remains optional. Existing non-v7 or incomplete bundles are rejected rather than migrated.

Library and media

MethodPathPurpose
POST/api/library/scanstart scan job
POST/api/library/tags/refreshstart tag refresh job
POST/api/library/relocatepreview or apply stored path relocation
GET/api/library/summarycounts for tracks, analyses, likes, classifiers
GET/api/trackspaginated lightweight track rows
POST/api/tracks/filteredfull filtered list for UI set actions
GET/api/tracks/{track_id}full metadata row
GET/api/tracks/{track_id}/sonara-timelineexplicit Timeline payload read
POST/api/tracks/{track_id}/likedtoggle local liked state
GET/media/{track_id}stream preview audio

Track list query ranges include limit=1..500, offset>=0, search_mode=like|fts, and preset=all|syncopated.

The timeline endpoint returns complete stored beats, onset_frames, chord_sequence, chord_events, tempo_curve, energy_curve, segments, loudness_curve, and downbeats payloads when available. It returns {} when no current timeline row exists and 404 for an unknown track. Regular track rows use the v7 TrackSummaryV7 shape: composite identity (catalog_uuid, track_id, track_uuid, content_generation), file_path, compact tags, analysis_coverage, and classifier-score summaries. Detailed rows expose optional_outputs.timeline_fields, sonara_embedding_available, and audio_fingerprint_available.

Each field is a serialized payload rather than a raw top-level array. The response shape is:

json
{
  "energy_curve": {
    "value": [0.31, 0.44, 0.72],
    "type": "list",
    "length": 3
  }
}

Analysis and classifiers

MethodPathPurpose
POST/api/analysis/jobsstart analysis job
GET/api/analysis/jobs/latestlatest analysis job
GET/api/analysis/jobs/{job_id}job status
POST/api/analysis/jobs/{job_id}/cancelrequest cancellation
POST/api/analysis/resetreset one family
POST/api/analysis/sonara/releases/prepareback up and activate the loaded four-output SONARA release
GET/api/classifierspromoted classifier profiles
POST/api/classifiers/analyzescore selected classifiers; empty list means all compatible
POST/api/classifiers/{classifier_key}/analyzescore one classifier
POST/api/classifiers/resetdelete selected classifier scores
POST/api/analysis/pipelinesqueue selected stages in fixed order
GET/api/analysis/pipelines/latestlatest parent pipeline status
GET/api/analysis/pipelines/{job_id}parent and child-stage status
POST/api/analysis/pipelines/{job_id}/cancelcancel current and pending stages

Audio analysis payload fields include models and limit. ML requests add device, top_k, track_batch_size, and inference_batch_size. SONARA requests add sonara_outputs and sonara_batch_size. classifier_keys is not accepted. Allowed SONARA outputs are core, timeline, embedding, and fingerprint. Omission defaults to ["core"]. At least one is required for a SONARA job, and normalization always includes core. SONARA runs alone, and its scheduler compares the independent contract for every selected output. It passes paths to native analyze_batch. ML models continue to use shared FFmpeg decode. An unprepared release returns 409 with SONARA_RELEASE_PREPARATION_REQUIRED.

The prepare payload is:

json
{
  "backup_dir": "C:\\backups\\dj-track-similarity",
  "confirm": "PREPARE SONARA RELEASE"
}

Clients cannot supply output kinds or a release hash. Preparation verifies Core and Artifacts backups and uses an ordered, receipt-backed flow that can resume after interruption.

The aggregate classifier payload is { "classifier_keys": [], "limit": null }. Readiness is manifest-specific, totals count ready classifier-track pairs, and not-ready tracks are excluded rather than failed. A pipeline payload selects sonara, ml, and/or classifiers plus one shared limit and nested stage settings. Execution order is always SONARA, ML, CLASSIFIERS. All manual and pipeline stages share one sequential application queue.

GET /api/library/summary reports current coverage for SONARA, MAEST analysis and embedding, MERT, MuQ, CLAP, likes, and compatible classifiers. Per-track analysis_coverage separates sonara_core, timeline, sonara_embedding, and fingerprint.

Reset requests use { "analysis_family": "sonara" } (or maest, mert, muq, clap). The typed response returns core_rows_deleted, artifact_rows_deleted, and classifier_rows_deleted. SONARA removes only dependent classifier rows; labels, feedback, and embedding-only results remain.

Search and SET

MethodPathPurpose
POST/api/searchseed search for maest, mert, muq, or clap
POST/api/search/sonaraSONARA seed search
POST/api/search/textCLAP text search
POST/api/search/hybridweighted Hybrid preview
POST/api/set-builder/generateSmart Set Builder preview
POST/api/reference/compareper-model Reference Compare groups for one seed
POST/api/reference/compare/verdictsave one Reference Compare listening verdict

Important ranges:

  • seed lists for Hybrid feedback and Hybrid search are 1..5 unique track IDs,
  • search limits are usually 1..500,
  • Hybrid per_source is 1..100,
  • Hybrid limit is 1..100,
  • SET limit is 1..500,
  • SET auto_seed_count is 1..5,
  • SET bpm_start and bpm_target are 20..300 when provided.

Reference Compare accepts one seed_track_id, optional models from clap, mert, muq, maest, and sonara, and limit=1..100. Verdicts use mood, palette, instruments, groove, genre, transition, or miss. They persist as local pair feedback under reference_compare:<model>.

Tags and export

MethodPathPurpose
POST/api/exportwrite M3U or CSV
POST/api/tags/genres/applysynchronous MAEST genre write path
POST/api/tags/genres/jobsstart MAEST genre tag job
GET/api/tags/genres/jobs/latestlatest genre job
GET/api/tags/genres/jobs/{job_id}genre job status
POST/api/tags/genres/jobs/{job_id}/cancelcancel genre job
POST/api/dialog/folderopen native folder picker

The genre API rejects per-track writes. Current behavior writes all available stored MAEST genres.

Helper tools

MethodPathPurpose
POST/api/audio-doctor/jobsstart Audio Doctor job
GET/api/audio-doctor/jobs/latestlatest Audio Doctor job
GET/api/audio-doctor/jobs/{job_id}job status
POST/api/audio-doctor/jobs/{job_id}/cancelcancel job
GET/api/audio-doctor/jobs/{job_id}/report/xlsxdownload XLSX
POST/api/audio-dedup/jobsstart Audio Dedup job
GET/api/audio-dedup/jobs/latestlatest Audio Dedup job
GET/api/audio-dedup/jobs/{job_id}job status
POST/api/audio-dedup/jobs/{job_id}/cancelcancel job
GET/api/audio-dedup/jobs/{job_id}/report/xlsxdownload XLSX

Audio Doctor apply requires exact APPLY REPAIR. Audio Dedup apply requires exact APPLY DELETE.

Rhythm Lab and server

MethodPathPurpose
GET/api/rhythm-lab/statusstatus
POST/api/rhythm-lab/launchlaunch or reuse Rhythm Lab
POST/api/rhythm-lab/stopstop managed Rhythm Lab
POST/api/rhythm-lab/collectionssave main UI set as collection
POST/api/server/shutdownrequest server shutdown

Server shutdown requires the X-DJ-Track-Similarity-Action: shutdown-server header.

Local-first DJ library analysis documentation.