# Mastering

Master a track, render versions, split stems and release the files.

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/sessions

List the tenant's sessions, newest first.

Live sessions only (an expired one is gone with its files). A summary per session; fetch one for its URLs and assessment. `stems=true` keeps sessions that have been split.

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

#### Parameters

| Name | In | Type | Description |
|---|---|---|---|
| `stems` | query | string | Always `true`. |
| `limit` | query | integer |  |
| `offset` | query | integer |  |

#### Example request

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

#### Responses

| Status | Meaning |
|---|---|
| `200` | The tenant's live sessions. |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `object` | string | **Required.** Always `list`. |
| `data` | array of object | **Required.** |
| `data[].id` | integer | **Required.** |
| `data[].object` | string | **Required.** Always `mastering.session_summary`. |
| `data[].status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `data[].filename` | string | **Required.** Example `song.wav`. |
| `data[].created_at` | string (date-time) | **Required.** |
| `data[].expires_at` | string (date-time) | **Required.** |
| `data[].renders` | integer | **Required.** How many renders the session has. |
| `data[].stems_status` | string or null | The latest split's status; null when it was never split. One of `queued`, `separating`, `succeeded`, `failed`. |
| `total` | integer | **Required.** |
| `has_more` | boolean | **Required.** |

```json
{
  "object": "list",
  "data": [
    {
      "id": 1,
      "object": "mastering.session_summary",
      "status": "analyzing",
      "filename": "song.wav",
      "created_at": "2026-11-24T10:00:00Z",
      "expires_at": "2026-11-24T10:00:00Z",
      "renders": 1,
      "stems_status": "queued"
    }
  ],
  "total": 1,
  "has_more": false
}
```

## POST /v1/mastering/sessions

Upload a master (multipart `file`) or name one by `audio_url`.

Multipart uploads are not idempotent (the body is the master itself); a replay creates a second session that expires on its own. The JSON `audio_url` form requires Idempotency-Key like every other create.

**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`).

| Field | Type | Description |
|---|---|---|
| `audio_url` | string (uri) |  |
| `upload_id` | string | A finished audio upload of yours (POST /v1/builder/uploads/direct): the way to send a master over 32 MiB. |

#### Example request

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

#### Responses

