POST
/
audio_mastering
import requests

url = "https://api.example.com/api/public/v1/audio_mastering"
headers = {"Authorization": "<API_KEY>", "accept": "application/json"}

payload = {
    "audio_path": "https://example.com/input_audio.mp3",
    "reference_audio_path": "https://example.com/reference_track.wav",
    "conversion_id": "conv123",
    "output_extension": "wav",
    "audio_duration": 180.5,
    "webhook_url": "http://your-webhook-url.com/callback",
    "user_id": "user123"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
{
  "success": true,
  "task_id": "master123",
  "conversion_id": "conv456",
  "credit_estimate": 150.75,
  "eta": 300,
  "message": "Mastering task queued successfully"
}

Master your audio files professionally using a reference track.

Audio Mastering uses intelligent processing to match the sonic quality of your track to a reference file โ€” perfect for music production, podcasts, and post-production work.

  • ๐ŸŽ›๏ธ Match tone, loudness, and clarity
  • ๐ŸŽต Supports formats like MP3, WAV, FLAC, and more
  • ๐Ÿš€ Quick, accurate mastering with webhook support

๐Ÿ“ก Endpoint

POST /audio_mastering

Use this endpoint to master an audio file based on a reference track.


โ–ถ๏ธ Sample Output

Listen to the mastered audio:


๐Ÿงช Try it Yourself

Visit the Audio Mastering Endpoint Explorer to upload an audio and reference track for instant mastering.

๐ŸŽ›๏ธ Tip: Use a professionally mastered song as your reference for best results!


๐Ÿ› ๏ธ Request Parameters

ParameterTypeRequiredDescription
audio_pathStringYesURL path of the input audio file to be mastered
conversion_idStringYesUnique identifier for this conversion request
reference_audio_pathStringYesURL path of the reference audio file to match
output_extensionStringOptionalDesired output format (mp3, wav, flac, ogg, aac, webm)
audio_durationFloatYesDuration of input audio in seconds (for credit calculation)
webhook_urlStringOptionalURL to receive callback notification when processing completes
user_idStringOptionalUser ID for tracking (from authentication token)

๐Ÿ“ฅ Sample Request

๐Ÿ Python

import requests

url = "https://api.musicgpt.com/api/public/v1/audio_mastering"
headers = {
    "accept": "application/json",
    "Authorization": "<api_key>",
    "Content-Type": "application/json"
}
payload = {
    "audio_path": "https://musicgpt.s3.us-east-1.amazonaws.com/conversions/sample-audio.mp3",
    "conversion_id": "user_master_12345",
    "reference_audio_path": "https://musicgpt.s3.us-east-1.amazonaws.com/conversions/reference-track.mp3",
    "output_extension": "mp3",
    "audio_duration": 180.5,
    "webhook_url": "https://abcd.requestcatcher.com/",
    "user_id": "user_67890"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

๐Ÿ“ค Sample Response

โœ… Success (200 OK)

{
  "success": true,
  "task_id": "0d12ef34-5678-4abc-9123-456def7890ab",
  "conversion_id": "user_master_12345",
  "credit_estimate": 0.02,
  "eta": 120,
  "message": "Mastering request accepted"
}

๐Ÿ“ž Webhook Response

If a webhook_url is provided, you will receive the following once processing completes:

{
  "success": true,
  "task_id": "0d12ef34-5678-4abc-9123-456def7890ab",
  "conversion_id": "user_master_12345",
  "conversion_path": "https://musicgpt.s3.us-east-1.amazonaws.com/conversions/sample-mastered.mp3",
  "credit_cost": 0.02
}

๐Ÿ“‚ If no webhook is provided, you can fetch the final mastered audio manually later using the conversion_id.


Authorizations

Authorization
string
header
required

Body

multipart/form-data

Response

200
application/json

Successfully initiated audio mastering

The response is of type object.