Skip to main content
POST
Create Task

Create Task

Submit a new task to an AI model. The task is processed asynchronously — use the Get Task endpoint to poll for results. Sunor validates the JSON body, model, task type, and model-specific input before freezing credits, inserting a task, or calling an upstream provider. Invalid requests therefore fail without creating a task or changing the credit balance.

Request

Headers

string
required
Your API key.
string
required
Must be application/json.

Body parameters

string
required
The AI model to use. One of "suno" or "udio". See the Suno and Udio model pages for capabilities and pricing.
string
required
The type of task to create. Suno supports: "music", "lyrics", "upload", "concat". Udio supports "music" only.
object
required
Task-specific input parameters. See the sections below for each task type.
string
Delivery format for the finished audio. Currently the only accepted value is "mp3".Omit it and audio_url points at the file exactly as the provider produced it — which is what every task did before this field existed. Today that is Opus audio in an MP4 container, served with an .m4a extension.Set it to "mp3" and we convert the audio before the task reports success, and audio_url points at the MP3. There is no extra charge, and no second request to make.Two things worth knowing:
  • A task that asks for conversion settles slightly later. The conversion runs before the task is reported complete, so expect one or two more polls than usual.
  • MP3 is re-encoded, not the original. The provider’s audio is already lossy, so converting it to MP3 is a second lossy step. We use 320 kbps to keep the added loss small, but it is not bit-for-bit the provider’s output. If your pipeline can consume the original, omitting this field gives you the better-quality file.
Sunor validates the documented model/task fields before charging credits or submitting to a provider. Extra root or input properties are accepted for backward/forward compatibility, but they are not interpreted as provider controls unless a request variant explicitly prohibits them. Use documented fields for provider behavior.

Task types and input schemas

music — Generate music

The music task supports three modes depending on which input fields you provide.
Input fields differ by model. The examples below show Suno input shape (using gpt_description_prompt, make_instrumental, etc.). Udio uses a different field set — see the Udio model page for the Udio-specific shape. Mixing them produces a 400 validation error.
Generate music from a natural language description. The AI interprets your prompt and creates lyrics, melody, and arrangement.
string
required
A natural language description of the music you want (e.g., “A chill lo-fi beat for studying”).
boolean
default:"false"
Set to true to generate instrumental music without vocals.

lyrics — Generate lyrics

string
required
A description of the lyrics you want (e.g., “A love song about the ocean at sunset”).

upload — Upload audio

string
required
A publicly accessible URL of the audio file to upload.
The upload returns a clip id (at output.result[0].id). Pass it as continue_clip_id in a music task to extend your uploaded audio into a full song (see the Continuation Mode tab under the music task). Generating a new song in a different style from an uploaded reference (an “audio cover”) is not currently supported.

concat — Concatenate clips

string
required
The clip ID to concatenate (obtained from a previous music task output).

Response

Response headers

number
HTTP status code (202 on success).
object
string
Unique identifier for the created task. Use this to poll for results.
string
The task type that was submitted.
string
Initial status, always "pending".
number
Number of credits frozen for this task.
string
ISO 8601 timestamp of when the task was created.
string | null
Echo of the accepted delivery format, or null if none was requested. Check it if you passed audio_format: a misspelled field name is ignored and shows up here as null, whereas a correctly spelled one is either accepted or rejected outright with invalid_audio_format / audio_format_unavailable. So null here means “we did not take your request”, not “it failed”.
202

Code examples

Errors

Errors retain the numeric code and human-readable message, and also include a stable machine-readable error_code. See Error Codes for the full list.
Task creation does not currently support Idempotency-Key. If a network failure or uncertain 5xx leaves the create outcome unknown, do not automatically submit the same payload again. If a task_id was returned, poll that task instead.