| Status | Meaning |
|---|---|
| `202` | Session created; analysis queued. |
| `401` | No key. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `422` | Neither a file nor a URL. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `202`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.session`. |
| `status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `filename` | string | **Required.** Example `song.wav`. |
| `error` | string or null |  |
| `expires_at` | string (date-time) | **Required.** The source and every render are deleted at this time (7 days). |
| `source_url` | string or null | Signed, expires in 15 minutes. |
| `assessment` | object or null |  |
| `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_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `renders` | array of object | **Required.** |
| `renders[].id` | integer | **Required.** |
| `renders[].object` | string | **Required.** Always `mastering.render`. |
| `renders[].session_id` | integer | **Required.** |
| `renders[].status` | string | **Required.** One of `queued`, `rendering`, `succeeded`, `failed`. |
| `renders[].settings` | object | **Required.** |
| `renders[].result` | object or null | Render passes, trim applied, output format. |
| `renders[].assessment` | object or null | Measured on the rendered OUTPUT, not predicted. |
| `renders[].assessment.verdict` | string | Example `pass_with_warnings`. |
| `renders[].assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `renders[].assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `renders[].assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `renders[].assessment.findings` | array of object |  |
| `renders[].assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `renders[].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. |
| `renders[].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. |
| `renders[].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. |
| `renders[].visual_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `renders[].error` | string or null |  |
| `renders[].output_url` | string or null | Signed, expires in 15 minutes. |
| `renders[].released_at` | string (date-time) or null | Set when the partner releases a payment-held embed download. |
| `renders[].created_at` | string (date-time) | **Required.** |
| `stem_separations` | array of object |  |
| `stem_separations[].id` | integer | **Required.** |
| `stem_separations[].object` | string | **Required.** Example `mastering.stems`. |
| `stem_separations[].session_id` | integer | **Required.** |
| `stem_separations[].status` | string | **Required.** One of `queued`, `separating`, `succeeded`, `failed`. |
| `stem_separations[].model` | string or null | The model that made the split |
| `stem_separations[].sample_rate` | integer or null | The master's own rate; stems line up with it. |
| `stem_separations[].duration_s` | number or null |  |
| `stem_separations[].elapsed_ms` | integer or null |  |
| `stem_separations[].error` | string or null |  |
| `stem_separations[].stems` | object or null | Short-lived signed URLs (24-bit WAV) once separation has succeeded. |
| `stem_separations[].stems.vocals` | string or null |  |
| `stem_separations[].stems.drums` | string or null |  |
| `stem_separations[].stems.bass` | string or null |  |
| `stem_separations[].stems.other` | string or null |  |
| `stem_separations[].released_at` | string (date-time) or null | Set when the partner releases a payment-held embed stem download. |
| `stem_separations[].created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.session",
  "status": "analyzing",
  "filename": "song.wav",
  "error": "string",
  "expires_at": "2026-11-24T10:00:00Z",
  "source_url": "string",
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual_version": 1,
  "renders": [
    {
      "id": 1,
      "object": "mastering.render",
      "session_id": 1,
      "status": "queued",
      "settings": {},
      "result": {},
      "assessment": {
        "verdict": "pass_with_warnings",
        "metrics": {},
        "platforms": [],
        "trim": {},
        "findings": [],
        "intelligence": {},
        "beats": {},
        "quality": {},
        "stream_check": {}
      },
      "visual_version": 1,
      "error": "string",
      "output_url": "string",
      "released_at": "2026-11-24T10:00:00Z",
      "created_at": "2026-11-24T10:00:00Z"
    }
  ],
  "stem_separations": [
    {
      "id": 1,
      "object": "mastering.stems",
      "session_id": 1,
      "status": "queued",
      "model": "string",
      "sample_rate": 1,
      "duration_s": 1.0,
      "elapsed_ms": 1,
      "error": "string",
      "stems": {
        "vocals": "string",
        "drums": "string",
        "bass": "string",
        "other": "string"
      },
      "released_at": "2026-11-24T10:00:00Z",
      "created_at": "2026-11-24T10:00:00Z"
    }
  ]
}
```

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

Fetch a session, its assessment and its renders.

**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/sessions/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

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

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.session`. |
| `status` | string | **Required.** One of `analyzing`, `ready`, `failed`. |
| `filename` | string | **Required.** Example `song.wav`. |
| `error` | string or null |  |
| `expires_at` | string (date-time) | **Required.** The source and every render are deleted at this time (7 days). |
| `source_url` | string or null | Signed, expires in 15 minutes. |
| `assessment` | object or null |  |
| `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_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `renders` | array of object | **Required.** |
| `renders[].id` | integer | **Required.** |
| `renders[].object` | string | **Required.** Always `mastering.render`. |
| `renders[].session_id` | integer | **Required.** |
| `renders[].status` | string | **Required.** One of `queued`, `rendering`, `succeeded`, `failed`. |
| `renders[].settings` | object | **Required.** |
| `renders[].result` | object or null | Render passes, trim applied, output format. |
| `renders[].assessment` | object or null | Measured on the rendered OUTPUT, not predicted. |
| `renders[].assessment.verdict` | string | Example `pass_with_warnings`. |
| `renders[].assessment.metrics` | object | integrated_lufs, true_peak_dbtp, lra, plr_db, edges, format. |
| `renders[].assessment.platforms` | array of object | Per-store playback gain. Only Spotify's reference is published (verified). |
| `renders[].assessment.trim` | object or null | Where a trim would cut; absent when none is needed. |
| `renders[].assessment.findings` | array of object |  |
| `renders[].assessment.intelligence` | object or null | Tempo/key, descriptive only. |
| `renders[].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. |
| `renders[].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. |
| `renders[].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. |
| `renders[].visual_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `renders[].error` | string or null |  |
| `renders[].output_url` | string or null | Signed, expires in 15 minutes. |
| `renders[].released_at` | string (date-time) or null | Set when the partner releases a payment-held embed download. |
| `renders[].created_at` | string (date-time) | **Required.** |
| `stem_separations` | array of object |  |
| `stem_separations[].id` | integer | **Required.** |
| `stem_separations[].object` | string | **Required.** Example `mastering.stems`. |
| `stem_separations[].session_id` | integer | **Required.** |
| `stem_separations[].status` | string | **Required.** One of `queued`, `separating`, `succeeded`, `failed`. |
| `stem_separations[].model` | string or null | The model that made the split |
| `stem_separations[].sample_rate` | integer or null | The master's own rate; stems line up with it. |
| `stem_separations[].duration_s` | number or null |  |
| `stem_separations[].elapsed_ms` | integer or null |  |
| `stem_separations[].error` | string or null |  |
| `stem_separations[].stems` | object or null | Short-lived signed URLs (24-bit WAV) once separation has succeeded. |
| `stem_separations[].stems.vocals` | string or null |  |
| `stem_separations[].stems.drums` | string or null |  |
| `stem_separations[].stems.bass` | string or null |  |
| `stem_separations[].stems.other` | string or null |  |
| `stem_separations[].released_at` | string (date-time) or null | Set when the partner releases a payment-held embed stem download. |
| `stem_separations[].created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.session",
  "status": "analyzing",
  "filename": "song.wav",
  "error": "string",
  "expires_at": "2026-11-24T10:00:00Z",
  "source_url": "string",
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual_version": 1,
  "renders": [
    {
      "id": 1,
      "object": "mastering.render",
      "session_id": 1,
      "status": "queued",
      "settings": {},
      "result": {},
      "assessment": {
        "verdict": "pass_with_warnings",
        "metrics": {},
        "platforms": [],
        "trim": {},
        "findings": [],
        "intelligence": {},
        "beats": {},
        "quality": {},
        "stream_check": {}
      },
      "visual_version": 1,
      "error": "string",
      "output_url": "string",
      "released_at": "2026-11-24T10:00:00Z",
      "created_at": "2026-11-24T10:00:00Z"
    }
  ],
  "stem_separations": [
    {
      "id": 1,
      "object": "mastering.stems",
      "session_id": 1,
      "status": "queued",
      "model": "string",
      "sample_rate": 1,
      "duration_s": 1.0,
      "elapsed_ms": 1,
      "error": "string",
      "stems": {
        "vocals": "string",
        "drums": "string",
        "bass": "string",
        "other": "string"
      },
      "released_at": "2026-11-24T10:00:00Z",
      "created_at": "2026-11-24T10:00:00Z"
    }
  ]
}
```

## POST /v1/mastering/sessions/{id}/renders

Render the master with chosen settings.

**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 |
|---|---|---|---|
| `id` | path | integer | **Required.** |
| `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`.

Ranges are enforced by the app (422 validation_error naming settings.\<field>), not by the schema, so a client sees the error envelope rather than a contract fault.

| Field | Type | Description |
|---|---|---|
| `settings` | object | loudness_mode preserve (default: keep a loud master's loudness, hold true peak under the ceiling, raise a quieter one to target_lufs) or match (exactly target_lufs); target_lufs -24..-6 (default -14); ceiling_dbtp -6..-0.1 (default -1); trim_silence (default true: trim an edge over 4 s to keep_silence_s, pad one under 0.6 s to 0.6 s); keep_silence_s 0.6..4 (default 3); tighten_edges (default false: also trim edges between keep_silence_s and 4 s); declip (default false); bit_depth 16 or 24 (omit to follow the source; a 32-bit source renders at 24); reference_session_id: another of your measured sessions to sound like, after which target and ceiling still apply; tone: {mode: genre\|closest, genre, strength 0..1 (default 0.7)} EQs toward a profile first (not with reference_session_id). stems (experiment stem_balance; 422 experiment_off when it is off): {separation_id, vocals\|drums\|bass\|other: {gain_db, low_db, high_db}} moves each stem of a finished split of this master by -6..6 dB (shelves at 200 Hz and 5 kHz) before anything else; only the change is added back to the master. compression (experiment compression; 422 experiment_off when it is off): {preset: gentle\|glue\|punchy, threshold_db -40..0, ratio 1..10, attack_ms 0.1..100, release_ms 10..1000, mix 0..1} — a stereo-linked bus compressor after the tone and before the level; knobs override the preset's. stereo_width (experiment stereo_width; 422 experiment_off when it is off): 0..1.5, the side signal scaled against the middle (0 mono, 1 unchanged); a mono master is left as it is. |
| `settings.target_lufs` | number |  |
| `settings.ceiling_dbtp` | number |  |
| `settings.trim_silence` | boolean |  |
| `settings.keep_silence_s` | number |  |
| `settings.declip` | boolean |  |
| `settings.bit_depth` | any |  |
| `settings.reference_session_id` | any |  |
| `settings.tone` | any |  |
| `settings.loudness_mode` | string |  |
| `settings.tighten_edges` | boolean |  |
| `settings.stems` | any |  |
| `settings.compression` | any |  |
| `settings.stereo_width` | number |  |

#### Example request

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

#### Responses

| Status | Meaning |
|---|---|
| `202` | Render queued. |
| `409` | The master has not been measured yet. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `422` | Settings out of range. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `202`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.render`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `rendering`, `succeeded`, `failed`. |
| `settings` | object | **Required.** |
| `result` | object or null | Render passes, trim applied, output format. |
| `assessment` | object or null | Measured on the rendered OUTPUT, not predicted. |
| `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_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `error` | string or null |  |
| `output_url` | string or null | Signed, expires in 15 minutes. |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.render",
  "session_id": 1,
  "status": "queued",
  "settings": {},
  "result": {},
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual_version": 1,
  "error": "string",
  "output_url": "string",
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

## GET /v1/mastering/sessions/{id}/visual

The source's waveform, spectrum, spectrogram and clipping map.

Fetched once per file; the session itself only says `visual_version` when it is ready.

**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/sessions/{id}/visual" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

| Status | Meaning |
|---|---|
| `200` | Analysed. |
| `404` | Not analysed yet, or another tenant's. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `object` | string | Always `mastering.visual`. |
| `analysis_version` | integer | Example `2`. |
| `integrated_lufs` | number or null |  |
| `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). |
| `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. |
| `spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `stereo` | object | correlation and side_to_mid_db; null for mono. |
| `clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |

```json
{
  "object": "mastering.visual",
  "analysis_version": 2,
  "integrated_lufs": 1.0,
  "waveform": {},
  "spectrum": {},
  "spectrogram": {},
  "stereo": {},
  "clipping": {}
}
```

## GET /v1/mastering/renders/{id}/visual

A render's waveform, spectrum, spectrogram and clipping map.

**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/renders/{id}/visual" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

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

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `object` | string | Always `mastering.visual`. |
| `analysis_version` | integer | Example `2`. |
| `integrated_lufs` | number or null |  |
| `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). |
| `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. |
| `spectrogram` | object | frames, seconds_per_frame, bands_hz[], db[frame][band] (v1: ≤300 × 1/3-octave; v2: ≤1200 × the spectrum grid). |
| `stereo` | object | correlation and side_to_mid_db; null for mono. |
| `clipping` | object or null | v2: full_scale, min_run, events[{start_s, end_s, channels[], samples, peak_dbfs}] (≤500 largest), events_total, clipped_samples. |

```json
{
  "object": "mastering.visual",
  "analysis_version": 2,
  "integrated_lufs": 1.0,
  "waveform": {},
  "spectrum": {},
  "spectrogram": {},
  "stereo": {},
  "clipping": {}
}
```

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

Fetch a render.

**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/renders/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

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

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.render`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `rendering`, `succeeded`, `failed`. |
| `settings` | object | **Required.** |
| `result` | object or null | Render passes, trim applied, output format. |
| `assessment` | object or null | Measured on the rendered OUTPUT, not predicted. |
| `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_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `error` | string or null |  |
| `output_url` | string or null | Signed, expires in 15 minutes. |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.render",
  "session_id": 1,
  "status": "queued",
  "settings": {},
  "result": {},
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual_version": 1,
  "error": "string",
  "output_url": "string",
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

## POST /v1/mastering/renders/{id}/release

Release a finished render for full-quality download in a payment-held embed session.

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

#### Parameters

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

#### Example request

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

#### Responses

| Status | Meaning |
|---|---|
| `200` | Released. |
| `403` | Console session key. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `404` | Another tenant's render. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `409` | Render not finished yet. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Always `mastering.render`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `rendering`, `succeeded`, `failed`. |
| `settings` | object | **Required.** |
| `result` | object or null | Render passes, trim applied, output format. |
| `assessment` | object or null | Measured on the rendered OUTPUT, not predicted. |
| `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_version` | integer or null | Set once analysed; the data itself is at …/visual. |
| `error` | string or null |  |
| `output_url` | string or null | Signed, expires in 15 minutes. |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.render",
  "session_id": 1,
  "status": "queued",
  "settings": {},
  "result": {},
  "assessment": {
    "verdict": "pass_with_warnings",
    "metrics": {},
    "platforms": [
      {}
    ],
    "trim": {},
    "findings": [
      {}
    ],
    "intelligence": {},
    "beats": {},
    "quality": {},
    "stream_check": {}
  },
  "visual_version": 1,
  "error": "string",
  "output_url": "string",
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

## POST /v1/mastering/sessions/{id}/stems

Split the master into vocals, drums, bass and other.

**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 |
|---|---|---|---|
| `id` | path | integer | **Required.** |
| `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. |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/mastering/sessions/{id}/stems" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

