> ## 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 Create custom voice

> Submit the user's recording of the validation phrase; once verified, a reusable custom voice is created.

`ai-music-api/create-voice` is the second step of the Suno custom-voice flow: the user reads aloud the phrase returned by the Generate Validation Phrase task and records it; submit that task's `task_id` together with the recording URL `verify_url`, and once the recording is verified a reusable custom voice is created that can sing your future songs.

For the best voice, **sing** the phrase rather than speaking it; clean a cappella vocals work best. You can also add a voice name, description, style and singer skill level.

**The Voice ID is the `task_id` of the validation-phrase task** (it is also returned in this task's `response.resultUrls[0]`), not the task ID this endpoint returns. This task succeeds almost at once, which only means the request was accepted; whether the voice is usable is shown by the validation-phrase task: `success` means the voice is ready (usually within a minute), `fail` means the recording did not pass verification. Once ready, pass the Voice ID as `persona_id` with `persona_model: "voice_persona"` in Generate Music and the other music endpoints.

## 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-voice-create/create-task) | Create task |
| [`GET /api/v1/jobs/recordInfo?taskId=...`](https://docs.dreamto.ai/en/api-reference/suno-voice-create/query-task) | Get task |
| [`POST callBackUrl`](https://docs.dreamto.ai/en/api-reference/suno-voice-create/task-callback) | Task callback |

## Parameters

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

| Field | Values |
| - | - |
| `task_id` | Required `taskId` of the Generate Validation Phrase task (waiting for the recording or succeeded); it is the Voice ID |
| `verify_url` | Required URL (`http` / `https`) of the user's recording of the validation phrase; singing it is recommended |
| `voice_name` | Optional voice name |
| `description` | Optional voice description |
| `style` | Optional voice style |
| `singer_skill_level` | Optional `beginner` (default) / `intermediate` / `advanced` / `professional` |

## 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.

## 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/create-voice",
    "callBackUrl": "https://your-domain.com/api/callback",
    "input": {
      "task_id": "c2a81e5f09d34b7e8f61a2d4c9b03e75",
      "verify_url": "https://example.com/recordings/verify-phrase.mp3",
      "voice_name": "My voice",
      "description": "A warm, bright alto",
      "style": "pop",
      "singer_skill_level": "intermediate"
    }
  }'

# 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/create-voice",
    "callBackUrl": "https://your-domain.com/api/callback",
    "input": {
        "task_id": "c2a81e5f09d34b7e8f61a2d4c9b03e75",
        "verify_url": "https://example.com/recordings/verify-phrase.mp3",
        "voice_name": "My voice",
        "description": "A warm, bright alto",
        "style": "pop",
        "singer_skill_level": "intermediate"
    }
}

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":
    print("Voice ID:", record["response"]["resultUrls"][0])
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-voice-create/task-callback.md)): on success the body is `{"code": 200, "msg": "success", "data": {"taskId", "status": "success", "errorCode": null, "errorMessage": ""}}`, with `data.taskId` the Voice ID (the validation-phrase task's `task_id`); on failure `code` and `data.errorCode` are the failure code (not `200`), `msg` and `data.errorMessage` the reason, and `data.status` is `fail`, with `data.taskId` again the Voice ID. The signature uses this (create-voice) task's `taskId`, i.e. `data.taskId` of the create response, not the Voice ID in the callback body. This callback only reports that the create request was accepted or failed; whether the voice is finally ready is shown by the validation-phrase task's state or its callback.

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 + "." + taskId + "." + 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

* This task's result `response.resultUrls` holds a single element: the Voice ID (the validation-phrase task's `task_id`), not a file link.
* Whether the voice is ready is shown by the validation-phrase task: poll its query endpoint, or pass `callBackUrl` when creating the validation-phrase task to receive its final callback (`status` is `success` or `fail`).
* If the recording fails verification, use Regenerate Validation Phrase to get a new phrase for the original task, record it again and submit this endpoint 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.