Skip to main content

Overview

Every Soundpiece operation follows the same pattern:
  1. Submit a request — receive an operation id and status: processing.
  2. Poll the same endpoint (or wait for a webhook) until status is ready or failed.
  3. Download the audio using the signed URL in the response.
This guide walks through a complete example: generating a song from lyrics and a prompt.

Step 1: Get your API key

API keys are issued from your account dashboard. Each key comes paired with a webhook signing secret. Both are shown once at creation — save them somewhere safe. Keys start with the prefix spk_ — the prefix is part of the key, so use the value exactly as the dashboard shows it. Pass yours as a Bearer token on every request:
Anyone with your key can use your account. Never embed it in client-side or mobile application code. If a key is exposed, revoke it from the dashboard and create a new one.

Step 2: Submit a song generation request

Pass an idempotency_key (a UUID you choose) so you can safely retry the request over an unreliable network.
Response
The id (operation id) is the handle you’ll use to fetch the result. Notice that the request you sent is echoed back on the response — useful for keeping the request and its outcome together without your own bookkeeping.

Step 3: Poll until the operation is ready

Call the same endpoint with GET and the operation id. Pass ?wait=true to long-poll for up to 20 seconds — the server returns as soon as the operation reaches ready or failed, or after 20 seconds if it is still running. Repeat until you get a terminal status.
Response when ready
Song generation typically produces multiple variations — each appears as a separate entry in outputs.
For production workloads, use webhooks so you don’t have to poll. Supply a callback_url on the original PUT and we’ll post the same response to that URL when the operation terminates. Polling remains the canonical source of truth — see Async operations.

Step 4: Download the audio

Each output carries a signed URL you can GET to download the audio as a FLAC file (44.1 kHz). The URL is time-limited; check the expires_at field. If it has expired, call the GET endpoint again — we’ll generate a fresh URL.
No auth header is needed on the download — the signed URL is self-authenticating until it expires.
That’s it. The same pattern applies to every endpoint:
  • PUT /v1/create.new_song — generate a song from lyrics + prompt or reference.
  • PUT /v1/create.new_instrumental — generate an instrumental from a prompt or reference.
  • PUT /v1/create.new_sample — generate a short sample at a target duration.
  • PUT /v1/create.new_fx — generate a one-shot effect.
  • PUT /v1/create.remix_song — remix an existing song (with vocals/lyrics) into new song variations, guided by lyrics and prompt.
  • PUT /v1/create.remix_instrumental — remix an existing instrumental track into new instrumental variations.
  • PUT /v1/adapt.separate_stems — separate a track into vocals, drums, bass, other.
  • PUT /v1/adapt.auto_cut_down — trim a track to a target duration at musically natural cut points.
See the API Reference for the full surface, or read on for authentication, async operations, webhooks, errors, rate limits, and versioning.