Skip to main content

Upload Music

POST 

https://api.knoxstudio.ai/v1/music/upload

Upload audio to obtain a song_id for inpainting. Price matches song generation ($0.20/min). Uploads are inspected for copyright; if copyrighted content is detected, half the cost is still charged. Multipart body, max 210MB.

Request​

Request Headers​

NameTypeRequiredDescription
AuthorizationStringYesBearer <token> Knox API key. xi-api-key is also accepted.
Content-TypeStringYesmultipart/form-data.

Request Body (multipart/form-data)​

NameTypeRequiredDescription
fileFileYesAudio file to upload.
extract_composition_planBoolean or StringNoExtract a plan. Pass music_v1 / music_v2 / music_v2_5 for format. true/false is deprecated (true → v1). Increases latency.
with_timestampsBooleanNoTranscribe word-level timestamps. Increases latency.
with_waveform_visualBooleanNoInclude a visual waveform.

cURL Example​

curl -X POST https://api.knoxstudio.ai/v1/music/upload \
-H "Authorization: Bearer $KNOXCHAT_API_KEY" \
-F "file=@track.mp3" \
-F "extract_composition_plan=music_v2_5" \
-F "with_timestamps=true"

Response​

Success Response (200)​

NameTypeDescription
song_idstringID to use in composition_plan inpainting refs.
composition_planobjectPresent when extract_composition_plan is set.
words_timestampsarrayPresent when with_timestamps is true: word, start_ms, end_ms.

Error Responses​

Validation uses HTTP 422:

{
"detail": [
{
"loc": ["body", "field"],
"msg": "…",
"type": "value_error"
}
]
}

Other errors use { "detail": "message" }.

StatusWhen
400WebSocket path called without Upgrade: websocket.
401Missing or invalid API key.
402Insufficient credits.
403Token is not allowed to use this model.
404Resource not found.
422Validation error.
429Rate limit exceeded.
500Internal server error.