API Endpoints

API Overview

AI Music API

API Documentation

Explore our powerful API to generate music with AI

Get and store an API key

Authentication belongs on your application server. Never place a production key in browser code, a mobile bundle, logs, or a public repository.

  1. 1Create an account and open the API key area in the dashboard.
  2. 2Copy the key once, then store it in your server's secret manager or encrypted environment.
  3. 3Send it in the Authorization header as a Bearer token and rotate it immediately if exposed.

The examples read the key from the server environment variable UDIOAPI_KEY

Quick Start

Create an asynchronous music task, save the returned workId, and poll the feed endpoint for completion. The request below is ready to run after setting your server key.

POST/api/v2/generate
export UDIOAPI_KEY='replace-with-your-server-key'

curl --request POST \
  --url 'https://udioapi.pro/api/v2/generate' \
  --header "Authorization: Bearer $UDIOAPI_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "chirp-v5-5",
    "gpt_description_prompt": "Warm indie pop with acoustic guitar",
    "make_instrumental": true
  }'

# Save workId from the response, then poll:
curl 'https://udioapi.pro/api/v2/feed?workId=YOUR_WORK_ID'

A successful create response starts work; it does not contain final audio. Poll every 5 to 10 seconds, stop on completed output or a failure field, and cap the total wait time.

The tracked source files use UDIOAPI_KEY, bounded polling, structured errors, and no third-party dependencies. Remove all secrets before publishing a fork on GitHub.

API Endpoints

Use /v2/generate as the default Music Generate endpoint. MiniMax is an integrated provider available through /v2/minimax/generate, not the default music generation model.

Error handling

Treat the HTTP status and structured response body as part of the integration contract. Log the workId and your own request ID, but never the API key.

400

The request is invalid or a required field is missing. Fix the payload; retrying the same body will not help.

401

The API key is missing, malformed, expired, or revoked. Verify the Bearer header and rotate exposed credentials.

402

The account does not have enough credits. Pause new jobs and direct the account owner to billing.

429

The request rate is too high. Respect Retry-After when present and retry with exponential backoff and jitter.

5xx

The service or an upstream dependency failed. Retry only idempotent status reads automatically; use a bounded policy for task creation.

Do not retry moderation failures or other terminal task failures. Surface the returned fail_message or error_message so the user can change the input.

Changelog summary

Compatibility-relevant API changes are summarized in this documentation entry and linked to the affected endpoint.

chirp-v5-5 custom duration support

POST /v2/generate accepts the documented duration range for chirp-v5-5. Existing requests remain compatible when duration is omitted.

Review the generate endpoint

Credit Consumption by Model

Each AI music model draws a different amount of credits. Use this guide to budget your Music Generate integrations before you make a request.

Music Generate API

chirp-v3-55 credits
chirp-v48 credits
chirp-v4-510 credits
chirp-v4-5-plus10 credits
chirp-v512 credits
chirp-v5-512 credits

Provider Credit Consumption

minimax-music-2.530 credits