POST
/
api
/
v1
/
generate
Generate Music
curl --request POST \
  --url https://api.sunoapi.org/api/v1/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "A calm and relaxing piano track with soft melodies",
  "style": "Classical",
  "title": "Peaceful Piano Meditation",
  "customMode": true,
  "instrumental": true,
  "model": "V3_5",
  "negativeTags": "Heavy Metal, Upbeat Drums",
  "callBackUrl": "https://api.example.com/callback"
}'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "5c79****be8e"
  }
}
This is the key endpoint in the Suno API. Each request returns exactly 2 songs.
  • Stream URL: Available in 30-40 seconds.
  • Downloadable song URL: Ready in 2-3 minutes.
Concurrency limit: 20 requests every 10 seconds. Exceeding this will result in request rejection. Please review the parameters carefully to ensure proper use.

Parameter Usage Guide

  • When customMode is true (Custom Mode):
    • If instrumental is true: style and title are required
    • If instrumental is false: style, prompt, and title are required
    • Prompt length limit:
      • For V3_5 and V4 models: 3000 characters
      • For V4_5 and V4_5PLUS models: 5000 characters
    • Style length limit:
      • For V3_5 and V4 models: 200 characters
      • For V4_5 and V4_5PLUS models: 1000 characters
    • title length limit: 80 characters
  • When customMode is false (Non-custom Mode):
    • Only prompt is required regardless of instrumental setting
    • prompt length limit: 400 characters
    • Other parameters should be left empty

Developer Notes

  1. Recommendation for First-Time Users: Start with customMode: false and instrumental: false, and only provide a prompt. This is the simplest setup to quickly test the API and experience the results.
  2. Generated files are retained for 15 days before being deleted
  3. Ensure all required fields are provided based on the customMode and instrumental settings to avoid errors
  4. Respect the character limits for prompt, style, and title to ensure successful processing
  5. Callback process has three stages: text (text generation), first (first track complete), complete (all tracks complete)
  6. You can use the Get Music Generation Details endpoint to actively check task status instead of waiting for callbacks

Authorizations

Authorization
string
header
required

🔑 API Authentication

All endpoints require authentication using Bearer Token.

Get API Key

  1. Visit the API Key Management Page to obtain your API Key

Usage

Add to request headers:

Authorization: Bearer YOUR_API_KEY

⚠️ Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately from the management page

Body

application/json

Response

200
application/json

Request successful

The response is of type object.