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

# Upload Audio

> Upload audio for Inpainting editing (enterprise)

<Warning>
  This endpoint is **only available to enterprise customers** with Inpainting permissions.
</Warning>

Upload an existing audio file to ElevenLabs and obtain a `song_id` for use with Inpainting editing.

<Info>
  This is an async task. The response contains a `taskId` — use [Get Task Status](/api-reference/eleven/task) to poll for the `songId` and optional `compositionPlan`.
</Info>

## Inpainting Workflow

<Steps>
  <Step title="Upload audio">
    Call `POST /eleven/upload` with the audio URL to get a `song_id`.
  </Step>

  <Step title="Reference in composition plan">
    In `POST /eleven/music`, use the `song_id` in `compositionPlan.sections[].source_from` to reference specific segments of the uploaded song.
  </Step>

  <Step title="Define edit ranges">
    Use `source_from.range` to specify the time range to keep, and `negative_ranges` to exclude sub-sections within that range.
  </Step>
</Steps>

<Tip>
  Set `extractCompositionPlan: true` to also extract the uploaded audio's structure as a composition plan, which you can then modify and use for regeneration.
</Tip>


## OpenAPI

````yaml POST /eleven/upload
openapi: 3.0.0
info:
  title: Eleven AI
  description: API documentation for Eleven AI
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: eleven
    description: ''
paths:
  /eleven/upload:
    post:
      tags:
        - eleven
      summary: 上传音频（Inpainting 前置步骤）
      description: >-
        对应 ElevenLabs POST /v1/music/upload。**仅限企业 Inpainting 客户使用。**


        **用途**：将已有音频上传至 ElevenLabs，获取 song_id，供后续 Inpainting 编辑使用。


        **Inpainting 完整流程**：

        1. 调用 POST /eleven/upload 上传已有音频 → 获取 song_id

        2. 在 POST /eleven/music 的 compositionPlan.sections[].source_from 中引用该
        song_id

        3. 指定 source_from.range（时间区间）和 negative_ranges（排除区间），实现对歌曲特定段落的修改/替换


        **extractCompositionPlan=true** 时，还会返回该音频的结构化作曲计划，可直接用于编辑后重新生成。


        返回 taskId，使用 GET /eleven/tasks 轮询获取结果（result 包含 songId 和可选的
        compositionPlan）
      operationId: ApiPublicController_uploadAudio
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadAudioDto'
      responses:
        '200':
          description: 任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIdDto'
      security:
        - bearerAuth: []
components:
  schemas:
    UploadAudioDto:
      type: object
      properties:
        audioUrl:
          type: string
          description: >-
            音频文件 URL (http/https)，支持格式: .mp3, .wav, .flac, .m4a, .aac, .ogg,
            .wma, .opus
          example: https://example.com/song.mp3
        extractCompositionPlan:
          type: boolean
          description: >-
            是否提取并返回上传音频的作曲计划（composition_plan）。设为 true
            时，响应中将包含解析出的段落结构信息，但会增加接口延迟
          default: false
      required:
        - audioUrl
    TaskIdDto:
      type: object
      properties:
        taskId:
          type: string
          description: 任务 ID，用于后续查询结果
      required:
        - taskId
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````