POST
/
audio_mastering
Python
import requests

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

# Option 1: Using URLs
payload = {
    "audio_url": "https://example.com/input_audio.mp3",
    "reference_audio_url": "https://example.com/reference_track.wav",
    "output_extension": "wav",
    "webhook_url": "http://your-webhook-url.com/callback"
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())

# Option 2: Upload files
# with open("input.mp3", "rb") as input_file, open("ref.wav", "rb") as ref_file:
#     files = {
#         "audio_file": input_file,
#         "reference_audio_file": ref_file
#     }
#     data = {
#         "output_extension": "wav",
#         "webhook_url": "http://your-webhook-url.com/callback"
#     }
#     response = requests.post(url, headers=headers, files=files, data=data)
#     print(response.json())
{
  "success": true,
  "task_id": "master123",
  "conversion_id": "conv456",
  "credit_estimate": 150.75,
  "eta": 300,
  "message": "Mastering task queued successfully"
}

Authorizations

Authorization
string
header
required

Body

multipart/form-data
audio_url
string
required

URL of the input audio to be processed.

Example:

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

reference_audio_url
string
required

URL of the reference audio file to match.

Example:

"https://example.com/reference_track.wav"

audio_path
string

Input audio URL path (deprecated: use audio_url instead).

Example:

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

audio_file
file

Input audio file to upload directly.

reference_audio_path
string

Reference audio URL path (deprecated: use reference_audio_url instead).

Example:

"https://example.com/reference_track.wav"

reference_audio_file
file

Reference audio file to upload directly.

output_extension
enum<string>

Desired output file format.

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

"wav"

webhook_url
string

Callback URL to receive async result.

Example:

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

Response

Successfully queued for mastering

success
boolean
task_id
string
conversion_id
string
credit_estimate
number
eta
integer
message
string