Generate

Music Generation API

Overview

Generate AI music based on text prompts using various models. The API supports different generation modes and can automatically handle lyrics generation.

API Endpoint

URL: POST https://udioapi.pro/api/generate
Content-Type: application/json

Code Examples

curl
nodejs
python

Parameters:

ParameterTypeRequiredDescription
titlestringNoThe title of the music to be generated
promptstringYesThe text prompt describing the music you want to generate
gpt_description_promptstringNoAdditional prompt for GPT to help generate better music description
custom_modebooleanNoWhether to use custom mode
make_instrumentalbooleanNoWhether to generate instrumental music without vocals
modelstringNoThe model to use for generation. Available options: "chirp-v3.5", "chirp-v3.0". Default: "chirp-v3.0"
callback_urlstringNoURL to receive generation results. If provided, results will be sent to this URL. If not provided, use the feed API to get results. Note that if the generation is successful, we will make a callback to the provided URL with the generated files. The callback method will be "POST", and the "Content-Type" should be set to "application/json".
clusterstringNoSpecify the cluster to use. Default: "default"
tokenstringYesYour API token for authentication

  • title: Music title
  • prompt: generate music prompt, If the content is too long, the generation will fail with "Topic too long."
  • gpt_description_prompt: Can input music style, If the content is too long, the generation will fail with "Topic too long."
  • custom_mode: This parameter exists only in the suno-v3 model.
  • make_instrumental: false,
  • model: Options include chirp-v3.0, chirp-v3.5, udio-130, udio-32,
    1. udio-130: Generate 2:10 clips. Takes longer
    2. udio-32: Generate 32s clips
  • callback_url : Optional field, but it is recommended to use your own address due to potential delays with our forwarding
  • cluster: Optional field to specify which API server to use. Options:
    1. default: Primary API server (default if not specified)
    2. second: Backup API server
  • token: your api_key Required field

Custom Mode: If you want to use customMode, make sure the following parameters exist.

customModeinstrumentalRequired Parameters
truefalsestyle, prompt, title
truetruestyle, title
falsetrueprompt
falsefalseprompt

Submit Generation Task Response


  • workId: Fields used to query generate results ::

Generate Callback Sample

Important Notes

  1. File Retention: Generated files are stored for 30 days
  2. Callback Format:
    • Method: POST
    • Content-Type: application/json
  3. Best Practices:
    • Use your own callback URL for better reliability
    • Keep prompts concise to avoid generation failures
    • Consider using the backup cluster during high traffic

Error Handling

Common error scenarios:

  • "Topic too long": Reduce prompt or gpt_description_prompt length
  • Authentication errors: Verify your token
  • Generation failures: Check prompt validity and try the backup cluster

Query Result API Documentation

Overview

This API allows you to retrieve the results of your generation tasks. Use this endpoint when you haven't specified a callback_url in your original request.

Feed API Endpoint

Request Details

  • Method: GET
  • URL: /api/feed
  • Required Parameter:
    • workId (string): The unique identifier of your generation task

Example Request

Response Format

The API returns a JSON object containing the following fields:

FieldTypeDescription
typestringCurrent status of the generation task (see Status Types below)
request_bodyobjectOriginal request parameters
response_dataarrayArray of generated results
created_atstringTimestamp of when the request was created

Status Types

The type field in the response can have one of these values:

  • new: Initial status after task submission
  • IN_PROGRESS: Task is currently being processed
  • complete: Task has finished, all audio files are generated

Sample Response

Response Data Fields

Each item in the response_data array contains:

FieldTypeDescription
audio_urlstringURL to download the generated audio file
createTimestringCreation timestamp
idstringUnique identifier for the generated item
image_urlstringURL of the associated image
promptstringThe structured prompt used for generation
tagsstringAssociated tags describing the content
titlestringTitle of the generated content
error_messagestringError details if any issues occurred
statusstringStatus of this specific item

Error Messages

The error_message field may contain one of the following values:

Error MessageDescriptionSolution
Unable to generate lyrics from song descriptionContent review detected violation of Suno rules, unable to generate lyricsModify your prompt to comply with content guidelines
Prompt likely malformedThe prompt structure or content has formatting issuesReview and correct your prompt format and content
Rate limit exceededToo many requests in a short time periodWait and try again later
Invalid prompt formatThe provided prompt doesn't follow required structureCheck prompt format and try again
Generation timeoutThe generation process took too longTry again or simplify your request
Server overloadServer is experiencing high loadWait and try again later
Invalid parametersOne or more request parameters are invalidCheck your request parameters
Network errorConnection issues during generationCheck your network connection and try again

Note: This is not an exhaustive list. Other error messages may occur depending on specific circumstances.

Cookies

We use cookies to enhance your browsing experience and analyze site traffic.Your privacy is important to us: we do not sell or share your personal data, and your information is securely stored. By continuing to use our site, you agree to our use of cookies.
Learn more about how we handle your data in our .