Generate Stems Endpoint
Overview
Generates stem tracks (separated audio and music tracks) from an existing audio clip. This separates vocals from instrumental parts.
🔗 Quick Links
- 📊 Dashboard - Manage accounts, view logs, and monitor system status
- 📚 API Index - Complete API reference
Endpoint
POST /api/generate_stems
POST /[accountId]/api/generate_stems
Request
Headers
Content-Type: application/json
Body (JSON)
audio_id (string, required)
ID of the audio clip to generate stems from
Example Request
curl -X POST https://your-domain.com/api/generate_stems \
-H "Content-Type: application/json" \
-d '{
"audio_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}'
const response = await fetch('/api/generate_stems', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
audio_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
})
});
Response
Success Response (200 OK)
Returns an array of AudioInfo objects (stem tracks):
[
{
"id": "stem1-id",
"title": "Stem Track 1",
"audio_url": "https://cdn.suno.ai/stem1.mp3",
"status": "complete",
"type": "stem"
},
{
"id": "stem2-id",
"title": "Stem Track 2",
"audio_url": "https://cdn.suno.ai/stem2.mp3",
"status": "complete",
"type": "stem"
}
]
Status Code: 200
Content-Type: application/json
Bad Request (400)
When audio_id is missing:
{
"error": "Audio ID is required"
}
Status Code: 400
Content-Type: application/json
Payment Required (402)
When account credits are insufficient:
{
"error": "Insufficient credits"
}
Status Code: 402
Content-Type: application/json
Internal Server Error (500)
When an error occurs:
{
"error": "Internal server error: [error details]"
}
Status Code: 500
Content-Type: application/json
Method Not Allowed (405)
When using an unsupported HTTP method:
Status Code: 405
Headers: Allow: POST
Notes
- Returns multiple stem tracks (typically vocals and instrumental)
- Each stem track is a separate
AudioInfoobject in the array - All responses include CORS headers