Music

Start a music generation

Queues a song and returns 202 with the job. Poll GET /api/v1/music-generations/{id} until state is succeeded, failed, blocked or cancelled. A finished song is saved to your Files with the generated tag (if that save fails it is kept outside Files and output.file_id is null). On success, output.availability says whether it can be downloaded: ready means output.url is a signed download URL valid for 15 minutes (re-fetch the job for a fresh one); pending_scan means the saved file is still being scanned, so keep re-fetching the job (self-hosted installs can stay here for up to ~30 minutes); unavailable means the file was blocked or deleted and output.url will never be set, so stop polling. Credits for the model's price are reserved up front and settled on completion; a failed or cancelled job is not charged. A blocked job is not charged either, unless the provider generated the song before rejecting it and billed it: then the price is charged and credits.settled shows it. Send an Idempotency-Key header (1-255 printable ASCII characters) to make retries safe: a repeat with the same key and body returns the original job, and the same key with a different body is a 422 idempotency_key_reused. Omitted fields take the model defaults from GET /api/v1/music-models. Set organization_id to bill an organization you belong to, or null to bill your personal credits; omitted, the job bills your home organization (or your personal credits if you have none). Keys are scoped to the billed account, so the same key sent for a different organization_id starts a new job. An organization-billed API key always bills its own organization (see organization_id).

post/api/v1/music-generations

Request

  • Base URL: https://your-deployment.example.com
  • URL: https://your-deployment.example.com/api/v1/music-generations
  • Auth: one of:
    • HTTP bearer
    • API key in header x-api-key

Request body

modelstring required

A model id from GET /api/v1/music-models.

promptstring required

The style, mood and subject of the song.

lyricsstring

Lyrics to sing. Only for models whose lyrics is not null, within that model's limits.

instrumentalboolean

true for no vocals. Defaults to false, or to true for an instrumental-only model.

duration_secondsinteger

Whole seconds. Defaults to the model's default; see the model's duration for how it is honoured.

organization_idstring nullable

The organization to bill: one you belong to, or null for your personal credits. Omitted bills your home organization, or your personal credits if you have none. An organization-billed API key always bills its own organization: omit this or set it to the key's organization; any other value, null included, is rejected with a 403 (errorCode: billing_organization_mismatch).

Example request

{
  "model": "lyria-3.5",
  "prompt": "An upbeat synth-pop song about a road trip at sunrise"
}

Response

Accepted; the job is queued (or replayed for a repeated Idempotency-Key).

idstring required
object'music_generation' required
state'pending' | 'running' | 'storing' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' required
modelstring required
promptstring required
lyricsstring nullable required

The lyrics you sent, or null.

instrumentalboolean required
duration_secondsnumber required

The length requested (the model default when omitted).

source'api' | 'studio' | 'agent' required
created_atstring required
updated_atstring required

Example response

{
  "id": "664f1c2b9a1e4d0012ab34cd",
  "object": "music_generation",
  "state": "pending",
  "model": "lyria-3.5",
  "prompt": "An upbeat synth-pop song about a road trip at sunrise",
  "lyrics": null,
  "instrumental": false,
  "duration_seconds": 120,
  "source": "api",
  "error": null,
  "output": null,
  "credits": {
    "reserved": 160,
    "settled": null
  },
  "created_at": "2026-10-14T00:00:00.000Z",
  "updated_at": "2026-10-14T00:00:00.000Z"
}

Changes

No recorded changes to this operation across all 1 revision of this API.