> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vmeg.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 生成预签名上传 URL

> 单文件上传 **第 1 步**：获取预签名 PUT URL 与 `materialId`。向该 URL 上传文件后，调用 **完成单文件上传**。在 **创建翻译配音任务** 之前必须完成。见 [素材上传](/zh/guides/assets/material-upload)。



## OpenAPI

````yaml /zh/api-reference/openapi.json post /openapi/v1/assets/material/upload/gen-upload-url
openapi: 3.1.0
info:
  title: VMEG Open API
  description: >-
    将 VMEG 集成到产品中：翻译并配音视频或音频、语音合成、声音克隆、纯文本翻译，以及管理 API 侧文件。响应格式为 `{ code,
    message, data }`；`code === 200` 表示成功。
  version: 1.0.0
servers:
  - url: https://api.vmeg.ai
    description: 生产环境
security:
  - apiKeyAuth: []
tags:
  - name: 媒体翻译
    x-group: 视频与音频翻译配音
    description: >-
      对上传的视频或音频做端到端本地化：识别语音、翻译文稿、生成 AI 配音（克隆或预设音色），并返回配音后的媒体。可选字幕与口型同步。**仅异步** —
      配音文件通过 [Webhook](/zh/guides/webhooks) 投递。这不是纯文本翻译；见
      [媒体翻译](/zh/guides/products/media-translation)。
  - name: TTS
    x-group: 文本转语音（TTS）
    description: >-
      用预设或克隆音色将文本合成为自然语音。**同步**在 HTTP 响应中返回音频 URL；**异步**通过
      [Webhook](/zh/guides/webhooks) 投递结果。见
      [文本转语音](/zh/guides/products/text-to-speech)。
  - name: 声音克隆
    x-group: 声音克隆
    description: >-
      从短参考录音创建可复用音色，返回可用于 TTS 或翻译配音任务的 `voiceId`。见
      [声音克隆](/zh/guides/products/voice-clone)。
  - name: 文本翻译
    x-group: 文本翻译（仅文本）
    description: >-
      翻译纯文本片段，不处理音频或视频。媒体中的口语内容请使用 **视频与音频翻译配音**。见
      [文本翻译](/zh/guides/products/text-translation)。
  - name: 任务管理
    x-group: 任务状态与历史
    description: >-
      列出、查看或删除通过各产品 API 创建的任务。无法依赖 Webhook 时可轮询 `GET .../tasks/detail`。范围限定于当前
      **API Key**。见 [产品概览](/zh/guides/products/overview)。
  - name: 资产 - 素材
    x-group: 上传文件（素材）
    description: >-
      上传并管理用于翻译配音任务的视频/音频。流程：走完完整上传（预签名或分片 → 登记）→ 将已注册的 `materialId` 传入
      create-async。见 [素材上传](/zh/guides/assets/material-upload)。
  - name: 资产 - 音色
    x-group: 音色（预设与克隆）
    description: 列出 TTS 预设音色，或管理已克隆音色。克隆音色通过 **声音克隆** 创建。见 [音色](/zh/guides/assets/voices)。
paths:
  /openapi/v1/assets/material/upload/gen-upload-url:
    post:
      tags:
        - 资产 - 素材
      summary: 生成预签名上传 URL
      description: >-
        单文件上传 **第 1 步**：获取预签名 PUT URL 与 `materialId`。向该 URL 上传文件后，调用
        **完成单文件上传**。在 **创建翻译配音任务** 之前必须完成。见
        [素材上传](/zh/guides/assets/material-upload)。
      operationId: materialGenUploadUrl
      parameters:
        - $ref: '#/components/parameters/IdempotencyKeyRequired'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenApiMaterialFileHashRequest'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenApiMaterialGenUploadUrlResponse'
components:
  parameters:
    IdempotencyKeyRequired:
      name: X-Idempotency-Key
      in: header
      required: true
      description: 创建任务或修改持久化数据的 `POST` 必填（最长 64 字符）。见 [幂等](/zh/guides/idempotency)。
      schema:
        type: string
        maxLength: 64
  schemas:
    OpenApiMaterialFileHashRequest:
      type: object
      required:
        - fileHash
        - fileName
      properties:
        fileHash:
          type: string
          description: 文件 MD5
        fileName:
          type: string
          description: 文件名（含扩展名）
    OpenApiMaterialGenUploadUrlResponse:
      allOf:
        - $ref: '#/components/schemas/OpenApiResponseBase'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/OpenApiMaterialGenUploadUrlData'
    OpenApiResponseBase:
      type: object
      properties:
        code:
          type: integer
          example: 200
          description: 业务码；200 表示成功
        message:
          type: string
          example: ''
          description: 当 `code` 非成功时的说明信息
      required:
        - code
    OpenApiMaterialGenUploadUrlData:
      type: object
      properties:
        uploadUrl:
          type: string
          description: 预签名 PUT URL；秒传时为空
        material:
          $ref: '#/components/schemas/OpenApiMaterialDto'
          description: 文件已存在（秒传）时返回
        s3Uri:
          type: string
          description: 上传目标 URI（传给完成上传接口）
        materialId:
          type: string
          description: 本次上传的素材 ID。见 [素材](/zh/guides/assets/materials)
    OpenApiMaterialDto:
      type: object
      properties:
        materialId:
          type: string
          description: 素材 ID。见 [素材](/zh/guides/assets/materials)
        category:
          type: string
          example: video
          description: 素材类型
        name:
          type: string
          description: Display file name
        addressUrl:
          type: string
          description: 主文件 CDN URL
        thumbnailUrl:
          type: string
          description: 缩略图 CDN URL
        audioUrl:
          type: string
          description: 分离音轨 CDN URL
        resolution:
          type: string
          example: 1920x1080
          description: 视频分辨率（如适用，例如 `1920x1080`）
        mimeType:
          type: string
          description: 主文件的 MIME 类型
        fileHash:
          type: string
          description: 主文件 MD5
        filesize:
          type: integer
          format: int64
          description: 文件大小（字节）
        duration:
          type: integer
          format: int64
          description: 时长（毫秒）
        createTime:
          type: string
          description: 注册时间（ISO 8601）
        updateTime:
          type: string
          description: 最近更新时间（ISO 8601）
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        在 **`Authorization`** 请求头中传入 API Key（`Bearer <api_key>`）。见
        [鉴权](/zh/guides/authentication)。

````