Add Vocals Callbacks
Real-time asynchronous webhook notifications delivered to your callBackUrl when synthetic vocal layering on top of instrumental backing completes. Returns dual-track fully mixed songs with vocals aligned to tempo and harmony.
Usage Guide & Overview
- Acoustic Alignment Pipeline: When adding vocals to an instrumental backing track, the model analyzes rhythm, pitch, and chord progressions to ensure vocal harmony. Providing a
callBackUrldelivers final mixed results the second they finish rendering. - Dual Performance Takes: The engine renders 2 distinct vocal performances (different vocal phrasing, emotion, and dynamics) mixed into the backing track.
- Zero Credit Surcharge: Webhook callback delivery is completely free (0 credits) and incurs no extra fees.
- Full Stem Traceability: The callback returns
source_audio_urlreferencing the original instrumental input track.
Delivery Conditions & Technical Constraints
Callback Stages (data.callbackType)
text: Lyrics analysis and vocal cadence aligned with backing track tempo.first: First vocal take synthesized and mixed; preview stream available.complete: Both vocal arrangements fully mixed, mastered, and hosted on CDN.error: Vocal generation aborted due to policy filtering or unprocessable backing audio.
HTTP Transport & Timeout Specification
- HTTP Method: Requests are delivered via
POSTwithContent-Type: application/json. - 15-Second Window: Your server must acknowledge receipt with HTTP
200within 15 seconds. - Automated Retries: If your server fails to respond, returns 4xx/5xx, or times out, the dispatcher retries up to 3 times before terminating.
- Public Accessibility: The
callBackUrlmust be accessible via public HTTPS.
Production Best Practices
- Immediate 200 Acknowledgment: Return HTTP 200 immediately before performing heavy downstream processing (saving files, transcoding, uploading to S3).
- Idempotent Handling: Use
task_id + callbackTypeas a compound unique key in your database. - Mixed Audio Storage: Download and archive the final MP3 files promptly onto your own persistent storage.
Troubleshooting & Verification Checklist
- Check that your firewall or cloud security group permits incoming POST requests on your callback URL.
- For local development and testing, use reverse tunneling tools such as ngrok or Cloudflare Tunnel.
- Ensure your web application uses JSON body parsing middleware (e.g.
express.json()). - Verify that your endpoint returns HTTP 200 rather than redirects.
Inbound HTTP Headers
| Header | Requirement | Description |
|---|---|---|
| Content-Type | required | application/json Inbound webhook payload encoded in UTF-8 JSON format |
| User-Agent | optional | Suno-Webhook-Dispatcher/1.0 User agent identifier sent by the webhook worker |
When Callbacks Are Sent
The SongMesh API automatically triggers an HTTP POST request to your designated callBackUrl under these events:
- Text Planned (callbackType: 'text'): Dispatched when lyrical phrasing and vocal alignment to the instrumental track are structured.
- First Vocal Take Ready (callbackType: 'first'): Dispatched when the first vocal performance variation is synthesized and ready for streaming.
- All Vocal Takes Complete (callbackType: 'complete'): Dispatched when both vocal takes have been rendered, mixed into the instrumental, and mastered.
- Task Failure (callbackType: 'error'): Dispatched if the lyrics violate safety filters or the instrumental audio track cannot be decoded.
Webhook Payload Format
{
"code": 200,
"msg": "All generated successfully.",
"data": {
"callbackType": "complete",
"task_id": "2fac9a8109bf4a6385cf71e3b6999f72",
"data": [
{
"id": "e231a481-9b11-4cb3-a9d2-5a218cadc7dc",
"audio_url": "https://example.cn/music/vocals_take1.mp3",
"stream_audio_url": "https://example.cn/stream/vocals_take1",
"image_url": "https://example.cn/images/vocals_cover1.jpeg",
"prompt": "[Verse 1]\nUnderneath the starlit sky\nFeel the rhythm coming alive\n[Chorus]\nSinging high above the ground",
"model_name": "chirp-v4-5",
"title": "Starlight Harmony",
"tags": "passionate female pop vocals, emotive harmonies, crystal clear delivery",
"createTime": 1786343609818,
"duration": 195.6,
"source_audio_url": "https://example.cn/music/backing_instrumental.mp3",
"source_image_url": "https://example.cn/images/backing_cover.jpeg",
"source_stream_audio_url": "https://example.cn/stream/backing_stream"
},
{
"id": "e231a482-9b11-4cb3-a9d2-5a218cadc7dd",
"audio_url": "https://example.cn/music/vocals_take2.mp3",
"stream_audio_url": "https://example.cn/stream/vocals_take2",
"image_url": "https://example.cn/images/vocals_cover2.jpeg",
"prompt": "[Verse 1]\nUnderneath the starlit sky\nFeel the rhythm coming alive\n[Chorus]\nSinging high above the ground",
"model_name": "chirp-v4-5",
"title": "Starlight Harmony (Alt Delivery)",
"tags": "dynamic female pop vocals, rhythmic vibrato, soaring climax",
"createTime": 1786343609818,
"duration": 195.6,
"source_audio_url": "https://example.cn/music/backing_instrumental.mp3",
"source_image_url": "https://example.cn/images/backing_cover.jpeg",
"source_stream_audio_url": "https://example.cn/stream/backing_stream"
}
]
}
}Callback Payload Fields
| Field | Type | Description |
|---|---|---|
code | integer | Status code of task processing. 200 indicates success; 400 or 500 indicates a failure. |
msg | string | Descriptive status message explaining the vocal synthesis outcome (e.g. "All generated successfully."). |
data.callbackType | string | Lifecycle stage identifier: "text" (alignment planned), "first" (take 1 ready), "complete" (all takes ready), or "error" (failed). |
data.task_id | string | Unique task identifier, identical to the taskId returned when submitting the task to POST /api/v1/createTask. |
data.data | array | Array containing generated vocal audio variations (typically 2 distinct vocal interpretations layered over the instrumental). |
data.data[].id | string | Unique UUID for the vocal performance track record. |
data.data[].audio_url | string | Direct download URL for the fully mixed song (vocals + instrumental backing). |
data.data[].stream_audio_url | string | Streaming audio URL (HLS / m3u8 format) for real-time web playback. |
data.data[].image_url | string | Album artwork cover image URL created for the vocal track. |
data.data[].prompt | string | Lyrics, verse structure, or vocal style instructions supplied for generation. |
data.data[].model_name | string | Underlying AI audio synthesis model used (e.g. "chirp-v4-5", "chirp-v4", "V6"). |
data.data[].title | string | Song title of the vocal track. |
data.data[].tags | string | Vocal timbre, genre, mood, and vocal technique descriptors. |
data.data[].createTime | integer | Unix millisecond timestamp when the vocal track was synthesized. |
data.data[].duration | number | Total duration of the final mixed audio track in seconds. |
data.data[].source_audio_url | string | Direct audio URL of the input backing instrumental track. |
data.data[].source_image_url | string | Cover artwork image URL of the source backing track. |
data.data[].source_stream_audio_url | string | Streaming audio URL of the source backing track. |
Receiver Implementation Example
const express = require('express');
const app = express();
app.use(express.json({ limit: '10mb' }));
app.post('/suno-vocals-callback', (req, res) => {
const { code, msg, data } = req.body;
console.log('Received Suno vocal synthesis callback:', {
taskId: data?.task_id,
callbackType: data?.callbackType,
status: code,
message: msg
});
if (code === 200 && data) {
const { callbackType, task_id, data: tracks } = data;
switch (callbackType) {
case 'text':
console.log(`[${task_id}] Vocal phrasing structured:`, tracks);
break;
case 'first':
console.log(`[${task_id}] First vocal take ready:`, tracks?.[0]?.audio_url);
break;
case 'complete':
console.log(`[${task_id}] Both vocal takes rendered successfully!`);
tracks?.forEach((track, index) => {
console.log(`Vocal Take #${index + 1}: ${track.title} (${track.duration}s)`);
console.log(`- Mixed MP3: ${track.audio_url}`);
console.log(`- Instrumental Backing: ${track.source_audio_url}`);
});
break;
case 'error':
console.error(`[${task_id}] Vocal generation failed:`, msg);
break;
}
} else {
console.error('Task failed or returned non-200 code:', code, msg);
}
// Always return HTTP 200 within 15 seconds to acknowledge receipt
return res.status(200).json({ status: 'received' });
});
app.listen(3000, () => {
console.log('Suno vocals webhook listener running on port 3000');
});Webhook Security Recommendation
Always verify incoming webhook payloads on your server. Respond with a 200 OK immediately after parsing the payload to prevent redundant delivery retries from the webhook dispatcher.
// app/api/webhook/suno-vocals/route.ts
import { NextRequest, NextResponse } from 'next/server';
interface VocalsTrackItem {
id: string;
audio_url: string;
stream_audio_url: string;
image_url: string;
prompt: string;
model_name: string;
title: string;
tags: string;
createTime: number;
duration: number;
source_audio_url?: string;
source_image_url?: string;
source_stream_audio_url?: string;
}
interface VocalsCallbackPayload {
code: number;
msg: string;
data: {
callbackType: 'text' | 'first' | 'complete' | 'error';
task_id: string;
data?: VocalsTrackItem[];
};
}
export async function POST(req: NextRequest) {
try {
const payload: VocalsCallbackPayload = await req.json();
const { code, msg, data } = payload;
console.log(`[Vocals Webhook] Task ${data?.task_id} -> Stage: ${data?.callbackType} (Code: ${code})`);
if (code === 200 && data) {
if (data.callbackType === 'complete') {
console.log(`Vocal tracks generated: ${data.data?.length || 0}`);
for (const track of data.data || []) {
console.log(`Track: "${track.title}" (${track.duration}s)`);
console.log(`- Vocal Mixed Audio: ${track.audio_url}`);
console.log(`- Instrumental Backing: ${track.source_audio_url}`);
}
} else if (data.callbackType === 'first') {
console.log(`[First Vocal Take Ready] Stream: ${data.data?.[0]?.stream_audio_url}`);
} else if (data.callbackType === 'text') {
console.log('[Text Ready] Vocal phrasing and lyrics fitted to instrumental');
}
} else {
console.error(`Vocal synthesis failed: ${msg}`);
}
// Always acknowledge receipt immediately with HTTP 200
return NextResponse.json({ code: 200, msg: 'success' });
} catch (error) {
console.error('Webhook error:', error);
return NextResponse.json({ code: 500, msg: 'Internal server error' }, { status: 500 });
}
}{
"code": 200,
"msg": "success"
}Ready to integrate Add Vocals Callbacks?
Create your free account, obtain your Secret Key, and receive real-time vocal layering updates with 5 free generation credits.