> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snapgen.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow Music Download

> Export a Flow Music clip as MP3 or WAV. $0.03 per request.

`flow-music-download` exports one of your clips as an MP3 or WAV file.

| Property | Value |
| - | - |
| Model ID | `flow-music-download` |
| Endpoint | `POST /v1/music/generations` (asynchronous task) |
| Group | Flow Music |
| Input | A clip from one of your earlier tasks and a format |
| Result | A file URL in `result.urls` |
| Price | \$0.03 per request (3 credits) |

Confirm live rates on the [SnapGen models page](https://snapgen.org/models). Failed tasks are not charged.

<ParamField body="model" type="string" required>
  Set to `flow-music-download`.
</ParamField>

<ParamField body="source_task_id" type="string" required>
  The `id` of your earlier task that holds the source clip. It must be your own task, must have succeeded, and must come from a model listed in [Source tracks](#source-tracks).
</ParamField>

<ParamField body="source_index" type="integer" default="1">
  Position of the source clip in that task's `result.tracks`, counting from `1` (up to `8`).
</ParamField>

<ParamField body="format" type="string" required>
  `mp3` (smaller, lossy) or `wav` (lossless).
</ParamField>

<ParamField body="webhook" type="string">
  Optional public `https` URL that receives one signed event when the task finishes. See [Task webhooks](/api-reference/webhooks).
</ParamField>

<ParamField body="webhook_secret" type="string">
  Required with `webhook`: 16 to 256 characters, used to sign the delivery.
</ParamField>

## Source tracks

The source task must be your own succeeded task from one of these models:

[`flow-music`](/api-manual/audio/flow-music), [`flow-music-extend`](/api-manual/audio/flow-music-extend), [`flow-music-replace`](/api-manual/audio/flow-music-replace), [`flow-music-cover`](/api-manual/audio/flow-music-cover), [`flow-music-upload`](/api-manual/audio/flow-music-upload).

Send the task `id` as `source_task_id` and pick the clip with `source_index`. Each Flow Music task returns one clip, so `source_index` is normally `1`. Never send provider track or clip IDs. See [Reference earlier tasks](/api-reference/music-generations#reference-earlier-tasks).

## Request

```bash theme={null}
curl https://api.snapgen.org/v1/music/generations \
  -H "Authorization: Bearer $SNAPGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flow-music-download",
    "source_task_id": "task_2f8KcX1mQpR7vT0yZa9Lb3",
    "format": "wav"
  }'
```

The response is HTTP `202` with a task object and a `Location: /v1/tasks/{id}` header. Poll [`GET /v1/tasks/{id}`](/api-reference/task-status) every 10 to 20 seconds until `status` is `succeeded` or `failed`.

## Result

The exported file is in `result.tracks[0].audio_url` and `result.urls[0]`, with its actual `format` and `mime_type`.

```json theme={null}
{
  "urls": [
    "https://cdn.example.com/music/morning-drive.wav"
  ],
  "tracks": [
    {
      "index": 1,
      "id": "a41aade4-993e-4d28-b56f-d97e7ef7167c",
      "audio_url": "https://cdn.example.com/music/morning-drive.wav",
      "format": "wav",
      "mime_type": "audio/wav"
    }
  ]
}
```

<Note>
  Result URLs are kept for about 72 hours. Download the files you want to keep.
  See [Music generation tasks](/api-reference/music-generations) for the task lifecycle, result fields, webhooks, and errors.
</Note>
