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

# Dereverb

> Initiate a reverberation removal task using either an audio URL or file upload with optional webhook callback.

Remove reverb from an input audio file with optional webhook callback for asynchronous updates.

***

## Endpoint

```http theme={null}
POST /dereverb
```

This endpoint removes reverberation (echo) from an uploaded or linked audio file. A `webhook_url` can be provided for asynchronous task status updates.

***

## Request Parameters

| Parameter     | Type         | Required | Description                                                                             |
| ------------- | ------------ | -------- | --------------------------------------------------------------------------------------- |
| `audio_url`   | `String`     | Optional | The URL of an audio file to clean. Either `audio_url` or `audio_file` must be provided. |
| `audio_file`  | `UploadFile` | Optional | Upload the audio file directly. Either `audio_url` or `audio_file` must be provided.    |
| `webhook_url` | `String`     | Optional | Callback URL for async response.                                                        |

> 💡 **Note:** Either `audio_url` or `audio_file` must be provided — one is required.

> **content-type:** multipart/form-data

***

## Sample Output

Listen to a real sample output:
<audio controls="1" controlslist="nodownload nofullscreen noremoteplayback" src="https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_reverb.mp3">Your browser does not support the audio playback.</audio>

<a href="https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_reverb.wav" target="_blank">Download Audio</a>

***

## Try it Yourself

Visit the [Dereverb Endpoint Explorer](/api-documentation/endpoint/dereverb) to try your own text samples.

> 💡 Tip: Set a `webhook_url` to receive results automatically when your audio is ready.

***

## Sample Request

### cURL

```bash theme={null}
curl -X POST "https://api.musicgpt.com/api/public/v1/Dereverb" \
-H "accept: application/json" \
-H "Authorization: <api_key>" \
-F "audio_url=https://www.youtube.com/watch?v=jGflUbPQfW8" \
-F "webhook_url=http://webhook.musicgpt.com"
```

### Python

```python theme={null}
import requests

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

# Option 1: URL
payload = {
    "audio_url": "https://example.com/audio.m4a",
    "webhook_url": ""
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())

# Option 2: File Upload
# payload = {
#     "webhook_url": "https://www.test.requestcatcher.com/test"
# }
# with open("audio.m4a", "rb") as f:
#     files = {"audio_file": f}
#     response = requests.post(url, headers=headers, data=payload, files=files)
# print(response.json())
```

> 🔐 Replace `{path_to_your_audio_file}`, `api_key`, and `webhook_url` before executing.

***

## Sample Response

### Success (200 OK)

```json theme={null}
{
  "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"
}
```

***

## Webhook Response

### Success (200 OK)

```json theme={null}
{
  "success": true, 
  "conversion_type": "Dereverb", 
  "task_id": "e99d00bb-2ddf-4279-a15e-6e22801ee575", 
  "conversion_id": "fbcf0c40-a33d-40aa-8c1d-7bb6f9df0b0f", 
  "audio_path": "files/4efbdeff-48a2-401c-a9e6-8a2ffe465487.wav", 
  "noreverb": "https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_reverb.mp3", 
  "noreverb_wav": "https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_reverb.wav", 
  "reverb": "https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_noreverb.mp3", 
  "reverb_wav": "https://lalals.s3.amazonaws.com/conversions/e99d00bb-2ddf-4279-a15e-6e22801ee575_noreverb.wav", 
  "message": "de_reverb conversion Completed", 
  "conversion_duration": 136.83045351473922, 
  "conversion_cost": "0.48"
}
```

***

## Common Errors

* **422 Unprocessable Entity**: Both `audio_url` and `audio_file` cannot be `None`.
* **500 Internal Server Error**: A server error occurred during processing.

***


## OpenAPI

````yaml POST /v1/dereverb
openapi: 3.1.0
info:
  title: Musicgpt API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.musicgpt.com/api/public
    description: Production server
security: []
paths:
  /v1/dereverb:
    post:
      summary: Removes reverberation from an audio file or URL
      description: >-
        Initiate a reverberation removal task using either an audio URL or file
        upload with optional webhook callback.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_url:
                  type: string
                  description: >-
                    URL of the audio file to process (e.g., YouTube, direct
                    audio link).
                  example: https://www.youtube.com/watch?v=example123
                audio_file:
                  type: string
                  format: binary
                  description: Audio file to upload and process directly.
                webhook_url:
                  type: string
                  description: Callback URL for async processing results.
                  example: http://your-webhook-url.com/callback
              anyOf:
                - required:
                    - audio_url
                - required:
                    - audio_file
      responses:
        '200':
          description: Successfully initiated dereverberation
          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
                    format: float
                example:
                  success: true
                  task_id: dereverb789
                  conversion_id: conv456
                  eta: -1
                  credit_estimate: 100.1
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Either audio_url or audio_file must be provided.
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Internal Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            import requests


            url = "https://api.musicgpt.com/api/public/v1/dereverb"

            headers = {
                "Authorization": "<<<api key>>>"
            }


            # Option 1: URL

            payload = {
                "audio_url": "https://example.com/audio.m4a",
                "webhook_url": ""
            }

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

            print(response.json())


            # Option 2: File Upload

            # payload = {

            #     "webhook_url": "https://www.test.requestcatcher.com/test"

            # }

            # with open("audio.m4a", "rb") as f:

            #     files = {"audio_file": f}

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

            # print(response.json())
        - lang: PHP
          source: |-
            <?php
            $url = 'https://api.musicgpt.com/api/public/v1/dereverb';
            $headers = ['Authorization: <<<api key>>>'];

            // Option 1: URL
            $data = [
                'audio_url' => 'https://example.com/audio.m4a',
                'webhook_url' => ''
            ];
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;

            // Option 2: File Upload
            $data = [
                'webhook_url' => 'https://www.test.requestcatcher.com/test',
                'audio_file' => new CURLFile('audio.m4a')
            ];
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;
        - lang: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc main() {\n\turl := \"https://api.musicgpt.com/api/public/v1/dereverb\"\n\theaders := map[string]string{\n\t\t\"Authorization\": \"<<<api key>>>\"\n\t}\n\n\t// Option 1: URL\n\tdata := \"audio_url=https://example.com/audio.m4a&webhook_url=\"\n\treq, _ := http.NewRequest(\"POST\", url, strings.NewReader(data))\n\tfor k, v := range headers {\n\t\treq.Header.Add(k, v)\n\t}\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\tfmt.Println(string(body))\n\n\t// Option 2: File Upload\n\tfile, _ := os.Open(\"audio.m4a\")\n\tdefer file.Close()\n\tbodyBuf := &bytes.Buffer{}\n\twriter := multipart.NewWriter(bodyBuf)\n\t_ = writer.WriteField(\"webhook_url\", \"https://www.test.requestcatcher.com/test\")\n\tpart, _ := writer.CreateFormFile(\"audio_file\", \"audio.m4a\")\n\tio.Copy(part, file)\n\twriter.Close()\n\n\treq, _ = http.NewRequest(\"POST\", url, bodyBuf)\n\treq.Header.Add(\"Authorization\", \"<<<api key>>>\")\n\treq.Header.Add(\"Content-Type\", writer.FormDataContentType())\n\tres, _ = http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ = io.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````