API REFERENCE
Stream music
On this page
/api/music/streamGenerate a song and stream audio chunks in real time. Use this endpoint when you want to begin playback before the full song is generated. The response streams binary audio chunks as they are produced.
Authentication
x-api-key in header
bearerAuth bearer
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/music/stream' \
--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 streaming 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 stream started 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 and stream audio chunks in real time. Use this endpoint when you want to begin playback before the full song is generated. The response streams binary audio chunks as they are produced.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"requestBody": {
"description": "Music streaming parameters",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MusicStreamRequest"
}
}
}
},
"responses": {
"200": {
"description": "Audio stream started 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"
}
}
}
}
}
}