apicheats.dev elevenlabs/llms.txt Raw .md
POST

/v1/music/plan

ElevenLabs API

Generate Composition Plan

Base URL
https://api.elevenlabs.io
Auth
xi-api-key: <ELEVENLABS_API_KEY>
Last verified
2026-09-03 · upstream hash matched
Actions
Agents: curl -H "Accept: text/markdown" this URL
→ 216 tokens · Vary: Accept

Critical gotchas

Authentication uses the non-standard xi-api-key header, not Authorization: Bearer. Sending a Bearer token returns HTTP 401.

Text-to-speech responses are raw binary audio, not JSON. Write the body to a file (--output speech.mp3) rather than parsing it.

cURL

curl -X POST 'https://api.elevenlabs.io/v1/music/plan' \  -H "xi-api-key: $ELEVENLABS_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "prompt": "string",  "music_length_ms": 0,  "source_composition_plan": {    "negative_global_styles": [      "metal",      "hip-hop",      "country"    ],    "positive_global_styles": [      "pop",      "rock",      "jazz"    ],    "sections": [      {        "duration_ms": 10000,        "lines": [          "Verse 1 lyrics"        ],        "negative_local_styles": [          "metal",          "hip-hop",          "country"        ],        "positive_local_styles": [          "pop",          "rock",          "jazz"        ],        "section_name": "Verse 1"      }    ]  },  "model_id": "music_v1"}'
Get a free ElevenLabs API key → sponsored

Parameters

Name In Type Required Description
prompt body string Yes A simple text prompt to compose a plan from.
music_length_ms body integer No The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt.
source_composition_plan body object No An optional composition plan to use as a source for the new composition plan.
model_id body string No Request body field model_id.

Response 200 OK

{
  "negative_global_styles": [
    "metal",
    "hip-hop",
    "country"
  ],
  "positive_global_styles": [
    "pop",
    "rock",
    "jazz"
  ],
  "sections": [
    {
      "duration_ms": 10000,
      "lines": [
        "Verse 1 lyrics"
      ],
      "negative_local_styles": [
        "metal",
        "hip-hop",
        "country"
      ],
      "positive_local_styles": [
        "pop",
        "rock",
        "jazz"
      ],
      "section_name": "Verse 1"
    }
  ]
}