/blog / generate-song-one-api-call

How to generate a full song with one API call

By the end of this guide you’ll have a finished MP3 — vocals, instruments, and all — generated from a single text prompt. Total time: about five minutes, one of which is the song rendering.

1. Get an API key

Sign up at songapi.dev — no waitlist, no card required — every account includes a sandbox key for testing. Your keys are on the dashboard immediately. Export it so the snippets below work as-is:

export SONGAPI_KEY="sk_live_..."

2. Send a prompt

One request starts a generation. Describe genre, mood, and subject — or pass your own lyrics with the lyrics field. Set instrumental: true if you don’t want vocals.

curl https://api.songapi.dev/v1/generate \
  -H "Authorization: Bearer $SONGAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "upbeat indie pop song about summer road trips",
    "instrumental": false
  }'

The same request in Node:

const res = await fetch("https://api.songapi.dev/v1/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SONGAPI_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    prompt: "upbeat indie pop song about summer road trips",
    instrumental: false
  })
});
const { id } = await res.json();

And in Python:

import os, requests

res = requests.post(
    "https://api.songapi.dev/v1/generate",
    headers={"Authorization": f"Bearer {os.environ['SONGAPI_KEY']}"},
    json={
        "prompt": "upbeat indie pop song about summer road trips",
        "instrumental": False,
    },
)
gen_id = res.json()["id"]

The response is a 202 Accepted — generation happens in the background:

{
  "id": "gen_h2vJk8PqXw4RtY7NcAbD",
  "object": "generation",
  "type": "generate",
  "status": "queued",
  "prompt": "upbeat indie pop song about summer road trips",
  "model": "v5",
  "credits": 11,
  "clips": null,
  "audio_url": null,
  "created_at": "2026-07-22T03:47:00.000Z"
}

3. Poll for the result

Check the generation status every few seconds (or register a webhook and skip polling entirely):

curl https://api.songapi.dev/v1/generations/gen_h2vJk8PqXw4RtY7NcAbD \
  -H "Authorization: Bearer $SONGAPI_KEY"

When status flips to "complete", the payload includes both variations in clips, plus a top-level audio_url pointing at the first one:

{
  "id": "gen_h2vJk8PqXw4RtY7NcAbD",
  "status": "complete",
  "duration_secs": 167,
  "audio_url": "https://cdn.songapi.dev/gen_h2vJk8.../clip_1.mp3",
  "clips": [
    {
      "id": "clip_9sK2mWq7RtY4NcAbD3vJ",
      "audio_url": "https://cdn.songapi.dev/gen_h2vJk8.../clip_1.mp3",
      "duration_secs": 167,
      "lyrics": "Windows down, radio loud...",
      "title": "Summer Road Trips"
    },
    { "...": "second variation" }
  ]
}

TIP Every generation returns two variations in clips for the same 11 credits — listen to both before deciding which one ships.

4. Where to go from here

The same track can now be pushed further with the rest of the pipeline:

One generation costs 11 credits and includes two variations — see pricing for pack sizes. Credits never expire, and the sandbox key that comes with every account exercises every endpoint above for free.

Ready to try it yourself?

$5 gets you 1,000 credits — and they never expire.

[ get your API key ][ see pricing ]