curl -X POST "https://api.musicgpt.com/api/public/v2/Extraction" \
-H "Authorization: <API_KEY>" \
-F "audio_url=<YOUR_AUDIO_URL>" \
-F "stem_preset=6_stems" \
-F "webhook_url=https://example.com/webhook"import requests
import json
url = "https://api.musicgpt.com/api/public/v2/Extraction"
headers = {
"Authorization": "<API_KEY>"
}
data = {
"stems": json.dumps(["vocals", "drums"]),
"preprocessing_options": json.dumps(["Denoise"]),
"eco_mode": False,
"webhook_url": "https://example.com/my-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())const form = new FormData();
form.append('audio_url', '<string>');
form.append('audio_file', '<string>');
form.append('stem_preset', '6_stems');
form.append('stems', '["vocals", "drums"]');
form.append('preprocessing_options', '["Denoise", "Dereverb"]');
form.append('eco_mode', 'false');
form.append('webhook_url', 'http://webhook.musicgpt.com');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v2/Extraction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v2/Extraction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v2/Extraction"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v2/Extraction")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v2/Extraction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "98bb0a78-854b-4ca7-a145-834c1ac73901",
"conversion_id": "7c38aa60-e0c8-4113-983a-f2c6d4e6d257",
"eta": 57,
"credit_estimate": 0,
"message": "Message published to queue",
"status": "IN_QUEUE",
"is_free_promo": true,
"free_generations_remaining_hour": 14,
"free_generations_remaining_day": 94,
"free_quota_resets_at": "2026-11-03T15:00:00Z"
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Extraction
Process an audio file to extract specified stems (vocals, instrumental, or other components) with optional preprocessing. Supports file upload or URL with webhook callback. Send either stems or stem_preset. During November 2026 (UTC), stem_preset requests from paid plans are free, up to 20 stems per clock hour and 100 stems per day (2_stems uses 2, 6_stems uses 6).
curl -X POST "https://api.musicgpt.com/api/public/v2/Extraction" \
-H "Authorization: <API_KEY>" \
-F "audio_url=<YOUR_AUDIO_URL>" \
-F "stem_preset=6_stems" \
-F "webhook_url=https://example.com/webhook"import requests
import json
url = "https://api.musicgpt.com/api/public/v2/Extraction"
headers = {
"Authorization": "<API_KEY>"
}
data = {
"stems": json.dumps(["vocals", "drums"]),
"preprocessing_options": json.dumps(["Denoise"]),
"eco_mode": False,
"webhook_url": "https://example.com/my-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())const form = new FormData();
form.append('audio_url', '<string>');
form.append('audio_file', '<string>');
form.append('stem_preset', '6_stems');
form.append('stems', '["vocals", "drums"]');
form.append('preprocessing_options', '["Denoise", "Dereverb"]');
form.append('eco_mode', 'false');
form.append('webhook_url', 'http://webhook.musicgpt.com');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v2/Extraction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v2/Extraction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v2/Extraction"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v2/Extraction")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v2/Extraction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stem_preset\"\r\n\r\n6_stems\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stems\"\r\n\r\n[\"vocals\", \"drums\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"preprocessing_options\"\r\n\r\n[\"Denoise\", \"Dereverb\"]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"eco_mode\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttp://webhook.musicgpt.com\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "98bb0a78-854b-4ca7-a145-834c1ac73901",
"conversion_id": "7c38aa60-e0c8-4113-983a-f2c6d4e6d257",
"eta": 57,
"credit_estimate": 0,
"message": "Message published to queue",
"status": "IN_QUEUE",
"is_free_promo": true,
"free_generations_remaining_hour": 14,
"free_generations_remaining_day": 94,
"free_quota_resets_at": "2026-11-03T15:00:00Z"
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Body
- Option 1
- Option 2
Quick preset instead of stems. 2_stems: vocals, instrumental. 6_stems: vocals, instrumental, piano, bass, drums, guitar. Do not send with a non-empty stems list. Free on paid plans during November 2026 (UTC), up to 20 stems per clock hour and 100 stems per day; each preset uses one slot per stem (2 or 6).
2_stems, 6_stems "6_stems"
JSON string list of required output stems. Required unless stem_preset is sent. 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.
"[\"vocals\", \"drums\"]"
Response
Successfully initiated stem extraction