Output endpoints — stems, WAV, batch

Once you've generated a track, these endpoints turn it into production-ready assets: split it into stems, export lossless WAV, or run many generations in one call. Exact request/response schemas live in the interactive API reference; this guide covers when to use each, what it costs, and how the audio is delivered.

All audio URLs returned by these endpoints are served from MusicAPI's own CDN with stable, hot-linkable URLs — you can store or stream them directly.

Stems (vocal / instrument separation)

Split an existing clip into separate tracks. Two tiers:

| Endpoint | Output | Credits | |---|---|---| | POST /api/v1/sonic/stems/basic | Vocals + instrumental (2 stems) | 15 | | POST /api/v1/sonic/stems/full | Full multi-stem separation | 75 |

Both take a clip_id from a prior generation. Separation runs asynchronously — poll GET /api/v1/sonic/task/{id} for the result, same as generation.

curl -X POST https://api.musicapi.ai/api/v1/sonic/stems/basic \
  -H "Authorization: Bearer $MUSICAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "clip_id": "your_clip_id" }'

Use basic when you only need to duck the music under a voiceover; use full when you need per-instrument control (remixing, adaptive game audio).

WAV export

Export an existing clip as a lossless WAV file.

| Endpoint | Output | Credits | |---|---|---| | POST /api/v1/sonic/wav | WAV file (CDN URL) | 2 |

curl -X POST https://api.musicapi.ai/api/v1/sonic/wav \
  -H "Authorization: Bearer $MUSICAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "clip_id": "your_clip_id" }'

The WAV is returned from our CDN with a stable URL, so you can archive or hot-link it without re-exporting.

Batch generation

Submit multiple generation requests in a single call and collect them together — useful for backends that generate per-scene, per-level, or per-variant.

| Endpoint | Notes | Credits | |---|---|---| | POST /api/v1/sonic/batch | Up to 10 items per batch | Sum of each item's per-call cost | | GET /api/v1/sonic/batch?id={batch_id} | Aggregated status for all items | Free (polling) |

Each item is processed exactly like a single call, so per-item credit charges, automatic refunds on upstream failure, and per-task webhooks all behave identically — a batch of 10 create items costs 10 × 15 = 150 credits.

curl -X POST https://api.musicapi.ai/api/v1/sonic/batch \
  -H "Authorization: Bearer $MUSICAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "items": [ { "prompt": "lofi beat" }, { "prompt": "synthwave" } ] }'

Credits at a glance

| Operation | Credits | |---|---| | Stems (basic) | 15 | | Stems (full) | 75 | | WAV export | 2 | | Batch | sum of per-item costs |

Failed upstream tasks are auto-refunded. Polling task status is free. See the full credits usage guide for every operation's cost.