{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 音楽生成",
    "description": "# 概要 (Overview)\nテーマ、歌詞、音楽スタイル（いずれだけでも OK）から 1 曲を丸ごと作曲します。AI 音楽生成のタスクは 1 回で完成曲（mp3）を 1 曲生成し、ジャケット画像、曲名、確定歌詞、歌詞シンクタイムラインと一緒に返します。\n\n* ボーカル曲もインスト曲も：ボーカル入り楽曲、またはボーカル・歌詞なしのインスト音楽（`instrumental: true`）を生成できます。\n* 手元にある素材から始められます：テーマ（`idea`）、自作の歌詞（`lyrics`）、その両方。インスト曲には `idea` が必要です。\n* 歌詞の言語：`idea` の文章リクエストで指定します（例：\"with Japanese lyrics\"）。対応言語は英語、日本語、韓国語、ポルトガル語、スペイン語、ドイツ語、フランス語、イタリア語、繁体字中国語、簡体字中国語、ヒンディー語、トルコ語。\n\n活用例：\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2026-10-15/webp_b29b16b3-6f1f-4f94-b0f3-ef7955d1b3e0.webp)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2026-09-24/webp_90715cdb-e955-4501-9290-0869981b3f43.webp)\n\n---\n\n## 統合ガイド (Integration Guide)\n\n* AI 音楽生成 利用ガイド\n\nこのガイドでは、AI 音楽生成タスクの実行方法と結果の読み方を説明します。\n\n画像も音声も入力しないので、File API は不要です。タスク実行前の「新しいファイル作成」ステップはありません。`idea` か `lyrics` を入力し、`music_style` を選ぶだけで、素晴らしい楽曲が生まれます。\n\n***\n\n   * ステップ 1. タスクを作成する\n\n**AI タスク API**（`/s2s/v2.0/task/ai-song`）に、テーマ、歌詞、音楽スタイル（いずれだけでも可）を渡して実行します：\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-song \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\"idea\":\"A song about a small cafe that stays open late for people who cannot sleep\",\"music_style\":{\"genre\":\"Acoustic Pop\",\"mood\":\"Calm, hopeful\",\"vocal\":\"female\",\"description\":\"soft piano, brushed drums\"},\"instrumental\":false}'\n```\n\nレスポンスにはこのタスクの `task_id` が返ります：\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"task_id\": \"grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe\"\n  }\n}\n```\n\n***\n\n   * ステップ 2. タスク結果をポーリングする\n\n実行レスポンスの `task_id` でステータスを確認します。`task_status` が `success` または `error` になるまで続けます：\n\n```bash\ncurl --request GET \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-song/YOUR_TASK_ID \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json'\n```\n\n***\n\n   * ステップ 3. 結果を取得する\n\n成功時のレスポンスには、楽曲本体に加え、ジャケット画像、タイトル、確定歌詞、歌詞シンクタイムスタンプが含まれます：\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"error\": null,\n    \"results\": {\n      \"url\": \"https://example.com/sample-song-url\",\n      \"cover_urls\": [\n        \"https://example.com/sample-cover-url\"\n      ],\n      \"title\": \"Leave the Light On\",\n      \"lyrics\": \"[verse]\\nTwo a.m., the neon hums\\nSteam on the glass, the night still runs\",\n      \"duration\": 154.3,\n      \"timestamps\": \"{\\\"lyrics_lrc_timestamps\\\": \\\"[00:23.98]Two a.m., the neon hums\\\"}\"\n    },\n    \"task_status\": \"success\"\n  }\n}\n```\n\n---\n\n## 入力と出力 (Inputs & Outputs)\n\n* リクエストボディ\n\n| フィールド | 型 | 説明 |\n|---|---|---|\n| idea | string（最大 500 文字） | 楽曲のテーマ。`instrumental` が `true` の場合は必須。ボーカル曲では `idea`、`lyrics` のどちらか、または両方を指定します。 |\n| lyrics | string（最大 3000 文字） | 楽曲の歌詞。`[intro]`、`[verse]`、`[chorus]`、`[outro]` などのセクションタグに対応しています。 |\n| music_style | object | 楽曲の音楽スタイル：`genre`（最大 100）、`mood`（最大 100）、`vocal`（`female` または `male`、インスト曲では無視されます）、楽器やリズムなどの細か指定に `description`（最大 300）。いずれも任意です。 |\n| instrumental | boolean | `true` で、ボーカル・歌詞なしのインスト音楽を生成。デフォルトは `false`。 |\n\nリクエストは、次のいずれかの方法で楽曲を指定する必要があります：テーマから（`idea` が空でない）、またはボーカル曲の歌詞から（`lyrics` が空でなく、`instrumental` が `true` でない）。\n\n* 結果（`data.results`）\n\n| フィールド | 型 | 説明 |\n|---|---|---|\n| url | string | 生成楽曲（mp3）のダウンロード URL。有効期限は 2 時間 |\n| cover_urls | string 配列 | ジャケット画像（jpg）のダウンロード URL。現在は 1 枚。有効期限は 2 時間 |\n| title | string | AI が生成した楽曲タイトル |\n| lyrics | string | 確定歌詞。インスト曲では空 |\n| duration | number | 楽曲の長さ（秒） |\n| timestamps | string | オブジェクトの JSON エンコード済み文字列。`lyrics_lrc_timestamps` フィールドに LRC 形式の同期歌詞（例：`[00:08.54]Lyrics text`）が入ります。インスト曲では LRC テキストは空 |\n\n---\n\n## ファイル仕様とエラー (File Specs & Errors)\n\n* サポートされる上限\n\n| 種別 | 上限 |\n|---|---|\n| idea（テーマ） | 最大 500 文字。`instrumental` が `true` の場合は必須 |\n| lyrics | 最大 3000 文字。`[intro]`、`[verse]`、`[chorus]`、`[outro]` などのセクションタグに対応 |\n| music_style `genre` / `mood` | それぞれ最大 100 文字 |\n| music_style `description` | 最大 300 文字 |\n| 入力ファイル | なし。画像も音声も入力しないため、File API のステップは不要 |\n| 出力 | 楽曲：mp3。ジャケット画像：jpg。結果 URL の有効期限は 2 時間 |\n\n* エラーコード\n\n| エラーコード | 説明 |\n|---|---|\n| invalid_parameter | パラメータ値が無効。例：`idea` と `lyrics` のどちらも未指定、インストタスクで `idea` 未指定、フィールドが最大長を超過 |\n\n    > タスクレベルの失敗はステータスレスポンスで確認できます：`data.error` がエラーコード、`data.error_message` がエラーの詳細説明です。\n\n---\n\n## ユニット消費 (Unit Consumption)\n\n楽曲タイプ単価で課金されます。\n\n| 楽曲タイプ | 消費ユニット |\n|---|---|\n| ボーカル曲（`instrumental: false`） | 1 曲あたり 10 ユニット |\n| インスト音楽（`instrumental: true`） | 1 曲あたり 20 ユニット |\n\n---\n",
    "version": "",
    "termsOfService": "https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api",
    "contact": {
      "email": "YouCamOnlineEditor_API@perfectcorp.com"
    },
    "license": {
      "name": "Privacy policy",
      "url": "https://www.makeupar.com/perfectbeauty/youcam/privacy-policy-api"
    }
  },
  "servers": [
    {
      "url": "https://yce-api-01.makeupar.com"
    }
  ],
  "tags": [
    {
      "name": "V1.0",
      "description": "AI 音楽生成 API は、テーマ、歌詞、音楽スタイル（いずれだけでも OK）から 1 曲を丸ごと作曲します。1 タスクで完成曲（mp3）をジャケット画像、タイトル、歌詞、歌詞シンクタイムスタンプと一緒に返します。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/ai-song": {
      "post": {
        "summary": "AI 音楽生成タスクを実行します。",
        "description": "AI タスクは非同期です。機能ごとに Webhook がサポートされている場合は、Webhook による完了処理を優先します。Webhook エンドポイントを設定し、Webhook 署名を検証したうえで、`success` または `error` の通知が来たら、受け取った `task_id` を使ってタスクの結果を照会します。設定と検証の詳細は [Webhook 統合ガイド](/develop/webhook.md) を参照してください。\n\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。AI タスクを送信した後、一定の間隔（例：10 秒ごと）でステータスエンドポイントをポーリングし、`success` または `error` になるまで待ちます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idea": {
                    "type": "string",
                    "maxLength": 500,
                    "default": "",
                    "description": "楽曲のテーマ。instrumental が true の場合は必須。ボーカル入り楽曲では idea、lyrics のどちらか、 または両方を指定します。特定の言語の歌詞を希望する場合は、この文章で指定してください（例：\"with Japanese lyrics\"）。",
                    "example": "A song about a small café that stays open late for people who can't sleep"
                  },
                  "lyrics": {
                    "type": "string",
                    "maxLength": 3000,
                    "default": "",
                    "description": "楽曲の歌詞。[intro]、[verse]、[chorus]、[outro] などのセクションタグに対応しています。 対応している歌詞の言語：英語、日本語、韓国語、ポルトガル語、スペイン語、ドイツ語、フランス語、 イタリア語、繁体字中国語、簡体字中国語、ヒンディー語、トルコ語。",
                    "example": "[verse]\nTwo a.m., the neon hums\nSteam on the glass, the night still runs\n\n[chorus]\nLeave the light on, leave the light on\nFor the ones who don't go home"
                  },
                  "music_style": {
                    "type": "object",
                    "description": "楽曲の音楽スタイル。すべてのフィールドは任意です。",
                    "properties": {
                      "genre": {
                        "type": "string",
                        "maxLength": 100,
                        "description": "楽曲のジャンル。例：Pop、Lo-fi Hip Hop",
                        "example": "Acoustic Pop"
                      },
                      "mood": {
                        "type": "string",
                        "maxLength": 100,
                        "description": "楽曲のムード。例：Calm、Uplifting",
                        "example": "Calm, hopeful"
                      },
                      "vocal": {
                        "type": "string",
                        "enum": [
                          "female",
                          "male"
                        ],
                        "description": "ボーカルタイプ。instrumental が true のときは無視されます。",
                        "example": "female"
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 300,
                        "description": "楽器やリズムなどのその他の指定。",
                        "example": "soft piano, brushed drums"
                      }
                    }
                  },
                  "instrumental": {
                    "type": "boolean",
                    "default": false,
                    "description": "true にすると、ボーカル・歌詞なしのインスト音楽を生成します。",
                    "example": false
                  }
                },
                "anyOf": [
                  {
                    "title": "テーマから作る楽曲",
                    "required": [
                      "idea"
                    ],
                    "properties": {
                      "idea": {
                        "minLength": 1
                      }
                    }
                  },
                  {
                    "title": "歌詞から作るボーカル曲",
                    "required": [
                      "lyrics"
                    ],
                    "properties": {
                      "lyrics": {
                        "minLength": 1
                      },
                      "instrumental": {
                        "enum": [
                          false
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "タスクの実行に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "タスクの実行に失敗しました",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/RunError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/s2s/v2.0/task/ai-song/{task_id}": {
      "get": {
        "summary": "AI 音楽生成タスクのステータスを確認します。",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "確認するタスクの ID"
          }
        ],
        "responses": {
          "200": {
            "description": "タスクステータスの確認に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/TaskStatusResponseV2"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "cover_urls": {
                                  "type": "array",
                                  "description": "ジャケット画像（jpg）のダウンロード URL。現在は 1 枚。有効期限は 2 時間",
                                  "items": {
                                    "type": "string",
                                    "example": "https://example.com/sample-cover-url"
                                  }
                                },
                                "title": {
                                  "type": "string",
                                  "description": "AI が生成した楽曲タイトル",
                                  "example": "Leave the Light On"
                                },
                                "lyrics": {
                                  "type": "string",
                                  "description": "楽曲の確定歌詞。インスト音楽では空"
                                },
                                "duration": {
                                  "type": "number",
                                  "description": "楽曲の長さ（秒）",
                                  "example": 154.3
                                },
                                "timestamps": {
                                  "type": "string",
                                  "description": "オブジェクトの JSON エンコード済み文字列。lyrics_lrc_timestamps フィールドに LRC 形式の同期歌詞（例：[00:08.54]Lyrics text）が 入ります。インスト音楽では LRC テキストは空",
                                  "example": "{\"lyrics_lrc_timestamps\": \"[00:23.98]Two a.m., the neon hums\\n[00:28.26]Steam on the glass, the night still runs\"}"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "標準の 'Bearer authentication' を使用します。ヘッダーに 'API Key' を設定します: `Authorization:Bearer YOUR_API_KEY`。'Bearer' と 'YOUR_API_KEY' の間にスペースが 1 つあることに注意してください。"
      }
    },
    "schemas": {
      "BasicRunTaskResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_id": {
                "type": "string",
                "description": "このタスクの ID。タスクの結果は、この ID を使用して 30 日間以内にクエリできます。",
                "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
              }
            }
          }
        }
      },
      "RunError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 400
          },
          "error": {
            "type": "string",
            "description": "エラーメッセージ",
            "example": "The operation could not be completed"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidParameters",
              "CreditInsufficiency",
              "InvalidStyleGroup",
              "InvalidStyle",
              "BadRequest"
            ],
            "description": "エラーコード:\n  * InvalidParameters - 無効なリクエストパラメータ\n  * CreditInsufficiency - 実行に必要なユニットが不足しています\n  * BadRequest - 予期しないリクエストパラメータ\n  * InvalidStyleGroup - 無効なスタイルグループ ID\n  * InvalidStyle - 無効なスタイル ID"
          }
        }
      },
      "EngineErrorCode": {
        "type": "string",
        "nullable": true,
        "enum": [
          "error_exceed_max_image_size",
          "exceed_max_filesize",
          "invalid_parameter",
          "error_download_image",
          "error_download_mask",
          "error_decode_image",
          "error_decode_mask",
          "error_nsfw_content_detected",
          "error_no_face",
          "error_pose",
          "error_face_parsing",
          "error_inference",
          "exceed_nsfw_retry_limits",
          "error_upload",
          "unknown_internal_error"
        ],
        "description": "エラー：\n- `error_exceed_max_image_size`  - 入力画像サイズが最大制限を超えています\n- `exceed_max_filesize` - 入力ファイルサイズが最大制限を超えています\n- `invalid_parameter` - 無効なパラメータ値\n- `error_download_image` - ソース画像のダウンロードエラー\n- `error_download_mask` - マスク画像のダウンロードエラー\n- `error_decode_image` - ソース画像のデコードエラー\n- `error_decode_mask` - マスク画像のデコードエラー\n- `error_nsfw_content_detected` - ソース画像で NSFW コンテンツが検出されました\n- `error_no_face` - ソース画像で顔が検出されませんでした\n- `error_pose` - ソース画像でポーズの検出に失敗しました\n- `error_face_parsing` - ソース画像での顔セグメンテーションに失敗しました\n- `error_inference` - 推論パイプラインエラー\n- `exceed_nsfw_retry_limits` - NSFW 画像の生成を避けるための再試行制限を超えました\n- `error_upload` - 結果画像のアップロードエラー\n- `unknown_internal_error` - その他\n"
      },
      "TaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "この結果をダウンロードする URL。有効期間は 2 時間です",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "TaskStatusResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_status": {
                "type": "string",
                "enum": [
                  "running",
                  "success",
                  "error"
                ],
                "description": "このタスクのステータス"
              },
              "error": {
                "$ref": "#/components/schemas/EngineErrorCode"
              },
              "error_message": {
                "type": "string",
                "description": "エラーの詳細な説明"
              },
              "results": null
            }
          }
        },
        "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
      }
    },
    "responses": {
      "InvalidApiKey": {
        "description": "無効または欠落している API キー",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 401,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid API key"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "リクエストが多すぎます",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 429,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "example": "Too many requests"
                }
              }
            }
          }
        }
      },
      "InvalidTaskId": {
        "description": "無効なタスク ID",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid task ID"
                }
              }
            }
          }
        }
      },
      "TaskTimeout": {
        "description": "タスク実行タイムアウト",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 500,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "example": "Task execution timed out"
                }
              }
            }
          }
        }
      }
    }
  }
}