> ## 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.

# Замена фрагмента

> Используйте Suno фрагмент замены API, чтобы переписать или перегенерировать отдельные части песни без пересоздания всего трека с нуля.

<Note>
  **Совет**: текст для замены должен частично пересекаться с исходным текстом, и в идеале тайминг тоже должен совпадать.

  **infill\_lyrics**: новый фрагмент текста, который вы хотите вставить или заменить.

  **промпт**: контекст, то есть объедините исходный текст до и после нового фрагмента.

  **Пример**: исходный текст песни выглядит как \[Куплет 1]AA \[Припев]BB \[Куплет 2]CC \[Припев]DD \[Финал]EE. Если вы хотите заменить CC на OO:

  * Установите **infill\_lyrics** в OO (новый текст для вставки).

  * Установите **промпт** в BB \[Куплет 2]OO\[Припев]DD (включите часть исходного текста до и после OO, чтобы сформировать контекст).

  Это позволяет модели сгенерировать наилучший результат на основе окружающего контекста в **промпт** и нового текста в **infill\_lyrics**.
</Note>


## OpenAPI

````yaml openapi/ru/suno.json POST /suno/v1/replace-section
openapi: 3.1.0
info:
  title: Документация TTAPI API
  version: 1.0.0
  description: Suno AI Музыка API
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /suno/v1/replace-section:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  properties:
                    music_id:
                      type: string
                      description: Идентификатор аудио
                    infill_start_s:
                      type: number
                      description: Время начала замены в секундах
                    infill_end_s:
                      type: number
                      description: Время окончания замены в секундах
                    prompt:
                      type: string
                      description: Контекстный текст песни
                    infill_lyrics:
                      type: string
                      description: Новый текст песни
                  required:
                    - music_id
                    - mv
                    - infill_start_s
                    - infill_end_s
                - $ref: '#/components/schemas/Mv_Params'
                - $ref: '#/components/schemas/Title_Params'
                - $ref: '#/components/schemas/Tags_Params'
                - $ref: '#/components/schemas/Negative_tags_Params'
                - $ref: '#/components/schemas/IsStorageParams'
                - $ref: '#/components/schemas/HookUrlParams'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    Mv_Params:
      type: object
      properties:
        mv:
          type: string
          default: chirp-v5
          enum:
            - chirp-v5
            - chirp-v4-5+
            - chirp-v4-5
            - chirp-v4-5-all
            - chirp-v4
            - chirp-v3-5
            - chirp-v3-0
          description: Модель для использования.
    Title_Params:
      type: object
      properties:
        title:
          type: string
          description: >-
            Название музыки.


            Используется в пользовательском режиме (custom=true). Максимальная
            длина: 80 символов.
    Tags_Params:
      type: object
      properties:
        tags:
          type: string
          description: >-
            Музыкальный стиль или жанр.


            Используется в пользовательском режиме (custom=true). Максимальная
            длина: 1000 символов.
          example: rock, blues, hip-hop, r&b
    Negative_tags_Params:
      type: object
      properties:
        negative_tags:
          type: string
          description: |-
            Музыкальные стили или жанры, которые нужно исключить из генерации.

            Используется в пользовательском режиме (custom=true).
    IsStorageParams:
      type: object
      properties:
        isStorage:
          type: boolean
          default: true
          description: |-
            Сохранять ли сгенерированный звук.

            - **true**: аудио будет сохранено и будет возвращено TTAPI CDN URL.
            - **false**: будет возвращен исходный источник URL.
    HookUrlParams:
      type: object
      properties:
        hookUrl:
          type: string
          description: URL обратного уведомления
  responses:
    SuccessResponse:
      description: Запрос выполнен успешно
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            required:
              - status
              - message
              - data
    400Response:
      description: Ошибка параметров
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Ошибка авторизации
      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: >-
        Вы можете получить API-ключ в <a href='https://dashboard.ttapi.io'
        target='_blank'>панель управления TTAPI</a>.

````