Skip to main content
POST
/
v1
/
audio_cutter
Python
import requests

url = "https://api.musicgpt.com/api/public/v1/audio_cutter"
headers = {"Authorization": "<API_KEY>"}

# Option 1: Using audio URL
payload = {
    "audio_url": "https://example.com/input_audio.mp3",
    "start_time": 10500,
    "end_time": 45000,
    "output_extension": "mp3"
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())

# Option 2: Upload local audio file
payload = {
    "start_time": 5000,
    "end_time": 20000,
    "output_extension": "wav"
}
with open("input_audio.mp3", "rb") as f:
    files = {"audio_file": f}
    response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())
{
  "success": true,
  "conversion_id": "conv789",
  "credit_estimate": 25,
  "conversion_path": "https://example.com/trimmed_audio.mp3",
  "message": "Audio trim task queued successfully"
}

Documentation Index

Fetch the complete documentation index at: https://docs.musicgpt.com/llms.txt

Use this file to discover all available pages before exploring further.

Trim your audio files with precision using AI. Audio Cutter allows you to select specific sections of audio recordings, making it perfect for creating highlights, clips, ringtones, and more.
  • Easily extract the best parts of any audio
  • Supports multiple formats like MP3, WAV, FLAC, and more
  • Fast processing with high-quality output
Audio Cutter ensures your trimmed audio sounds clean and professional.

Endpoint

POST /audio_cutter
Use this endpoint to trim a section from an existing audio file.

Sample Output

Listen to the trimmed audio: Download Audio

Try it Yourself

Visit the Audio Cutter Endpoint Explorer to cut and download trimmed audio segments instantly.
✂️ Try trimming different parts to see how accurate the cut is!

Request Parameters

ParameterTypeRequiredDescription
audio_pathStringYesThe S3 path of the input audio file to trim
conversion_idStringYesA unique identifier for the conversion request
start_timeFloatYesThe start time (in milliseconds) of the audio to trim
end_timeFloatYesThe end time (in milliseconds) of the audio to trim
output_extensionStringYesOutput format: mp3, wav, flac, ogg, aac, or webm
content-type: multipart/form-data

Sample Request

Python

import requests

url = "https://api.musicgpt.com/api/public/v1/audio_cutter"
headers = {"Authorization": "<API_KEY>"}

# Option 1: Using audio URL
payload = {
    "audio_url": "https://example.com/input_audio.mp3",
    "start_time": 10500,
    "end_time": 45000,
    "output_extension": "mp3"
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())

# Option 2: Upload local audio file
payload = {
    "start_time": 5000,
    "end_time": 20000,
    "output_extension": "wav"
}
with open("input_audio.mp3", "rb") as f:
    files = {"audio_file": f}
    response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())

Sample Response

Success (200 OK)

{
  "success":true,
  "task_id":"b0ac9d46-64d7-4843-af48-a0b6effe3666",
  "conversion_id":"fe19945b-d466-4183-b559-5d264bddd492",
  "eta":66,
  "credit_estimate":25.0,
  "message":"Message published to queue",
  "status":"IN_QUEUE"
}

Webhook Response

When audio cutter conversion completes, your webhook will receive:
{
  "success": true, 
  "conversion_type": "Audio Cutter", 
  "task_id": "8993b364-9141-4de7-ab38-5a4178618f0e", 
  "conversion_id": "3f07f1ba-9eb5-4581-95ed-427eac1dda0c", 
  "output_file": "https://lalals.s3.amazonaws.com/FileConversions/8993b364-9141-4de7-ab38-5a4178618f0e.mp3", 
  "message": "Audio cutter completed"
} 
📂 The conversion_path field contains the direct link to download the trimmed audio.

Payload and Request Formation

Authorizations

Authorization
string
header
required

Body

multipart/form-data
audio_url
string
required

URL of the input audio to be trimmed.

Example:

"https://example.com/input_audio.mp3"

start_time
number<float>
required

Start time in milliseconds.

Example:

10500

end_time
number<float>
required

End time in milliseconds.

Example:

45000

audio_file
file

Audio file to upload and process directly.

output_extension
enum<string>

Desired output format.

Available options:
mp3,
wav,
flac,
ogg,
aac,
webm
Example:

"mp3"

webhook_url
string

Callback URL for async processing results.

Example:

"http://your-webhook-url.com/callback"

Response

Successfully initiated audio cut

success
boolean
conversion_id
string
credit_estimate
number<float>
conversion_path
string
message
string