curl --request POST \
--url https://api.apimart.ai/v1/music/generations/replaceFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/replaceFlowMusic"
payload = {
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}
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/replaceFlowMusic";
const payload = {
model: "flowmusic",
version: "lyria-3.5",
clip_id: "abc123-def456",
start_s: 10,
end_s: 20,
instruction: "Replace with a piano version"
};
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_01KWXVHGTG5JM33S8FG1K90YQ6"
}
]
}
{
"error": {
"message": "end_s must be greater than start_s",
"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"
}
}
Flow Music
Lyria 3.5 Replace Section
Use Lyria 3.5 to replace a specified section of previously generated audio
POST
/
v1
/
music
/
generations
/
replaceFlowMusic
curl --request POST \
--url https://api.apimart.ai/v1/music/generations/replaceFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/replaceFlowMusic"
payload = {
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}
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/replaceFlowMusic";
const payload = {
model: "flowmusic",
version: "lyria-3.5",
clip_id: "abc123-def456",
start_s: 10,
end_s: 20,
instruction: "Replace with a piano version"
};
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_01KWXVHGTG5JM33S8FG1K90YQ6"
}
]
}
{
"error": {
"message": "end_s must be greater than start_s",
"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/replaceFlowMusic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}'
import requests
url = "https://api.apimart.ai/v1/music/generations/replaceFlowMusic"
payload = {
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}
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/replaceFlowMusic";
const payload = {
model: "flowmusic",
version: "lyria-3.5",
clip_id: "abc123-def456",
start_s: 10,
end_s: 20,
instruction: "Replace with a piano version"
};
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_01KWXVHGTG5JM33S8FG1K90YQ6"
}
]
}
{
"error": {
"message": "end_s must be greater than start_s",
"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
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 version, must be
"lyria-3.5"Lyria 3.5 still uses
flowmusic as the model name. Do not change model to lyria-3.5 or flowmusic-lyria-3.5.Replacement end time (seconds)
end_s must be greater than start_s and cannot exceed the source clip’s duration.Response
Use Cases
Scenario 1: Replace seconds 10-20 with a piano version
{
"model": "flowmusic",
"version": "lyria-3.5",
"clip_id": "abc123-def456",
"start_s": 10,
"end_s": 20,
"instruction": "Replace with a piano version"
}
Query Task ResultsSection replacement is an asynchronous task; a
task_id is returned after submission. Use the Get Task Status endpoint to query generation progress and results. The replacement output is a new clip_id (the whole song is re-rendered with the specified segment replaced); 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_01KWXVHGTG5JM33S8FG1K90YQ6",
"status": "completed",
"progress": 100,
"created": 1783413392,
"completed": 1783413454,
"actual_time": 62,
"cost": 0.048,
"credits_cost": 0.48,
"result": {
"music": [
{
"clip_id": "9508d1fe-633e-464b-8a40-c6368e5464fa",
"title": "Untitled (Replaced)",
"duration_seconds": "181.58933333",
"create_time": "2026-07-07T08:37:13.864452Z",
"lyrics": "[Verse 1]\nWaking up to the morning light,\n...",
"lyrics_id": "c302d603-81b6-552f-8122-e512928d6aa1",
"lyrics_timing_markers": [[10, 12], [71, 15]],
"audio_url": "https://cdn.apimart.ai/audio/flowmusic_9508d1fe.m4a",
"wav_url": "https://cdn.apimart.ai/audio/flowmusic_9508d1fe.wav",
"image_url": "https://cdn.apimart.ai/image/flowmusic_9508d1fe_cover.jpg"
}
]
}
}
}