Skip to main content
POST
/
v1
/
music
/
generations
/
extendFlowMusic
curl --request POST \
  --url https://api.apimart.ai/v1/music/generations/extendFlowMusic \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "extend_from_s": 30,
    "extend_s": 60,
    "instruction": "Continue the verse melody, add strings"
  }'
import requests

url = "https://api.apimart.ai/v1/music/generations/extendFlowMusic"

payload = {
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "extend_from_s": 30,
    "extend_s": 60,
    "instruction": "Continue the verse melody, add strings"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://api.apimart.ai/v1/music/generations/extendFlowMusic";

const payload = {
  model: "flowmusic",
  clip_id: "abc123-def456",
  extend_from_s: 30,
  extend_s: 60,
  instruction: "Continue the verse melody, add strings"
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KWXVCYB70YJ1WY9X22RVYRNP"
    }
  ]
}
{
  "error": {
    "message": "clip_id is required",
    "type": "invalid_request",
    "param": "",
    "code": "invalid_request"
  }
}
{
  "error": {
    "message": "Insufficient balance",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "Current group capacity is saturated, please retry later",
    "type": "rate_limit_error",
    "param": "",
    "code": "rate_limit_error"
  }
}
curl --request POST \
  --url https://api.apimart.ai/v1/music/generations/extendFlowMusic \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "extend_from_s": 30,
    "extend_s": 60,
    "instruction": "Continue the verse melody, add strings"
  }'
import requests

url = "https://api.apimart.ai/v1/music/generations/extendFlowMusic"

payload = {
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "extend_from_s": 30,
    "extend_s": 60,
    "instruction": "Continue the verse melody, add strings"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://api.apimart.ai/v1/music/generations/extendFlowMusic";

const payload = {
  model: "flowmusic",
  clip_id: "abc123-def456",
  extend_from_s: 30,
  extend_s: 60,
  instruction: "Continue the verse melody, add strings"
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KWXVCYB70YJ1WY9X22RVYRNP"
    }
  ]
}
{
  "error": {
    "message": "clip_id is required",
    "type": "invalid_request",
    "param": "",
    "code": "invalid_request"
  }
}
{
  "error": {
    "message": "Insufficient balance",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "Current group capacity is saturated, please retry later",
    "type": "rate_limit_error",
    "param": "",
    "code": "rate_limit_error"
  }
}

Authentication

Authorization
string
required
All endpoints require Bearer Token authenticationGet your API Key:Visit the API Key management page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Request Parameters

model
string
required
Model name, must be "flowmusic" (case-insensitive)
clip_id
string
required
Source music clip_id, from a successful task’s result.music[].clip_id
The source task must have succeeded. External audio can first be imported via Upload Audio to obtain a clip_id.
extend_from_s
number
required
Time point (seconds) to start the extension fromCannot exceed the source clip’s duration
extend_s
number
required
Extension duration (seconds)Maximum: 164 seconds
instruction
string
required
Editing instruction for the extended musicExample: "Continue the verse melody, add strings"
title
string
Title of the extended music
seed
string
Random seed, used to reproduce results

Response

code
integer
Response status code, 200 on success
data
array
Array of returned data

Use Cases

Scenario 1: Extend 60 seconds from the chorus

{
  "model": "flowmusic",
  "clip_id": "abc123-def456",
  "extend_from_s": 30,
  "extend_s": 60,
  "instruction": "Continue the verse melody, add strings"
}
Query Task ResultsMusic extension is an asynchronous task; a task_id is returned after submission. Use the Get Task Status endpoint to query generation progress and results. The extension output is a new clip_id; use the new clip_id for subsequent operations.

Completed Task Result Example

Query response example (GET /v1/music/tasks/{task_id}):
{
  "code": 200,
  "data": {
    "id": "task_01KWXVCYB70YJ1WY9X22RVYRNP",
    "status": "completed",
    "progress": 100,
    "created": 1783413242,
    "completed": 1783413292,
    "actual_time": 50,
    "cost": 0.048,
    "credits_cost": 0.48,
    "result": {
      "music": [
        {
          "clip_id": "d2f589ea-5390-4e83-8e2f-4517420408fa",
          "title": "Untitled (Extended)",
          "duration_seconds": "39.95733333",
          "create_time": "2026-07-07T08:34:33.240020Z",
          "lyrics": "waking up to the morning light,\n...",
          "lyrics_id": "0452451b-9e54-5d9f-8437-8bff97c7bbc8",
          "lyrics_timing_markers": [[0, 12], [129, 20]],
          "audio_url": "https://cdn.apimart.ai/audio/flowmusic_d2f589ea.m4a",
          "wav_url": "https://cdn.apimart.ai/audio/flowmusic_d2f589ea.wav",
          "image_url": "https://cdn.apimart.ai/image/flowmusic_d2f589ea_cover.jpg"
        }
      ]
    }
  }
}