#### Responses

| Status | Meaning |
|---|---|
| `202` | Separation queued. |
| `409` | The master has not been measured yet. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `503` | Stem separation is not set up on this server. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `202`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Example `mastering.stems`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `separating`, `succeeded`, `failed`. |
| `model` | string or null | The model that made the split |
| `sample_rate` | integer or null | The master's own rate; stems line up with it. |
| `duration_s` | number or null |  |
| `elapsed_ms` | integer or null |  |
| `error` | string or null |  |
| `stems` | object or null | Short-lived signed URLs (24-bit WAV) once separation has succeeded. |
| `stems.vocals` | string or null |  |
| `stems.drums` | string or null |  |
| `stems.bass` | string or null |  |
| `stems.other` | string or null |  |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed stem download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.stems",
  "session_id": 1,
  "status": "queued",
  "model": "string",
  "sample_rate": 1,
  "duration_s": 1.0,
  "elapsed_ms": 1,
  "error": "string",
  "stems": {
    "vocals": "string",
    "drums": "string",
    "bass": "string",
    "other": "string"
  },
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

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

Fetch a stem separation.

**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/stems/{id}" \
  -H "Authorization: Bearer $ACTIVQC_KEY"
```

#### Responses

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

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Example `mastering.stems`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `separating`, `succeeded`, `failed`. |
| `model` | string or null | The model that made the split |
| `sample_rate` | integer or null | The master's own rate; stems line up with it. |
| `duration_s` | number or null |  |
| `elapsed_ms` | integer or null |  |
| `error` | string or null |  |
| `stems` | object or null | Short-lived signed URLs (24-bit WAV) once separation has succeeded. |
| `stems.vocals` | string or null |  |
| `stems.drums` | string or null |  |
| `stems.bass` | string or null |  |
| `stems.other` | string or null |  |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed stem download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.stems",
  "session_id": 1,
  "status": "queued",
  "model": "string",
  "sample_rate": 1,
  "duration_s": 1.0,
  "elapsed_ms": 1,
  "error": "string",
  "stems": {
    "vocals": "string",
    "drums": "string",
    "bass": "string",
    "other": "string"
  },
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

## POST /v1/mastering/stems/{id}/release

Release a finished stem split for full-quality download in a payment-held embed session.

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

#### Parameters

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

#### Example request

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

#### Responses

| Status | Meaning |
|---|---|
| `200` | Released. |
| `403` | Console session key. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `404` | Another tenant's separation. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `409` | Split not finished yet. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `200`

| Field | Type | Description |
|---|---|---|
| `id` | integer | **Required.** |
| `object` | string | **Required.** Example `mastering.stems`. |
| `session_id` | integer | **Required.** |
| `status` | string | **Required.** One of `queued`, `separating`, `succeeded`, `failed`. |
| `model` | string or null | The model that made the split |
| `sample_rate` | integer or null | The master's own rate; stems line up with it. |
| `duration_s` | number or null |  |
| `elapsed_ms` | integer or null |  |
| `error` | string or null |  |
| `stems` | object or null | Short-lived signed URLs (24-bit WAV) once separation has succeeded. |
| `stems.vocals` | string or null |  |
| `stems.drums` | string or null |  |
| `stems.bass` | string or null |  |
| `stems.other` | string or null |  |
| `released_at` | string (date-time) or null | Set when the partner releases a payment-held embed stem download. |
| `created_at` | string (date-time) | **Required.** |

```json
{
  "id": 1,
  "object": "mastering.stems",
  "session_id": 1,
  "status": "queued",
  "model": "string",
  "sample_rate": 1,
  "duration_s": 1.0,
  "elapsed_ms": 1,
  "error": "string",
  "stems": {
    "vocals": "string",
    "drums": "string",
    "bass": "string",
    "other": "string"
  },
  "released_at": "2026-11-24T10:00:00Z",
  "created_at": "2026-11-24T10:00:00Z"
}
```

