POST
/
Extraction
Python
import requests
import json

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

files = {
    "audio_file": open("path_to_audio.mp3", "rb")
}
data = {
    "audio_url": "",
    "stems": json.dumps(["vocals", "drums"]),
    "preprocessing_options": json.dumps(["Denoise"]),
    "webhook_url": "http://webhook.musicgpt.com"
}

response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())
{
  "success": true,
  "task_id": "62725d68-01e8-4c87-8fb0-298aa81c529c",
  "conversion_id": "46b358c9-b22f-49d1-a68d-17901a6a549b",
  "eta": 11,
  "credit_estimate": 2.5
}

Authorizations

Authorization
string
header
required

Body

multipart/form-data
audio_url
string
required

The URL of the audio file to process.

Example:

"https://www.youtube.com/watch?v=jGflUbPQfW8"

audio_file
file

Audio file to upload and process.

stems
string
default:[]

JSON string list of required output stems. Available options: vocals, instrumental, male_vocal, female_vocal, lead_vocal, back_vocal, bass, drums, guitar, piano, keys, strings, winds, rhythm_guitar, solo_guitar, acoustic_guitar, electric_guitar, kick_drum, snare_drum, toms, hi_hat, ride, crash.

Example:

"[\"vocals\", \"drums\"]"

preprocessing_options
string
default:[]

JSON string list of preprocessing steps. Available options: Denoise, Deecho, Dereverb.

Example:

"[\"Denoise\", \"Dereverb\"]"

webhook_url
string

Callback URL for async processing.

Example:

"http://webhook.musicgpt.com"

Response

Successfully initiated audio extraction

success
boolean
task_id
string
conversion_id
string
eta
integer

Time in seconds to completion. -1 if unknown

credit_estimate
number

Estimated credit cost