> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Suno Vocal and instrument stem separation

> Separate a song into vocals and accompaniment, split it into up to 12 instrument stems, or extract one chosen instrument.

`ai-music-api/separate-vocals` uses Suno's audio separation to break a mixed song into individual tracks, for karaoke backing tracks, remixing, sample extraction and detailed post-production.

Three separation modes (`type`):

* **`separate_vocal`** (default): 2 stems, vocals + accompaniment.
* **`split_stem`**: up to 12 stems: vocals, backing vocals, drums, bass, guitar, keyboard, strings, brass, woodwinds, percussion, synth and FX / other.
* **`split_stem_advanced`**: name one instrument with `stem_name` and get an "extract" track with only that instrument and a "remove" track with everything else.

Pick one source: name one of this account's earlier songs with `task_id` + `audio_id`, or pass your own audio with `audio_url`. Mixes generated on the platform, with clearly separated vocals and instruments, separate best.

## Setup

The Suno endpoints use an asynchronous task protocol: every endpoint creates its task with `POST /api/v1/jobs/createTask` (`model` selects the endpoint and the parameters go in `input`) and is queried with `GET /api/v1/jobs/recordInfo?taskId=`; with `callBackUrl` the result is pushed to that URL when the task finishes. See the [Suno introduction](https://docs.dreamto.ai/en/music/suno.md) for the flow, chaining tasks and how long files are kept. The base URL is `https://api.dreamto.ai`; send the API Key in the `Authorization: Bearer` header.

Every response has HTTP status 200; the `code` in the body tells the outcome: `200` is success, anything else an error (see the response examples of each endpoint).

| Endpoint | Purpose |
| - | - |
| [`POST /api/v1/jobs/createTask`](https://docs.dreamto.ai/en/api-reference/suno-separate-vocals/create-task) | Create task |
| [`GET /api/v1/jobs/recordInfo?taskId=...`](https://docs.dreamto.ai/en/api-reference/suno-separate-vocals/query-task) | Get task |
| [`POST callBackUrl`](https://docs.dreamto.ai/en/api-reference/suno-separate-vocals/task-callback) | Task callback |

## Parameters

`model` is `ai-music-api/separate-vocals`; the parameters go in `input`. Requests that break a rule return `code: 422`; no task is created or charged.

| Field | Values |
| - | - |
| `task_id / audio_id` | Either these or `audio_url`, always together; a song task of this account that succeeded within 14 days and one of its songs |
| `audio_url` | Either this or `task_id` + `audio_id`; your own audio URL, up to 20 MB |
| `type` | Optional, `separate_vocal` (default) / `split_stem` / `split_stem_advanced`; sets the stems returned and the price |
| `stem_name` | Required with `type: split_stem_advanced` and not allowed otherwise; the instrument to extract, such as `Piano` or `Lead Vocal` |

## Pricing

Billed per request: each succeeded task is charged once at the model price shown in the console. The balance is checked for that price when the task is created (`code: 402` when insufficient); invalid requests and failed tasks are not charged.

The price depends on `type`: `separate_vocal` (default), `split_stem` and `split_stem_advanced` each have their own price, shown in the console.

## Quick start

Create a task to get `data.taskId`, poll about every 10 seconds and read `response` once `state` is `success`; or pass `callBackUrl` to be called back when the task finishes. `$DREAMTO_API_KEY` is your API Key.

```bash cURL theme={null}
# 1. Create the task
curl -X POST "https://api.dreamto.ai/api/v1/jobs/createTask" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ai-music-api/separate-vocals",
    "callBackUrl": "https://your-domain.com/api/callback",
    "input": {
      "task_id": "c2a81e5f09d34b7e8f61a2d4c9b03e75",
      "audio_id": "f924248f-e765-48fd-9ea9-c64290225e4e",
      "type": "separate_vocal"
    }
  }'

# 2. Query the task
curl "https://api.dreamto.ai/api/v1/jobs/recordInfo?taskId=7d3f0a9c41e85b2f6a1c9e04b8d27f53" \
  -H "Authorization: Bearer $DREAMTO_API_KEY"
```

```python Python theme={null}
import os
import time

import requests

BASE_URL = "https://api.dreamto.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"}

payload = {
    "model": "ai-music-api/separate-vocals",
    "callBackUrl": "https://your-domain.com/api/callback",
    "input": {
        "task_id": "c2a81e5f09d34b7e8f61a2d4c9b03e75",
        "audio_id": "f924248f-e765-48fd-9ea9-c64290225e4e",
        "type": "separate_vocal"
    }
}

created = requests.post(f"{BASE_URL}/api/v1/jobs/createTask", headers=HEADERS, json=payload, timeout=60).json()
if created["code"] != 200:
    raise SystemExit(f"{created['code']}: {created['msg']}")
task_id = created["data"]["taskId"]
while True:
    record = requests.get(f"{BASE_URL}/api/v1/jobs/recordInfo", headers=HEADERS, params={"taskId": task_id}, timeout=60).json()["data"]
    if record["state"] in ("success", "fail"):
        break
    time.sleep(10)
if record["state"] == "success":
    for stem in record["response"]["resultObject"]["origin_data"]:
        print(stem["stem_type_group_name"], stem["id"], stem["audio_url"])
else:
    print(record["failCode"], record["failMsg"])
```

## Callback

Pass `callBackUrl` (a public `http` / `https` URL) when creating the task; when the task succeeds or fails DreamTo `POST`s the result there once ([callback format](https://docs.dreamto.ai/en/api-reference/suno-separate-vocals/task-callback.md)): on success the body is `{"code": 200, "msg": "vocal Removal generated successfully.", "data": {"task_id", "vocal_removal_info"}}`, with `data.task_id` the task ID and `vocal_removal_info` the stem details (the same as `response.resultObject`); on failure `code` is the failure code (not `200`), `msg` the reason and `data` holds only `task_id`.

The request carries `X-DreamTo-Event: task.completed`, `X-DreamTo-Timestamp` (UTC, RFC 3339) and `X-DreamTo-Signature`:

```
X-DreamTo-Signature = hex( HMAC-SHA256( secret, X-DreamTo-Timestamp + "." + data.task_id + "." + status ) )
```

`status` is `success` when the task succeeded and `failed` when it failed. The secret is generated in the DreamTo console; without one no signature header is sent. Answer with any `2xx` to acknowledge; otherwise the callback is retried.

## Notes

* Give exactly one source: `task_id` + `audio_id` (always together), or `audio_url`. Both or neither return `code: 422`; no task is created or charged.
* `stem_name` is only for `split_stem_advanced`, where it is required; values are case-sensitive (such as `Piano` or `808`).
* The result is in `response`: `resultUrls` lists every stem (file names end with the stem name, such as `_Vocals.mp3`); `resultObject` gives `vocal_url`, `instrumental_url` or the instrument `*_url` fields for the mode, plus `origin_data` (each stem's `id`, `audio_url`, `duration` and `stem_type_group_name`; for `split_stem_advanced`, groups of `extract` / `remove` pairs).
* `origin_data[].id` is the stem ID; use it as `audio_id`, with this task's `taskId`, in Generate MIDI and Convert to WAV.
* Separation quality depends on the complexity and mix of the original; separating the same song again is charged again.
* `taskId` is issued by DreamTo (32 hex digits) and can only be queried with an API Key of the same account; an unknown or expired task returns `code: 422` with `msg: recordInfo is null`.
* The body accepts only `model`, `callBackUrl` and `input`; undeclared `input` fields, wrong types and values that break a rule return `code: 422` with an English reason in `msg`; no task is created or charged.
* Every file link in a result (audio, cover image, video and so on) is a DreamTo download link (`/v1/tasks/{task_id}/artifacts/...`) that works without an API Key and supports `Range`; files are kept for 14 days after the task is created, so download them promptly.
* `param` echoes the create request, with `input` as a JSON string that needs a second parse; the credits used are not returned, and the charge is shown in the DreamTo console bills.
* `failCode` / `failMsg` of a failed task come from the model service (content moderation, a source audio that cannot be downloaded and so on); internal errors are reported as `failCode: "500"` with `failMsg: "Internal Error, Please try again later."`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.