API REFERENCE
Compose music
On this page
/api/music/composeGenerate a song from a text prompt or a composition plan. The prompt can describe mood, genre, instruments, lyrics, and structure. Alternatively, pass a full composition_plan for fine-grained control over sections, styles, and lyrics. Returns binary audio in the requested format (default MP3).
Authentication
x-api-key in header
bearerAuth bearer
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/music/compose' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "string",
"composition_plan": {},
"duration": 30,
"output_format": "mp3_44100_192",
"sign_with_c2pa": false
}'Request body required
Music composition parameters
application/json
promptstringText prompt describing the desired song — mood, genre, instruments, lyrics, structure.
composition_planobjectFull composition plan for fine-grained control over sections, styles, and lyrics. Use POST /api/music/plan to generate one.
durationnumberDesired duration in seconds.
Default: 30
output_formatstringAudio output format (e.g. mp3_44100_192).
Default: "mp3_44100_192"
sign_with_c2pabooleanSign the output with C2PA content credentials.
Default: false
Responses
200Audio generated successfully+
song-idresponse headerUnique identifier for the generated song
audio/mpeg
string
400Validation failed — invalid or missing request body fields+
application/json
errorstringrequiredError message describing what went wrong.
401Unauthorized — invalid or missing API key+
application/json
errorstringrequiredError message describing what went wrong.
500Internal server error+
application/json
errorstringrequiredError message describing what went wrong.
Full specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download content.jsonView operation source
{
"description": "Generate a song from a text prompt or a composition plan. The prompt can describe mood, genre, instruments, lyrics, and structure. Alternatively, pass a full composition_plan for fine-grained control over sections, styles, and lyrics. Returns binary audio in the requested format (default MP3).",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"requestBody": {
"description": "Music composition parameters",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MusicComposeRequest"
}
}
}
},
"responses": {
"200": {
"description": "Audio generated successfully",
"headers": {
"song-id": {
"schema": {
"type": "string"
},
"description": "Unique identifier for the generated song"
}
},
"content": {
"audio/mpeg": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"400": {
"description": "Validation failed — invalid or missing request body fields",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MusicErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized — invalid or missing API key",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MusicErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MusicErrorResponse"
}
}
}
}
}
}