Skip to main content
POST
Python
Replace a specific segment of an audio file using a prompt and optional lyrics.

Endpoint

This endpoint processes an input audio file along with a prompt, timestamp range, and optional lyrics to perform inpainting (replacement) in the specified segment.

Request Parameters

πŸ’‘ Note: You must provide either audio_file or audio_url β€” at least one is required.
content-type: multipart/form-data

Sample Output

Listen to a real output: Prompt: inpaint from 60 to 120 seconds in classical slow vibe - audio input : Moana How Far We will Go. Download Audio

Try it Yourself

Visit the Inpaint Endpoint Explorer to test the endpoint β€” set your payload, hit send, and view the generated results.

Sample Request

cURL

Python

πŸ” Replace {path_to_your_audio_file}, api_key, and webhook_url before executing.

Sample Response

Success (200 OK)


Webhook Delivery

Once the generation is complete, webhooks will be triggered to deliver the following:

Standard Requests (non-instrumental):

  • 2 (webhooks) x Inpaint conversion details (one per version)
  • 2 (webhooks) x Lyrics with timestamp data
  • 1 Album Cover Image
Webhook responses include detailed metadata including task_id, conversion_id, audio files (conversion_path), lyrics etc.

Common Errors

  • 422 Unprocessable Entity: Missing required fields like prompt, replace_start_at, or replace_end_at, or neither audio_file nor audio_url provided.
  • 500 Internal Server Error: An unexpected error occurred during processing.

The response provides a downloadable or streamable inpainted audio file.

Payload and Request Formation

Authorizations

Authorization
string
header
required

Body

multipart/form-data
audio_url
string
required

Input audio URL (supported format: YouTube URL).

Example:

"https://mybucket.s3.amazonaws.com/song.mp3"

prompt
string
required

A description of how the replacement should sound.

Example:

"Replace this part with an opera-style vocal."

replace_start_at
number<float>
required

Time in seconds to start replacing audio.

Example:

12.5

replace_end_at
number<float>
required

Time in seconds to stop replacing audio.

Example:

20

audio_file
file

Uploaded input audio file.

lyrics
string

Lyrics to be used for inpainting.

Example:

"This is where my story begins"

lyrics_section_to_replace
string

Lyrics to be used for the replaced portion(optional, max 3000 characters)

Maximum string length: 2000
gender
enum<string>

Voice style for the inpainted segment.

Available options:
male,
female,
neutral
Example:

"male"

num_outputs
number<integer>

The number of outputs to generate (1 or 2 only):default is 2.

title
string

Title of the generated music track

generate_album_cover
boolean
default:false

Whether to generate an album cover for the generated audio

webhook_url
string

Callback URL for async processing results.

Example:

"https://example.com/webhook"

Response

Successfully initiated inpaint task

success
boolean
message
string
task_id
string
conversion_id_1
string
conversion_id_2
string
eta
integer

Estimated processing time in seconds

credit_estimate
number<float>