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

# Extend

> This endpoint allows users to extend an existing audio file or stream by appending new audio content after a specific timestamp. The new audio is generated using a prompt (e.g., describing the desired sound) and optional lyrics.



## OpenAPI

````yaml POST /v1/extend
openapi: 3.1.0
info:
  title: WAV API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.wav.com/api/public
    description: Production server
security: []
paths:
  /v1/extend:
    post:
      summary: Extend Audio Using Prompt and Optional Lyrics
      description: >-
        This endpoint allows users to extend an existing audio file or stream by
        appending new audio content after a specific timestamp. The new audio is
        generated using a prompt (e.g., describing the desired sound) and
        optional lyrics.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_file:
                  type: string
                  format: binary
                  description: Uploaded audio file to be extended.
                audio_url:
                  type: string
                  description: 'Input audio URL (supported format: YouTube URL).'
                  example: https://mybucket.s3.amazonaws.com/song.mp3
                extend_after:
                  type: number
                  format: float
                  description: Time in seconds after which to start the extension.
                  example: 35
                prompt:
                  type: string
                  description: Describes how the extended section should sound.
                  example: Add a calming piano outro
                lyrics:
                  type: string
                  description: Original lyrics of song
                  example: Let the journey fade away
                  maxLength: 2000
                lyrics_section_to_extend:
                  type: string
                  description: >-
                    Lyrics to be used for the extended portion(optional, max
                    3000 characters).
                  maxLength: 3000
                gender:
                  type: string
                  description: Voice style if vocal content is generated.
                  enum:
                    - male
                    - female
                    - neutral
                  example: neutral
                title:
                  type: string
                  description: Title of the generated music track
                num_outputs:
                  type: number
                  format: integer
                  description: >-
                    The number of outputs to generate (1 or 2 only):default is
                    2.
                generate_album_cover:
                  type: boolean
                  description: Whether to generate an album cover for the generated audio
                  default: false
                lyrics_timestamps:
                  type: boolean
                  description: Whether to generate timestamps for the lyrics
                  default: false
                webhook_url:
                  type: string
                  description: Callback URL for async processing results.
                  example: https://example.com/webhook
              required:
                - extend_after
              anyOf:
                - required:
                    - audio_url
                - required:
                    - audio_file
      responses:
        '200':
          description: Successfully initiated extend task
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  task_id:
                    type: string
                  conversion_id_1:
                    type: string
                  conversion_id_2:
                    type: string
                  is_flagged:
                    type: boolean
                  reason:
                    type: string
                  eta:
                    type: integer
                    description: Estimated processing time in seconds
                  status:
                    type: string
                  credit_estimate:
                    type: number
                    format: float
                  error_message:
                    type: string
                  error_message_detail:
                    type: string
                  missing_input_fields:
                    type: string
                  predicted_user_intent:
                    type: string
              example:
                success: true
                message: Extend request submitted successfully
                task_id: a39f781f-e87e-4cbd-b923-aebf4aa451e6
                conversion_id_1: f4ecf063-6ddd-43df-bc81-9eccea5b5042
                conversion_id_2: 49e99636-2ae7-4b5f-a907-e85a8fae95ad
                is_flagged: false
                reason: ''
                eta: 199
                status: IN_QUEUE
                credit_estimate: 0.12
                error_message: ''
                error_message_detail: ''
                missing_input_fields: ''
                predicted_user_intent: ''
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: audio_file or audio_url and extend_after are required.
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Internal Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            import requests


            url = "https://api.wav.com/api/public/v1/extend"

            headers = {"Authorization": "<API_KEY>"}

            data = {
              "extend_after": 35.0,
              "prompt": "Add a calming piano outro",
              "lyrics": "Let the journey fade away",
              "gender": "neutral", 
              "lyrics_section_to_extend": "New_lyrics",
              "num_outputs": 1,
              "title": "My Generated Track",
              "webhook_url": "https://example.com/webhook"
            }


            # Option 1: audio_url

            data["audio_url"] = "<YOUR_AUDIO_URL>"

            response = requests.post(url, headers=headers, data=data)


            # Option 2: File Upload

            # with open("song.mp3", "rb") as f:

            #     files = {"audio_file": f}

            #     response = requests.post(url, headers=headers, data=data,
            files=files)

            print(response.json())
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````