메인 콘텐츠로 건너뛰기
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",
    "clip_id": "abc123-def456",
    "start_s": 10,
    "end_s": 20,
    "instruction": "피아노 버전으로 교체"
  }'
import requests

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

payload = {
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "start_s": 10,
    "end_s": 20,
    "instruction": "피아노 버전으로 교체"
}

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",
  clip_id: "abc123-def456",
  start_s: 10,
  end_s: 20,
  instruction: "피아노 버전으로 교체"
};

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": "잔액이 부족합니다",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "현재 그룹 용량이 포화 상태입니다. 잠시 후 다시 시도해 주세요",
    "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",
    "clip_id": "abc123-def456",
    "start_s": 10,
    "end_s": 20,
    "instruction": "피아노 버전으로 교체"
  }'
import requests

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

payload = {
    "model": "flowmusic",
    "clip_id": "abc123-def456",
    "start_s": 10,
    "end_s": 20,
    "instruction": "피아노 버전으로 교체"
}

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",
  clip_id: "abc123-def456",
  start_s: 10,
  end_s: 20,
  instruction: "피아노 버전으로 교체"
};

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": "잔액이 부족합니다",
    "type": "invalid_request",
    "param": "",
    "code": "quota_not_enough"
  }
}
{
  "error": {
    "message": "현재 그룹 용량이 포화 상태입니다. 잠시 후 다시 시도해 주세요",
    "type": "rate_limit_error",
    "param": "",
    "code": "rate_limit_error"
  }
}

인증

Authorization
string
필수
모든 API는 Bearer Token 인증이 필요합니다API Key 발급:API Key 관리 페이지에서 API Key를 발급받으세요사용 시 요청 헤더에 다음을 추가하세요:
Authorization: Bearer YOUR_API_KEY

요청 파라미터

model
string
필수
모델 이름, "flowmusic" 고정값(대소문자 구분 없음)
clip_id
string
필수
원본 음악 clip_id, 성공한 작업의 result.music[].clip_id에서 가져옵니다
start_s
number
필수
교체 시작 시간(초)
end_s
number
필수
교체 종료 시간(초)
end_sstart_s보다 커야 하며, 원본 clip 길이를 초과할 수 없습니다.
instruction
string
필수
교체 구간에 대한 편집 지시예시: "피아노 버전으로 교체"
title
string
교체 후 음악 제목
seed
integer
결과 재현 또는 생성 결과 제어에 사용하는 랜덤 시드

응답

code
integer
응답 상태 코드, 성공 시 200
data
array
반환 데이터 배열

사용 시나리오

시나리오 1: 10-20초 구간을 피아노 버전으로 교체

{
  "model": "flowmusic",
  "clip_id": "abc123-def456",
  "start_s": 10,
  "end_s": 20,
  "instruction": "피아노 버전으로 교체"
}
작업 결과 조회구간 교체는 비동기 작업으로, 제출 후 task_id가 반환됩니다. 작업 상태 조회 API로 생성 진행 상황과 결과를 확인하세요. 교체 결과물은 새로운 clip_id입니다(곡 전체가 다시 출력되며, 지정한 구간이 교체됨). 이후 작업에는 새 clip_id를 사용하세요.

작업 완료 결과 예시

조회 응답 예시(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"
        }
      ]
    }
  }
}