Audio Separation Callbacks
System will call this callback when vocal and instrument separation is complete.
When you submit a vocal separation task to the Suno API, you can use the callBackUrl parameter to set a callback URL. The system will automatically push the results to your specified address when the task is completed.
Callback Mechanism Overview
Webhook Security
To ensure the authenticity and integrity of callback requests, we strongly recommend implementing webhook signature verification. See our Webhook Verification Guide for detailed implementation steps.
Callback Timing
The system will send callback notifications in the following situations:
- Vocal separation task completed successfully
- Vocal separation task failed
- Errors occurred during task processing
Callback Method
- HTTP Method: POST
- Content Type: application/json
- Timeout Setting: 15 seconds
Callback Request Format
When the task is completed, the system will send a POST request to your callBackUrl based on the separation type you selected. Different separation types correspond to different callback data structures:
separate_vocal Type Callbacks
Success Callback
{
"code": 200,
"msg": "vocal Removal generated successfully.",
"data": {
"task_id": "3e63b4cc88d52611159371f6af5571e7",
"vocal_removal_info": {
"instrumental_url": "https://file.aiquickdraw.com/s/d92a13bf-c6f4-4ade-bb47-f69738435528_Instrumental.mp3",
"origin_url": "",
"vocal_url": "https://file.aiquickdraw.com/s/3d7021c9-fa8b-4eda-91d1-3b9297ddb172_Vocals.mp3",
"origin_data": [
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Vocals",
"id": "efb902e8-ade5-467d-b7d0-61fa5e057d51"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Instrumental",
"id": "f239d1a9-0480-4ae5-ac28-feb7a12553cb"
}
]
}
}
}Failure Callback
{
"code": 500,
"msg": "Vocal separation failed",
"data": {
"task_id": "3e63b4cc88d52611159371f6af5571e7"
}
}split_stem Type Callbacks
Success Callback
{
"code": 200,
"msg": "vocal Removal generated successfully.",
"data": {
"task_id": "e649edb7abfd759285bd41a47a634b10",
"vocal_removal_info": {
"origin_url": "",
"backing_vocals_url": "https://file.aiquickdraw.com/s/aadc51a3-4c88-4c8e-a4c8-e867c539673d_Backing_Vocals.mp3",
"bass_url": "https://file.aiquickdraw.com/s/a3c2da5a-b364-4422-adb5-2692b9c26d33_Bass.mp3",
"brass_url": "https://file.aiquickdraw.com/s/334b2d23-0c65-4a04-92c7-22f828afdd44_Brass.mp3",
"drums_url": "https://file.aiquickdraw.com/s/ac75c5ea-ac77-4ad2-b7d9-66e140b78e44_Drums.mp3",
"fx_url": "https://file.aiquickdraw.com/s/a8822c73-6629-4089-8f2a-d19f41f0007d_FX.mp3",
"guitar_url": "https://file.aiquickdraw.com/s/064dd08e-d5d2-4201-9058-c5c40fb695b4_Guitar.mp3",
"keyboard_url": "https://file.aiquickdraw.com/s/adc934e0-df7d-45da-8220-1dba160d74e0_Keyboard.mp3",
"percussion_url": "https://file.aiquickdraw.com/s/0f70884d-047c-41f1-a6d0-7044618b7dc6_Percussion.mp3",
"strings_url": "https://file.aiquickdraw.com/s/49829425-a5b0-424e-857a-75d4c63a426b_Strings.mp3",
"synth_url": "https://file.aiquickdraw.com/s/56b2d94a-eb92-4d21-bc43-3460de0c8348_Synth.mp3",
"vocal_url": "https://file.aiquickdraw.com/s/07420749-29a2-4054-9b62-e6a6f8b90ccb_Vocals.mp3",
"woodwinds_url": "https://file.aiquickdraw.com/s/d81545b1-6f94-4388-9785-1aaa6ecabb02_Woodwinds.mp3",
"origin_data":
[
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Vocals",
"id": "aea2a703-6f8f-494d-b75f-1707a204b6b3"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Backing_Vocals",
"id": "e8fbb979-e5aa-4383-b047-b3f477ade352"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Drums",
"id": "c03975d4-6e0a-4035-8e63-051a6645d341"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Bass",
"id": "87d276bc-0934-4867-963d-53260b2c2a3a"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Guitar",
"id": "2e528c6e-fb86-4102-a7c5-99f2924c8ec9"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Keyboard",
"id": "085ce0bf-7683-49d2-b640-ab682cd821bb"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Percussion",
"id": "eac93cca-b286-4e55-ad56-da0809fde10e"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Strings",
"id": "b9fc0b0c-03ad-4d57-a750-9a781ca4e533"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Synth",
"id": "0c45fb26-a317-40bb-8ff7-1b9d48a41d4b"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "FX",
"id": "d6ef4126-b05c-42b5-aa3e-6b10ab545caf"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Brass",
"id": "f3f5e600-0de4-4278-afb9-56858de13402"
},
{
"duration": 240,
"audio_url": "https://example/s/3*****s.mp3",
"stem_type_group_name": "Woodwinds",
"id": "433ec06c-787f-4a89-ae91-7bd8c9c6c1c1"
}
]
}
}
}Failure Callback
{
"code": 500,
"msg": "Instrument separation failed",
"data": {
"task_id": "e649edb7abfd759285bd41a47a634b10"
}
}split_stem_advanced Type Callbacks
Success Callback
{
"code": 200,
"msg": "vocal Removal generated successfully.",
"data": {
"task_id": "7220be2955295dda60de46ec6e4ead4c",
"vocal_removal_info": {
"origin_data": [
{
"extract": {
"duration": 194.92,
"audio_url": "https://tempfile.aiquickdraw.com/r/eb7d0f18-8349-4735-a65e-1812705d5ddf_Lead Vocal.mp3",
"stem_type_group_name": "Lead Vocal",
"id": "eb7d0f18-8349-4735-a65e-1812705d5ddf"
},
"remove": {
"duration": 194.92,
"audio_url": "https://tempfile.aiquickdraw.com/r/706d32df-e988-412e-bce4-42c9302e5478_Lead Vocal.mp3",
"stem_type_group_name": "Lead Vocal",
"id": "706d32df-e988-412e-bce4-42c9302e5478"
}
},
{
"extract": {
"duration": 194.92,
"audio_url": "https://tempfile.aiquickdraw.com/r/a7c503f6-1265-4f7e-bf5d-c50fb3b07238_Lead Vocal.mp3",
"stem_type_group_name": "Lead Vocal",
"id": "a7c503f6-1265-4f7e-bf5d-c50fb3b07238"
},
"remove": {
"duration": 194.92,
"audio_url": "https://tempfile.aiquickdraw.com/r/a3a0c954-1980-410f-9b34-8539b8eb23f8_Lead Vocal.mp3",
"stem_type_group_name": "Lead Vocal",
"id": "a3a0c954-1980-410f-9b34-8539b8eb23f8"
}
}
],
"origin_url": ""
}
}
}Failure Callback
{
"code": 500,
"data": {
"task_id": "0f4283e1df41e18f7177efbcecd839a1"
},
"msg": "vocal Removal generation failed."
}Status Code Description
code (integer, required)
Callback status code indicating task processing result:
| Status Code | Description |
|---|---|
| 200 | Success - Request has been processed successfully |
| 500 | Internal Error - Please try again later |
msg (string, required)
Status message providing detailed status description
data.task_id (string, required)
Task ID, consistent with the task_id returned when you submitted the task
data.vocal_removal_info (object)
Vocal separation result information, returned on success. The returned fields depend on the separation type (type parameter)
separate_vocal Type Callback Fields
data.vocal_removal_info.instrumental_url (string)
Instrumental part audio URL (separate_vocal type only)
data.vocal_removal_info.origin_url (string)
Original audio URL
data.vocal_removal_info.vocal_url (string)
Vocal part audio URL
split_stem Type Callback Fields
data.vocal_removal_info.origin_url (string)
Original audio URL
data.vocal_removal_info.vocal_url (string)
Main vocal audio URL
data.vocal_removal_info.backing_vocals_url (string)
Backing vocals audio URL (split_stem type only)
data.vocal_removal_info.drums_url (string)
Drums part audio URL (split_stem type only)
data.vocal_removal_info.bass_url (string)
Bass part audio URL (split_stem type only)
data.vocal_removal_info.guitar_url (string)
Guitar part audio URL (split_stem type only)
data.vocal_removal_info.keyboard_url (string)
Keyboard part audio URL (split_stem type only)
data.vocal_removal_info.percussion_url (string)
Percussion part audio URL (split_stem type only)
data.vocal_removal_info.strings_url (string)
Strings part audio URL (split_stem type only)
data.vocal_removal_info.synth_url (string)
Synthesizer part audio URL (split_stem type only)
data.vocal_removal_info.fx_url (string)
Effects part audio URL (split_stem type only)
data.vocal_removal_info.brass_url (string)
Brass part audio URL (split_stem type only)
data.vocal_removal_info.woodwinds_url (string)
Woodwinds part audio URL (split_stem type only)
split_stem_advanced Callback Fields
data.vocal_removal_info.origin_data (array)
An array of separation results for the original audio, containing extraction and removal information for multiple stem groups. Each element represents an independent stem group (e.g., Lead Vocal).
data.vocal_removal_info.origin_data[].extract (object)
Information about the extracted target stem (isolates this stem while removing others).
data.vocal_removal_info.origin_data[].extract.duration (number)
The duration of the extracted audio, in seconds.
data.vocal_removal_info.origin_data[].extract.audio_url (string)
The download URL of the extracted target stem audio file.
data.vocal_removal_info.origin_data[].extract.stem_type_group_name (string)
The stem type group name (e.g., Lead Vocal), indicating which type of stem this group extracts.
data.vocal_removal_info.origin_data[].extract.id (string)
The unique identifier for the extracted audio.
data.vocal_removal_info.origin_data[].remove (object)
Information about the remaining audio after removing the target stem (removes this stem while keeping others).
data.vocal_removal_info.origin_data[].remove.duration (number)
The duration of the audio after removal, in seconds.
data.vocal_removal_info.origin_data[].remove.audio_url (string)
The download URL of the remaining audio file after the target stem has been removed.
data.vocal_removal_info.origin_data[].remove.stem_type_group_name (string)
The stem type group name (e.g., Lead Vocal), consistent with the corresponding extract entry.
data.vocal_removal_info.origin_data[].remove.id (string)
The unique identifier for the remaining audio.
Callback Reception Examples
Below are example codes for receiving callbacks in popular programming languages:
Node.js
const express = require('express');
const app = express();
app.use(express.json());
app.post('/suno-vocal-separation-callback', (req, res) => {
const { code, msg, data } = req.body;
console.log('Received vocal separation callback:', {
taskId: data.task_id,
status: code,
message: msg
});
if (code === 200) {
// Task completed successfully
console.log('Vocal separation completed');
const vocalInfo = data.vocal_removal_info;
if (vocalInfo) {
console.log('Separation results:');
console.log(`Original audio: ${vocalInfo.origin_url}`);
console.log(`Vocal part: ${vocalInfo.vocal_url}`);
if (vocalInfo.instrumental_url) {
console.log(`Instrumental part: ${vocalInfo.instrumental_url}`);
}
if (vocalInfo.backing_vocals_url) {
console.log(`Backing vocals: ${vocalInfo.backing_vocals_url}`);
console.log(`Drums part: ${vocalInfo.drums_url}`);
console.log(`Bass part: ${vocalInfo.bass_url}`);
console.log(`Guitar part: ${vocalInfo.guitar_url}`);
console.log(`Keyboard part: ${vocalInfo.keyboard_url}`);
console.log(`Percussion part: ${vocalInfo.percussion_url}`);
console.log(`Strings part: ${vocalInfo.strings_url}`);
console.log(`Synthesizer part: ${vocalInfo.synth_url}`);
console.log(`Effects part: ${vocalInfo.fx_url}`);
console.log(`Brass part: ${vocalInfo.brass_url}`);
console.log(`Woodwinds part: ${vocalInfo.woodwinds_url}`);
}
}
} else {
console.log('Vocal separation failed:', msg);
}
res.status(200).json({ status: 'received' });
});
app.listen(3000, () => {
console.log('Callback server running on port 3000');
});Python
from flask import Flask, request, jsonify
import requests
import os
app = Flask(__name__)
@app.route('/suno-vocal-separation-callback', methods=['POST'])
def handle_callback():
data = request.json
code = data.get('code')
msg = data.get('msg')
callback_data = data.get('data', {})
task_id = callback_data.get('task_id')
vocal_info = callback_data.get('vocal_removal_info')
print(f"Received vocal separation callback: {task_id}, status: {code}, message: {msg}")
if code == 200:
print("Vocal separation completed")
if vocal_info:
print("Separation results:")
print(f"Original audio: {vocal_info.get('origin_url')}")
print(f"Vocal part: {vocal_info.get('vocal_url')}")
if vocal_info.get('instrumental_url'):
print(f"Instrumental part: {vocal_info.get('instrumental_url')}")
if vocal_info.get('backing_vocals_url'):
print(f"Backing vocals: {vocal_info.get('backing_vocals_url')}")
print(f"Drums part: {vocal_info.get('drums_url')}")
print(f"Bass part: {vocal_info.get('bass_url')}")
print(f"Guitar part: {vocal_info.get('guitar_url')}")
print(f"Keyboard part: {vocal_info.get('keyboard_url')}")
print(f"Percussion part: {vocal_info.get('percussion_url')}")
print(f"Strings part: {vocal_info.get('strings_url')}")
print(f"Synthesizer part: {vocal_info.get('synth_url')}")
print(f"Effects part: {vocal_info.get('fx_url')}")
print(f"Brass part: {vocal_info.get('brass_url')}")
print(f"Woodwinds part: {vocal_info.get('woodwinds_url')}")
# Download example
def download_audio_file(url, filename):
if url:
try:
response = requests.get(url)
if response.status_code == 200:
with open(filename, "wb") as f:
f.write(response.content)
print(f"Saved: {filename}")
except Exception as e:
print(f"Download failed {filename}: {e}")
os.makedirs(f"vocal_separation_{task_id}", exist_ok=True)
download_audio_file(vocal_info.get('vocal_url'),
f"vocal_separation_{task_id}/vocal.mp3")
if vocal_info.get('instrumental_url'):
download_audio_file(vocal_info.get('instrumental_url'),
f"vocal_separation_{task_id}/instrumental.mp3")
if vocal_info.get('backing_vocals_url'):
stem_files = {
'backing_vocals': vocal_info.get('backing_vocals_url'),
'drums': vocal_info.get('drums_url'),
'bass': vocal_info.get('bass_url'),
'guitar': vocal_info.get('guitar_url'),
'keyboard': vocal_info.get('keyboard_url'),
'percussion': vocal_info.get('percussion_url'),
'strings': vocal_info.get('strings_url'),
'synth': vocal_info.get('synth_url'),
'fx': vocal_info.get('fx_url'),
'brass': vocal_info.get('brass_url'),
'woodwinds': vocal_info.get('woodwinds_url')
}
for name, url in stem_files.items():
download_audio_file(url, f"vocal_separation_{task_id}/{name}.mp3")
else:
print(f"Vocal separation failed: {msg}")
return jsonify({'status': 'received'}), 200
if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000)PHP
<?php
header('Content-Type: application/json');
$input = file_get_contents('php://input');
$data = json_decode($input, true);
$code = $data['code'] ?? null;
$msg = $data['msg'] ?? '';
$callbackData = $data['data'] ?? [];
$taskId = $callbackData['task_id'] ?? '';
$vocalInfo = $callbackData['vocal_removal_info'] ?? null;
error_log("Received vocal separation callback: $taskId, status: $code, message: $msg");
if ($code === 200) {
error_log("Vocal separation completed");
if ($vocalInfo) {
error_log("Separation results:");
error_log("Original audio: " . ($vocalInfo['origin_url'] ?? ''));
error_log("Vocal part: " . ($vocalInfo['vocal_url'] ?? ''));
if (!empty($vocalInfo['instrumental_url'])) {
error_log("Instrumental part: " . $vocalInfo['instrumental_url']);
}
if (!empty($vocalInfo['backing_vocals_url'])) {
error_log("Backing vocals: " . $vocalInfo['backing_vocals_url']);
error_log("Drums part: " . ($vocalInfo['drums_url'] ?? ''));
error_log("Bass part: " . ($vocalInfo['bass_url'] ?? ''));
error_log("Guitar part: " . ($vocalInfo['guitar_url'] ?? ''));
error_log("Keyboard part: " . ($vocalInfo['keyboard_url'] ?? ''));
error_log("Percussion part: " . ($vocalInfo['percussion_url'] ?? ''));
error_log("Strings part: " . ($vocalInfo['strings_url'] ?? ''));
error_log("Synthesizer part: " . ($vocalInfo['synth_url'] ?? ''));
error_log("Effects part: " . ($vocalInfo['fx_url'] ?? ''));
error_log("Brass part: " . ($vocalInfo['brass_url'] ?? ''));
error_log("Woodwinds part: " . ($vocalInfo['woodwinds_url'] ?? ''));
}
function downloadAudioFile($url, $filename) {
if (!empty($url)) {
try {
$audioContent = file_get_contents($url);
if ($audioContent !== false) {
file_put_contents($filename, $audioContent);
error_log("Saved: $filename");
}
} catch (Exception $e) {
error_log("Download failed $filename: " . $e->getMessage());
}
}
}
$dir = "vocal_separation_$taskId";
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
downloadAudioFile($vocalInfo['vocal_url'] ?? '', "$dir/vocal.mp3");
if (!empty($vocalInfo['instrumental_url'])) {
downloadAudioFile($vocalInfo['instrumental_url'], "$dir/instrumental.mp3");
}
if (!empty($vocalInfo['backing_vocals_url'])) {
$stemFiles = [
'backing_vocals' => $vocalInfo['backing_vocals_url'] ?? '',
'drums' => $vocalInfo['drums_url'] ?? '',
'bass' => $vocalInfo['bass_url'] ?? '',
'guitar' => $vocalInfo['guitar_url'] ?? '',
'keyboard' => $vocalInfo['keyboard_url'] ?? '',
'percussion' => $vocalInfo['percussion_url'] ?? '',
'strings' => $vocalInfo['strings_url'] ?? '',
'synth' => $vocalInfo['synth_url'] ?? '',
'fx' => $vocalInfo['fx_url'] ?? '',
'brass' => $vocalInfo['brass_url'] ?? '',
'woodwinds' => $vocalInfo['woodwinds_url'] ?? ''
];
foreach ($stemFiles as $name => $url) {
downloadAudioFile($url, "$dir/$name.mp3");
}
}
}
} else {
error_log("Vocal separation failed: $msg");
}
http_response_code(200);
echo json_encode(['status' => 'received']);
?>Best Practices
Callback URL Configuration Recommendations
- Use HTTPS: Ensure callback URL uses HTTPS protocol for secure data transmission
- Verify Origin: Verify the legitimacy of the request source in callback processing
- Idempotent Processing: The same task_id may receive multiple callbacks, ensure processing logic is idempotent
- Quick Response: Callback processing should return 200 status code quickly to avoid timeout
- Asynchronous Processing: Complex business logic should be processed asynchronously to avoid blocking callback responses
- Type-based Processing: Handle different audio file structures based on different separation types
- Batch Download: split_stem type produces multiple files, recommend batch downloading and organizing by type
Important Reminders
- Callback URL must be publicly accessible
- Server must respond within 15 seconds, otherwise will be considered timeout
- If 3 consecutive retry attempts fail, the system will stop sending callbacks
- Please ensure the stability of callback processing logic to avoid callback failures due to exceptions
- Vocal separation generated audio file URLs may have time limits, recommend downloading and saving promptly
- Note that some audio part URLs may be empty, certain instrument separations might be empty
- separate_vocal and split_stem types return different fields, please handle corresponding fields based on the type parameter in the request
Troubleshooting
If you are not receiving callback notifications, please check the following:
Network Connection Issues
- Confirm callback URL is accessible from public internet
- Check firewall settings to ensure inbound requests are not blocked
- Verify domain name resolution is correct
Server Response Issues
- Ensure server returns HTTP 200 status code within 15 seconds
- Check server logs for error messages
- Verify endpoint path and HTTP method are correct
Content Format Issues
- Confirm received POST request body is in JSON format
- Check if Content-Type is application/json
- Verify JSON parsing is correct
File Processing Issues
- Confirm all audio file URLs are accessible
- Check file download permissions and network connection
- Verify file save path and permissions
- Note that some instrument separation results may be empty
- Note the field differences between separate_vocal and split_stem types