# Mastering references

Reference tracks that guide a master.

Paths start at `$ACTIVQC_BASE_URL`, and every call sends `Authorization: Bearer $ACTIVQC_KEY`. Errors use the [error envelope](https://activqc.wavbee.com/docs/errors.md). [All endpoints](https://activqc.wavbee.com/docs/api-reference.md).

## GET /v1/mastering/references

List the reference library.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `genre` | query | string |  |
| `origin` | query | string | upload or url |
| `limit` | query | integer | 1..500, default 100 |
| `offset` | query | integer |  |

#### Example request

```bash
curl -s "$ACTIVQC_BASE_URL/v1/mastering/references" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | The tenant's references, by genre. |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `object` | string | **Required.** Always `list`. |
| `data` | array of object | **Required.** Summaries: no assessment, visual or audio_url (fetch one reference for those). |
| `data[].id` | integer | **Required.** |
| `data[].object` | string | **Required.** Always `mastering.reference`. |
| `data[].status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `data[].title` | string | **Required.** |
| `data[].artist` | string or null |  |
| `data[].genre` | string | **Required.** Example `Malayalam film`. |
| `data[].origin` | string | **Required.** Uploads keep their audio; URL references keep only their measurements. One of `upload`, `url`. |
| `data[].contributor` | string or null | The name of the API key that added it. |
| `data[].eligible` | boolean | **Required.** |
| `data[].excluded` | boolean | **Required.** |
| `data[].training` | boolean | **Required.** |
| `data[].note` | string or null |  |
| `data[].quality` | object or null | eligible, version, reasons[{code, message}]. |
| `data[].metrics` | object or null |  |
| `data[].error` | string or null |  |
| `data[].created_at` | string (date-time) | **Required.** |
| `data[].assessment` | object or null | Detail responses only. |
| `data[].assessment.verdict` | string | Example `pass_with_warnings`. |
| `data[].assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `data[].assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `data[].assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `data[].assessment.findings` | array of object |  |
| `data[].assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `data[].assessment.beats` | object or null | Experiment beat_tracking (Beat This!): bpm, tempo_spread, beats_per_bar, bars, beats and downbeats in seconds; {error} when it could not be read. Absent when the experiment was off at upload. |
| `data[].assessment.quality` | object or null | Experiment quality_score (Audiobox Aesthetics, 1-10): production_quality, production_complexity, content_enjoyment, content_usefulness; {error} when it could not be scored. A render's own score is in its result.quality. |
| `data[].assessment.stream_check` | object or null | Experiment stream_check: formats[{format aac_256\|opus_160\|mp3_320, label, true_peak_dbtp, over_full_scale} or {format, label, error}] — the true peak after encoding and decoding — and mono {stereo_lufs, mono_lufs, drop_lu, cancels} (dual-mono fold-down; {skipped} for a mono master). A render's own check is in its result.stream_check. |
| `data[].visual` | object or null | Detail responses only. |
| `data[].visual.object` | string | Always `mastering.visual`. |
| `data[].visual.analysis_version` | integer | Example `2`. |
| `data[].visual.integrated_lufs` | number or null |  |
| `data[].visual.waveform` | object | points (v2: ≤4000), seconds_per_point, peak[] and rms[] (0..1, all channels); v2 adds true_peak[] (4× oversampled, may exceed 1.0). |
| `data[].visual.spectrum` | object | 1/6-octave bands_hz[]; mid_db[], side_db[] and both relative to integrated loudness (relative_mid_db[], relative_side_db[]). side is null for mono. |
| `data[].visual.spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `data[].visual.stereo` | object | correlation and side_to_mid_db; null for mono. |
| `data[].visual.clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |
| `data[].audio_url` | string or null | Detail only; uploads only. Signed, 15 minutes. |
| `total` | integer | **Required.** References matching the filters. |
| `has_more` | boolean | **Required.** |

```json
{
  "object": "list",
  "data": [
    {
      "id": 1,
      "object": "mastering.reference",
      "status": "analyzing",
      "title": "string",
      "artist": "string",
      "genre": "Malayalam film",
      "origin": "upload",
      "contributor": "string",
      "eligible": false,
      "excluded": false,
      "training": false,
      "note": "string",
      "quality": {},
      "metrics": {},
      "error": "string",
      "created_at": "2026-11-24T10:00:00Z",
      "assessment": {
        "verdict": "pass_with_warnings",
        "metrics": {},
        "platforms": [],
        "trim": {},
        "findings": [],
        "intelligence": {},
        "beats": {},
        "quality": {},
        "stream_check": {}
      },
      "visual": {
        "object": "mastering.visual",
        "analysis_version": 2,
        "integrated_lufs": 1.0,
        "waveform": {},
        "spectrum": {},
        "spectrogram": {},
        "stereo": {},
        "clipping": {}
      },
      "audio_url": "string"
    }
  ],
  "total": 1,
  "has_more": false
}
```

## POST /v1/mastering/references

Add a reference track (multipart `file`, or `audio_url`)

A well-mastered track for genre profiles. Multipart uploads keep their audio and are not idempotent; the JSON `audio_url` form keeps only measurements and requires Idempotency-Key. `external_ref` de-duplicates imports (409 on a repeat).

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

Send an `Idempotency-Key` header (a new UUID per operation; a retry reuses it).

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `Idempotency-Key` | header | string | **Required.** A unique string per operation, for example a UUID. A retry with the same key returns the first answer. Missing: 422. |

#### Request body

`application/json` (or `multipart/form-data`).

genre is required (422 validation_error otherwise); title is required for audio_url.

| Field | Type | Description |
|---|---|---|
| `audio_url` | string (uri) |  |
| `upload_id` | string | A finished audio upload of yours (POST /v1/builder/uploads/direct); its audio is kept. |
| `title` | string |  |
| `artist` | string |  |
| `genre` | string |  |
| `external_ref` | string |  |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/mastering/references" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

#### Responses

| Status | Meaning |
|---|---|
| `202` | Reference added; measurement queued. |
| `409` | External_ref already in the library. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `422` | No genre. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `202`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.reference`. |
| `status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `title` | string | **Required.** |
| `artist` | string or null |  |
| `genre` | string | **Required.** Example `Malayalam film`. |
| `origin` | string | **Required.** Uploads keep their audio; URL references keep only their measurements. One of `upload`, `url`. |
| `contributor` | string or null | The name of the API key that added it. |
| `eligible` | boolean | **Required.** |
| `excluded` | boolean | **Required.** |
| `training` | boolean | **Required.** |
| `note` | string or null |  |
| `quality` | object or null | eligible, version, reasons[{code, message}]. |
| `metrics` | object or null |  |
| `error` | string or null |  |
| `created_at` | string (date-time) | **Required.** |
| `assessment` | object or null | Detail responses only. |
| `assessment.verdict` | string | Example `pass_with_warnings`. |
| `assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `assessment.findings` | array of object |  |
| `assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `assessment.beats` | object or null | Experiment beat_tracking (Beat This!): bpm, tempo_spread, beats_per_bar, bars, beats and downbeats in seconds; {error} when it could not be read. Absent when the experiment was off at upload. |
| `assessment.quality` | object or null | Experiment quality_score (Audiobox Aesthetics, 1-10): production_quality, production_complexity, content_enjoyment, content_usefulness; {error} when it could not be scored. A render's own score is in its result.quality. |
| `assessment.stream_check` | object or null | Experiment stream_check: formats[{format aac_256\|opus_160\|mp3_320, label, true_peak_dbtp, over_full_scale} or {format, label, error}] — the true peak after encoding and decoding — and mono {stereo_lufs, mono_lufs, drop_lu, cancels} (dual-mono fold-down; {skipped} for a mono master). A render's own check is in its result.stream_check. |
| `visual` | object or null | Detail responses only. |
| `visual.object` | string | Always `mastering.visual`. |
| `visual.analysis_version` | integer | Example `2`. |
| `visual.integrated_lufs` | number or null |  |
| `visual.waveform` | object | points (v2: ≤4000), seconds_per_point, peak[] and rms[] (0..1, all channels); v2 adds true_peak[] (4× oversampled, may exceed 1.0). |
| `visual.spectrum` | object | 1/6-octave bands_hz[]; mid_db[], side_db[] and both relative to integrated loudness (relative_mid_db[], relative_side_db[]). side is null for mono. |
| `visual.spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `visual.stereo` | object | correlation and side_to_mid_db; null for mono. |
| `visual.clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |
| `audio_url` | string or null | Detail only; uploads only. Signed, 15 minutes. |

```json
{
  "id": 1,
  "object": "mastering.reference",
  "status": "analyzing",
  "title": "string",
  "artist": "string",
  "genre": "Malayalam film",
  "origin": "upload",
  "contributor": "string",
  "eligible": false,
  "excluded": false,
  "training": false,
  "note": "string",
  "quality": {},
  "metrics": {},
  "error": "string",
  "created_at": "2026-11-24T10:00:00Z",
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual": {
    "object": "mastering.visual",
    "analysis_version": 2,
    "integrated_lufs": 1.0,
    "waveform": {},
    "spectrum": {},
    "spectrogram": {},
    "stereo": {},
    "clipping": {}
  },
  "audio_url": "string"
}
```

## GET /v1/mastering/references/{id}

Fetch a reference with its measurements.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s "$ACTIVQC_BASE_URL/v1/mastering/references/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Found. |
| `404` | Another tenant's reference. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.reference`. |
| `status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `title` | string | **Required.** |
| `artist` | string or null |  |
| `genre` | string | **Required.** Example `Malayalam film`. |
| `origin` | string | **Required.** Uploads keep their audio; URL references keep only their measurements. One of `upload`, `url`. |
| `contributor` | string or null | The name of the API key that added it. |
| `eligible` | boolean | **Required.** |
| `excluded` | boolean | **Required.** |
| `training` | boolean | **Required.** |
| `note` | string or null |  |
| `quality` | object or null | eligible, version, reasons[{code, message}]. |
| `metrics` | object or null |  |
| `error` | string or null |  |
| `created_at` | string (date-time) | **Required.** |
| `assessment` | object or null | Detail responses only. |
| `assessment.verdict` | string | Example `pass_with_warnings`. |
| `assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `assessment.findings` | array of object |  |
| `assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `assessment.beats` | object or null | Experiment beat_tracking (Beat This!): bpm, tempo_spread, beats_per_bar, bars, beats and downbeats in seconds; {error} when it could not be read. Absent when the experiment was off at upload. |
| `assessment.quality` | object or null | Experiment quality_score (Audiobox Aesthetics, 1-10): production_quality, production_complexity, content_enjoyment, content_usefulness; {error} when it could not be scored. A render's own score is in its result.quality. |
| `assessment.stream_check` | object or null | Experiment stream_check: formats[{format aac_256\|opus_160\|mp3_320, label, true_peak_dbtp, over_full_scale} or {format, label, error}] — the true peak after encoding and decoding — and mono {stereo_lufs, mono_lufs, drop_lu, cancels} (dual-mono fold-down; {skipped} for a mono master). A render's own check is in its result.stream_check. |
| `visual` | object or null | Detail responses only. |
| `visual.object` | string | Always `mastering.visual`. |
| `visual.analysis_version` | integer | Example `2`. |
| `visual.integrated_lufs` | number or null |  |
| `visual.waveform` | object | points (v2: ≤4000), seconds_per_point, peak[] and rms[] (0..1, all channels); v2 adds true_peak[] (4× oversampled, may exceed 1.0). |
| `visual.spectrum` | object | 1/6-octave bands_hz[]; mid_db[], side_db[] and both relative to integrated loudness (relative_mid_db[], relative_side_db[]). side is null for mono. |
| `visual.spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `visual.stereo` | object | correlation and side_to_mid_db; null for mono. |
| `visual.clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |
| `audio_url` | string or null | Detail only; uploads only. Signed, 15 minutes. |

```json
{
  "id": 1,
  "object": "mastering.reference",
  "status": "analyzing",
  "title": "string",
  "artist": "string",
  "genre": "Malayalam film",
  "origin": "upload",
  "contributor": "string",
  "eligible": false,
  "excluded": false,
  "training": false,
  "note": "string",
  "quality": {},
  "metrics": {},
  "error": "string",
  "created_at": "2026-11-24T10:00:00Z",
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual": {
    "object": "mastering.visual",
    "analysis_version": 2,
    "integrated_lufs": 1.0,
    "waveform": {},
    "spectrum": {},
    "spectrogram": {},
    "stereo": {},
    "clipping": {}
  },
  "audio_url": "string"
}
```

## PATCH /v1/mastering/references/{id}

Correct a reference, or take it out of (or back into) training.

Editable: title, artist, genre, excluded, note. An ineligible reference cannot be re-included.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Request body

`application/json`.

| Field | Type | Description |
|---|---|---|
| `title` | string |  |
| `artist` | string |  |
| `genre` | string |  |
| `excluded` | boolean |  |
| `note` | string |  |

#### Example request

```bash
curl -s -X PATCH "$ACTIVQC_BASE_URL/v1/mastering/references/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Updated. |
| `422` | An ineligible reference cannot train. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.reference`. |
| `status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `title` | string | **Required.** |
| `artist` | string or null |  |
| `genre` | string | **Required.** Example `Malayalam film`. |
| `origin` | string | **Required.** Uploads keep their audio; URL references keep only their measurements. One of `upload`, `url`. |
| `contributor` | string or null | The name of the API key that added it. |
| `eligible` | boolean | **Required.** |
| `excluded` | boolean | **Required.** |
| `training` | boolean | **Required.** |
| `note` | string or null |  |
| `quality` | object or null | eligible, version, reasons[{code, message}]. |
| `metrics` | object or null |  |
| `error` | string or null |  |
| `created_at` | string (date-time) | **Required.** |
| `assessment` | object or null | Detail responses only. |
| `assessment.verdict` | string | Example `pass_with_warnings`. |
| `assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `assessment.findings` | array of object |  |
| `assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `assessment.beats` | object or null | Experiment beat_tracking (Beat This!): bpm, tempo_spread, beats_per_bar, bars, beats and downbeats in seconds; {error} when it could not be read. Absent when the experiment was off at upload. |
| `assessment.quality` | object or null | Experiment quality_score (Audiobox Aesthetics, 1-10): production_quality, production_complexity, content_enjoyment, content_usefulness; {error} when it could not be scored. A render's own score is in its result.quality. |
| `assessment.stream_check` | object or null | Experiment stream_check: formats[{format aac_256\|opus_160\|mp3_320, label, true_peak_dbtp, over_full_scale} or {format, label, error}] — the true peak after encoding and decoding — and mono {stereo_lufs, mono_lufs, drop_lu, cancels} (dual-mono fold-down; {skipped} for a mono master). A render's own check is in its result.stream_check. |
| `visual` | object or null | Detail responses only. |
| `visual.object` | string | Always `mastering.visual`. |
| `visual.analysis_version` | integer | Example `2`. |
| `visual.integrated_lufs` | number or null |  |
| `visual.waveform` | object | points (v2: ≤4000), seconds_per_point, peak[] and rms[] (0..1, all channels); v2 adds true_peak[] (4× oversampled, may exceed 1.0). |
| `visual.spectrum` | object | 1/6-octave bands_hz[]; mid_db[], side_db[] and both relative to integrated loudness (relative_mid_db[], relative_side_db[]). side is null for mono. |
| `visual.spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `visual.stereo` | object | correlation and side_to_mid_db; null for mono. |
| `visual.clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |
| `audio_url` | string or null | Detail only; uploads only. Signed, 15 minutes. |

```json
{
  "id": 1,
  "object": "mastering.reference",
  "status": "analyzing",
  "title": "string",
  "artist": "string",
  "genre": "Malayalam film",
  "origin": "upload",
  "contributor": "string",
  "eligible": false,
  "excluded": false,
  "training": false,
  "note": "string",
  "quality": {},
  "metrics": {},
  "error": "string",
  "created_at": "2026-11-24T10:00:00Z",
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual": {
    "object": "mastering.visual",
    "analysis_version": 2,
    "integrated_lufs": 1.0,
    "waveform": {},
    "spectrum": {},
    "spectrogram": {},
    "stereo": {},
    "clipping": {}
  },
  "audio_url": "string"
}
```

## DELETE /v1/mastering/references/{id}

Remove a reference.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | integer | **Required.** |

#### Example request

```bash
curl -s -X DELETE "$ACTIVQC_BASE_URL/v1/mastering/references/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `204` | Removed. |

