コンテンツへスキップ
APIリファレンス
APIリファレンス

Suno セクション置換

セクション置換エンドポイントを使用して、非同期タスクを作成します。

01

概要

サポートされているモデルでセクション置換エンドポイントを使用します。返されたタスクIDを使用してその状態を取得するか、以下に記載されている配信のために callback_url を指定してください。

クイックスタート

  1. APIキーを作成し、RUNAPI_API_KEYとして設定します。
  2. サポートされているモデルを選択し、そのモデルのスキーマに一致するボディを持つPOSTリクエストを送信します。
  3. 返されたタスクIDを保存し、終了状態になるまでポーリングするか、以下に記載されているコールバックを処理してください。

エンドポイント

POST /api/v1/suno/replace_section
ベースURL
https://runapi.ai
API バージョン
v1
認証
Authorization: Bearer YOUR_API_TOKEN
02

サポートされているモデル

現在の料金、レート制限、商用利用の詳細については、モデルページを開いてください。

03

リクエストスキーマ

JSONボディ

フィールドと許可される値は選択したモデルによって異なります。指定した場合、callback_urlは以下に記載されたTask配信を受信します。

リクエストボディフィールド12件
audio_idstring
任意

ソースタスク内のオーディオ ID。task_id と併用します。upload_url/model と組み合わせないでください。

callback_urlstring
任意

非同期通知用のWebhook URL。

full_lyricsstring
必須

コンテキストのための完全な曲の歌詞。

範囲(固定): 5000
infill_end_timenumber
必須

セクション終了時刻(秒)。infill_start_timeより大きく、少なくとも10秒の置換時間を生成する必要があります。

infill_start_timenumber
必須

セクション開始時刻(秒)。置換時間は少なくとも10秒でなければなりません。

lyricsstring
必須

置き換え用のセクション歌詞。

範囲(固定): 5000
modelstring
任意

アップロードされたソースオーディオのモデルスラッグ。

許可される値: suno-v4, suno-v4.5, suno-v4.5-all, suno-v4.5-plus, suno-v5, suno-v5.5
negative_tagsstring
任意

回避するスタイル。

tagsstring
必須

スタイルまたはジャンルタグ。

範囲(固定): 1000
task_idstring
任意

ソースタスクID。audio_idと併用します。upload_url/modelと組み合わせないでください。

titlestring
必須

楽曲タイトル。

範囲(固定): 80
upload_urlstring
任意

アップロード済みソース音声URL。modelと併用してください。task_id/audio_idとは組み合わせないでください。

04

承認を作成する

HTTP 202

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

ポーリング処理中

HTTP 200

GET /api/v1/suno/replace_section/:id

レスポンススキーマ
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "track": {
      "properties": {
        "audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "duration": {
          "type": "number"
        },
        "id": {
          "type": "string"
        },
        "image_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "lyrics": {
          "type": "string"
        },
        "model_name": {
          "type": "string"
        },
        "stream_audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

ポーリング完了

HTTP 200

GET /api/v1/suno/replace_section/:id

レスポンススキーマ
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "track": {
      "properties": {
        "audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "duration": {
          "type": "number"
        },
        "id": {
          "type": "string"
        },
        "image_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "lyrics": {
          "type": "string"
        },
        "model_name": {
          "type": "string"
        },
        "stream_audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "track",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "track": {
    "audio_url": "https://file.runapi.ai/reference-audio.mp3",
    "id": "audio_replaced_section"
  }
}
07

ポーリング失敗

HTTP 200

GET /api/v1/suno/replace_section/:id

レスポンススキーマ
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

顧客コールバック: 完了

HTTP 200

POST callback_url

レスポンススキーマ
JSON
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "track": {
      "properties": {
        "audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "duration": {
          "type": "number"
        },
        "id": {
          "type": "string"
        },
        "image_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "lyrics": {
          "type": "string"
        },
        "model_name": {
          "type": "string"
        },
        "stream_audio_url": {
          "type": "string",
          "x-runapi-generated-media": true
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "title": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "track"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "track": {
    "audio_url": "https://file.runapi.ai/reference-audio.mp3",
    "id": "audio_replaced_section"
  }
}
09

顧客コールバック: 失敗

HTTP 200

POST callback_url

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
10

エラー

HTTP 401

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Authentication required"
}
11

エラー

HTTP 401

GET /api/v1/suno/replace_section/:id

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Authentication required"
}
12

エラー

HTTP 400

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人が読めるエラーメッセージ。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人間が読める形式のバリデーションサマリー。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "公開リクエストフィールドをキーとするバリデーションメッセージ。各フィールドに対して人間が読める文字列の配列が含まれます。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

レスポンス例

JSON
{
  "error": "model must be one of: "
}
13

エラー

HTTP 402

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Insufficient balance"
}
14

エラー

HTTP 429

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "API key credit limit exceeded"
}
15

エラー

HTTP 409

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
16

エラー

HTTP 429

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Rate limit reached. Please retry later."
}
17

エラー

HTTP 503

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Service under maintenance, please try again later"
}
18

エラー

HTTP 504

POST /api/v1/suno/replace_section

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "The request timed out"
}
19

エラー

HTTP 404

GET /api/v1/suno/replace_section/:id

レスポンススキーマ
JSON
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

レスポンス例

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
20

生成されたコードサンプル

cURLを直接使用するか、お使いの言語向けのSDKをインストールしてください。各サンプルは、このリファレンスに示されたバリデーション済みリクエストを送信します。

インストール

Shell
pip install runapi-suno
PYTHON
import os
from runapi.suno import SunoClient

client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.replace_section.create(
  upload_url="https://file.runapi.ai/source-audio.mp3",
  model="suno-v5",
  lyrics="New words for this section.",
  tags="acoustic pop",
  title="City Lights",
  infill_start_time=10,
  infill_end_time=20,
  full_lyrics="City lights reflect in the rain. New words for this section."
)