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

> ## Agent Instructions
> Send API requests to https://api.ttapi.io with the TT-API-KEY header. Midjourney account hosting uses https://hold.ttapi.io. Claude Code uses https://cc.ttapi.io.
> Most generation endpoints are asynchronous. The submit response returns a job id. Poll that product's fetch endpoint, or pass a webhook on the submit request. A fetch call does not start a new generation.
> 1 USD = 100 quota. Check the pricing page for that product before estimating cost.
> This file lists the English docs. Follow every /_llms/ link recursively for the API reference, Chinese, and Russian. Open a page's .md URL for the endpoint schema.

# Segment Replacement

> Replace part of the generated audio



## OpenAPI

````yaml openapi/en/flowmuisc.json POST /flowmusic/v1/replace
openapi: 3.1.0
info:
  title: Flowmusic API DOCS
  version: 1.0.0
  description: >-
    TTAPI Flowmusic API endpoint service, currently integrating the most
    advanced music large models on the market.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /flowmusic/v1/replace:
    post:
      description: Replace part of the generated audio
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplaceRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    ReplaceRequest:
      type: object
      properties:
        clip_id:
          type: string
          description: Source music clip_id
        title:
          type: string
          description: Title after replacement.
        model:
          type: string
          description: >-
            Music model name; supports Lyria 3 Pro and Lyria 3.5; defaults to
            Lyria 3 Pro when empty
          default: Lyria 3 Pro
        start_s:
          type: number
          description: Replacement start time in seconds
        end_s:
          type: number
          description: >-
            Replacement end time in seconds; must be greater than start_s and
            cannot exceed source clip duration.
        instruction:
          type: string
          description: Edit instruction for the replaced segment.
        seed:
          type: integer
          description: Random seed; used to reproduce or control generation results.
        hook_url:
          type: string
          description: >-
            Business callback URL after task completion; no callback push when
            empty
      required:
        - clip_id
        - start_s
        - end_s
        - instruction
  responses:
    SuccessResponse:
      description: Request successful
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    400Response:
      description: Parameter error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Authorization failed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        Please visit <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI
        Dashboard</a> to obtain your API key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.