> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wav.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Audio Mastering

> Processes an input audio file to match the mastering characteristics of a reference track.



## OpenAPI

````yaml POST /v1/audio_mastering
openapi: 3.1.0
info:
  title: WAV API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.wav.com/api/public
    description: Production server
security: []
paths:
  /v1/audio_mastering:
    post:
      summary: Master an audio file using a reference track
      description: >-
        Processes an input audio file to match the mastering characteristics of
        a reference track.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_url:
                  type: string
                  description: 'Input audio URL (supported format: YouTube URL).'
                  example: https://example.com/input_audio.mp3
                audio_file:
                  type: string
                  format: binary
                  description: Input audio file to upload directly.
                reference_audio_url:
                  type: string
                  description: URL of the reference audio file to match.
                  example: https://example.com/reference_track.wav
                reference_audio_file:
                  type: string
                  format: binary
                  description: Reference audio file to upload directly.
                output_extension:
                  type: string
                  enum:
                    - mp3
                    - wav
                    - flac
                    - ogg
                    - aac
                    - webm
                  description: Desired output file format.
                  example: wav
                webhook_url:
                  type: string
                  description: Callback URL to receive async result.
                  example: http://your-webhook-url.com/callback
              anyOf:
                - required:
                    - audio_url
                    - reference_audio_url
                - required:
                    - audio_file
                    - reference_audio_file
      responses:
        '200':
          description: Successfully initiated task
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  task_id:
                    type: string
                  conversion_id:
                    type: string
                  eta:
                    type: integer
                  credit_estimate:
                    type: number
                  message:
                    type: string
                  status:
                    type: string
                example:
                  success: true
                  task_id: e99d00bb-2ddf-4279-a15e-6e22801ee575
                  conversion_id: fbcf0c40-a33d-40aa-8c1d-7bb6f9df0b0f
                  eta: 40
                  credit_estimate: 0.48
                  message: Message published to queue
                  status: IN_QUEUE
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Invalid output format specified
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Authentication failed
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Insufficient credits for this operation
                  required_credits:
                    type: number
                    example: 150.75
                  available_credits:
                    type: number
                    example: 100
        '404':
          description: User or plan not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: User subscription plan not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Internal server error during mastering
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            import requests


            url = "https://api.wav.com/api/public/v1/audio_mastering"


            headers = {
                "Authorization": "<API_KEY>"
            }


            data = {
                "output_extension": "wav",
                "webhook_url": "https://example.com/my-webhook"
            }


            # Option 1: audio URLs

            data["audio_url"] = "<YOUR_AUDIO_URL>"

            data["reference_audio_url"] = "<YOUR_REFERENCE_AUDIO_URL>"

            response = requests.post(url, headers=headers, data=data)


            # Option 2: File Upload

            # with open("song.mp3", "rb") as audio, open("reference.mp3", "rb")
            as reference:

            #     files = {

            #         "audio_file": audio,

            #         "reference_audio_file": reference

            #     }

            #     response = requests.post(url, headers=headers, data=data,
            files=files)


            print(response.json())
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````