# Suno URL 文件上传

> 通用

将远程 HTTP/HTTPS 文件上传到 Suno 指定的存储路径。
成功响应中的 `data.downloadUrl` 可作为其他 Suno
接口（例如音频分离接口）的文件 URL 参数。

## 请求地址

`POST https://api.modelverse.cn/v1/Suno/file-url-upload`

## 请求体

## 响应

- **200** — 文件上传成功响应。
- **400** — 请求参数无效，例如缺少必填字段或 URL 格式不合法。
- **401** — ModelVerse API Key 缺失或无效。
- **default** — Suno 或网关错误。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "Suno URL 文件上传接口文档",
    "version": "1.0.0",
    "description": "Suno 文件 URL 上传接口。接口接收一个可由服务端访问的 HTTP/HTTPS 文件地址，\n将远程文件上传到 Suno 并返回文件元数据和临时下载地址。\n\n**使用说明：**\n- `fileUrl` 必须是服务端可访问的 HTTP 或 HTTPS URL。\n- `uploadPath` 必填，且不能以 `/` 开头或结尾。\n- `fileName` 文件名称（可选），包含文件扩展名。如不提供，系统将生成随机文件名。若传入的文件名与已存在的文件名相同，旧文件将被覆盖，但由于缓存机制，覆盖效果可能不会立即显现。\n- 上传文件为临时文件，下载 URL 具有时效性，建议上传成功后及时保存文件。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API 服务器"
    }
  ],
  "tags": [
    {
      "name": "Suno 文件管理",
      "description": "Suno 远程文件上传操作。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/Suno/file-url-upload": {
      "post": {
        "tags": [
          "Suno 文件管理"
        ],
        "operationId": "uploadSunoFileFromURL",
        "summary": "Suno URL 文件上传",
        "description": "将远程 HTTP/HTTPS 文件上传到 Suno 指定的存储路径。\n成功响应中的 `data.downloadUrl` 可作为其他 Suno\n接口（例如音频分离接口）的文件 URL 参数。\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SunoFileURLUploadRequest"
              },
              "examples": {
                "customFileName": {
                  "summary": "指定文件名上传",
                  "value": {
                    "fileUrl": "https://example.com/audio/source.mp3",
                    "uploadPath": "audio/imported",
                    "fileName": "source.mp3"
                  }
                },
                "autoFileName": {
                  "summary": "自动生成或提取文件名",
                  "value": {
                    "fileUrl": "https://example.com/audio/source.mp3",
                    "uploadPath": "audio/imported"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "文件上传成功响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SunoFileURLUploadResponse"
                },
                "example": {
                  "success": true,
                  "code": 200,
                  "msg": "文件上传成功",
                  "data": {
                    "fileName": "source.mp3",
                    "filePath": "audio/imported/source.mp3",
                    "downloadUrl": "https://tempfile.example.com/audio/imported/source.mp3",
                    "fileSize": 154832,
                    "mimeType": "audio/mpeg",
                    "uploadedAt": "2026-08-12T12:00:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效，例如缺少必填字段或 URL 格式不合法。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SunoFileUploadErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "ModelVerse API Key 缺失或无效。"
          },
          "default": {
            "description": "Suno 或网关错误。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SunoFileUploadErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "使用 ModelVerse API Key，通过 `Authorization: Bearer <API_KEY>` 发送。"
      }
    },
    "schemas": {
      "SunoFileURLUploadRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "fileUrl",
          "uploadPath"
        ],
        "properties": {
          "fileUrl": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://[^\\s]+$",
            "description": "服务端可访问的远程文件地址，仅支持 HTTP 或 HTTPS。"
          },
          "uploadPath": {
            "type": "string",
            "minLength": 1,
            "pattern": "^(?!/)(?!.*\\/$).+",
            "description": "文件上传目录，不能以 `/` 开头或结尾。"
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "description": "可选的文件名，不应包含路径；不传时由随机生成或提取。"
          }
        }
      },
      "SunoFileURLUploadResponse": {
        "type": "object",
        "additionalProperties": false,
        "example": {
          "success": true,
          "code": 200,
          "msg": "文件上传成功",
          "data": {
            "fileName": "source.mp3",
            "filePath": "audio/imported/source.mp3",
            "downloadUrl": "https://tempfile.example.com/audio/imported/source.mp3",
            "fileSize": 154832,
            "mimeType": "audio/mpeg",
            "uploadedAt": "2026-08-12T12:00:00.000Z"
          }
        },
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "code": {
            "type": "integer",
            "example": 200
          },
          "msg": {
            "type": "string",
            "example": "文件上传成功"
          },
          "data": {
            "$ref": "#/components/schemas/SunoUploadedFile"
          }
        }
      },
      "SunoUploadedFile": {
        "type": "object",
        "additionalProperties": false,
        "example": {
          "fileName": "source.mp3",
          "filePath": "audio/imported/source.mp3",
          "downloadUrl": "https://tempfile.example.com/audio/imported/source.mp3",
          "fileSize": 154832,
          "mimeType": "audio/mpeg",
          "uploadedAt": "2026-08-12T12:00:00.000Z"
        },
        "properties": {
          "fileName": {
            "type": "string",
            "example": "source.mp3"
          },
          "filePath": {
            "type": "string",
            "example": "audio/imported/source.mp3"
          },
          "downloadUrl": {
            "type": "string",
            "format": "uri",
            "example": "https://tempfile.example.com/audio/imported/source.mp3"
          },
          "fileSize": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "example": 154832
          },
          "mimeType": {
            "type": "string",
            "example": "audio/mpeg"
          },
          "uploadedAt": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-12T12:00:00.000Z"
          }
        }
      },
      "SunoFileUploadErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "code": {
            "type": "integer"
          },
          "msg": {
            "type": "string"
          }
        }
      }
    }
  }
}
```
