Music Generation
Music Generation
Generate music tracks using a variety of models through a single unified endpoint.
POST /v2/music/generate
Submit a prompt to generate a music track. In default mode, the prompt describes the kind of music you want. In custom mode, the prompt is used as lyrics.
Common request body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Music description or lyrics (1–5,000 characters). Some models cap descriptions lower — e.g. Suno limits the prompt to 500 chars in non-custom mode. See the per-model page. |
model | string | Yes | The model identifier (see available models below) |
webhookUrl | string | No | URL to receive webhook notifications |
webhookEvents | string[] | No | Events: "progress", "completed", "failed" |
Each model also accepts its own parameters object — see the individual model pages for details.
Response
Status: 202 Accepted
{
"jobId": "c3d4e5f6-a7b8-9012-cdef-345678901234",
"status": "QUEUED"
}Result format
When the job completes, the result field on GET /v2/jobs/:id (and in the completed webhook payload) is an object with an array of generated tracks:
{
"tracks": [
{
"id": "track_abc123",
"audioUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-0.mp3",
"imageUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-0.jpeg",
"title": "Neon Skyline",
"tags": "synthwave, electronic, upbeat",
"duration": 184.2
}
]
}| Field | Type | Description |
|---|---|---|
tracks | object[] | One entry per generated track. Suno, Udio, and Producer return 2 tracks per request; Mureka returns 1–3 (murekaParams.n, default 2); Lyria and ElevenLabs Music return 1. |
tracks[].id | string | Provider track ID |
tracks[].audioUrl | string | CDN URL of the MP3 file |
tracks[].imageUrl | string | null | CDN URL of the cover art, when the model returns one |
tracks[].title | string | null | Generated track title |
tracks[].tags | string | null | Style tags describing the track |
tracks[].duration | number | null | Track length in seconds |
Each model page shows an example result. Result files are hosted on the APIFRAME CDN for 90 days — download anything you want to keep.
Available models
| Model | Identifier | Description |
|---|---|---|
| Suno | "suno" | Text-to-music and lyrics-to-music generation |
| Mureka | "mureka" | Songs and instrumentals with custom or auto-generated lyrics |
Error responses
| Status | Error | Meaning |
|---|---|---|
400 | Validation error | Invalid parameters |
401 | Unauthorized | Missing or invalid API key |
402 | Insufficient credits | Not enough credits |
503 | Service unavailable | Queue temporarily down |