Generate Structured Lyrics
Compose poetic, rhyming, and structurally formatted song lyrics tailored to any musical genre, emotional mood, or storyline. Outputs structured lyrics complete with section markers ([Verse], [Chorus], [Bridge]) designed for direct pipeline integration with Suno music generation.
Musical Structure & Formatting
Dual VariantsPhrased with natural vocal cadence, syllable counts, and rhyme schemes tailored for melodic AI singing synthesis.
Explicitly annotated with [Intro], [Verse], [Pre-Chorus], [Chorus], and [Bridge] cues.
Key Capabilities & Pipeline Workflow
- End-to-End Pipeline: Feed the resulting lyrics directly into
/api/v1/createTaskwithcustom_mode: trueandlyricspopulated. - Dual Creative Variations: Generates 2 distinctive thematic takes on your prompt per request for creative comparison and selection.
- Economical Cost: Consumes 10 credits per generation task. If request validation fails, credits are never deducted.
Validation Rules & Constraints
Prompt Length (Max 200 chars)
The prompt field is strictly required and must not exceed 200 characters. Keep prompts focused on genre, central story theme, and mood.
Asynchronous Webhook
Provide a valid callBackUrl to be notified as soon as lyric synthesis finishes, or poll via taskId.
Authentication & Headers
| Header | Requirement | Description |
|---|---|---|
| Authorization | required | Bearer YOUR_API_KEY Secret API key generated in your dashboard. |
| Content-Type | required | application/json Request body format. |
Request Body Parameters
3 fieldspromptstringrequiredText description of the desired lyrics (theme, story, mood, genre, or specific song concept). Maximum 200 characters.
taskTypestringoptionalExplicit task routing identifier. Can be set to "generate_lyrics".
callBackUrlstringoptionalPublic HTTPS webhook URL to receive asynchronous completion notification when lyrics generation completes.
When Callbacks Are Sent
The SongMesh API automatically triggers an HTTP POST request to your designated callBackUrl under these events:
- Lyrics generation task received and queued in language model pipeline
- Structured rhyme scheme and musical phrasing analyzed
- Two distinct lyric variants composed with section tags ([Verse], [Chorus], [Bridge])
- Webhook notification dispatched with lyric text and titles (code: 200)
Webhook Payload Format
{
"code": 200,
"msg": "All generated successfully.",
"data": {
"callbackType": "complete",
"task_id": "3b66882fde0a5d398bd269cab6d9542b",
"data": [
{
"title": "Neon Shadows in the Rain",
"text": "[Verse 1]\nFluorescent signs reflect upon the street\nWalking through the rain with tired feet\nA holographic memory of your face\nFading slowly in this crowded place\n\n[Chorus]\nNeon shadows dancing in the night\nSearching for a spark of guiding light\nLost inside the silicon and steel\nWondering if anything we had was real\n\n[Verse 2]\nSynthesizers humming in the dark\nLooking for an unexpected spark\n\n[Bridge]\nBetween the circuits and the code\nWe found a solitary road\n\n[Outro]\nFading neon... gone away...",
"status": "complete",
"error_message": ""
},
{
"title": "Cyberpunk Heartbeat",
"text": "[Verse 1]\nSkyline burning with electric blue\nEvery corner reminds me of you\n\n[Chorus]\nHeartbeat syncing to the bass\nLost forever in cyberspace...",
"status": "complete",
"error_message": ""
}
]
}
}Callback Payload Fields
| Field | Type | Description |
|---|---|---|
code | integer | HTTP status code (200: Success, 400: Prompt validation error, 500: Server error). |
msg | string | Execution status message ("All generated successfully." or error details). |
data.task_id | string | Unique task identifier assigned to the lyric generation request. |
data.callbackType | string | Callback event type identifier ("complete"). |
data.data | array | Array containing 2 generated song lyric variants with formatted section tags ([Verse], [Chorus], [Bridge], [Outro]). |
Receiver Implementation Example
// Next.js App Router Webhook Receiver (/api/webhook/suno/route.ts)
import { NextRequest, NextResponse } from 'next/server';
export async function POST(req: NextRequest) {
const payload = await req.json();
const { code, msg, data } = payload;
if (code === 200 && Array.isArray(data?.data)) {
console.log(`Lyrics task ${data.task_id} generated successfully!`);
data.data.forEach((variant: any, idx: number) => {
console.log(`Variant ${idx + 1}: "${variant.title}"`);
console.log(variant.text);
// Directly feed this variant.text into Suno Music Generation:
// POST /api/v1/createTask with custom_mode: true & lyrics: variant.text
});
} else {
console.error(`Lyrics generation failed (${code}): ${msg}`);
}
return NextResponse.json({ received: true });
}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.
curl -X POST "https://api.sunoapi.top/api/v1/createTask" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskType": "generate_lyrics",
"prompt": "An emotional synthwave ballad about lost love in a neon cyberpunk metropolis",
"callBackUrl": "https://api.yourdomain.com/webhook/suno"
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "5c7901ab2c3d4e5f6a7b8c9d0e1f2a3b"
}
}• Style Guidance: Include genre and emotional tone in the prompt (e.g. "Pop ballad about overcoming doubt, uplifting chorus").
• Direct Generation: Take the returned formatted lyrics and feed them into the Generate Music endpoint with custom_mode: true.
• Pricing: 10 credits per generation job.
Ready to compose structured song lyrics?
Generate your API key and create rhyming, production-ready lyrics in seconds.