Python
Features
File Conversion
Initiate a file conversion task using either an audio URL or file upload with optional format parameters and webhook callback.
POST
Python
Convert audio files to different formats with optional webhook support for asynchronous updates.
This endpoint processes an uploaded or linked audio file and converts it to a specified output format. You may also define optional parameters like sample rate and bit depth.
Endpoint
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
audio_url | String | Optional | The URL of an audio file to convert. 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. |
target_format | String | Yes | Desired output format. Supported: mp3, wav, flac, ogg, aac, webm. |
target_sr | Integer | Optional | Target sample rate in Hz. Defaults to original if not specified. |
target_bit_depth | Integer | Optional | Target bit depth. Options: 16, 24, 32. Defaults to 16. |
webhook_url | String | Optional | Callback URL to receive the result once conversion is complete. |
content-type: multipart/form-data
Sample Output
Listen to a real sample output: Download AudioTry it Yourself
Visit the File Conversion Endpoint Explorer to try your own text samples.
💡 Tip: Set a webhook_url to receive results automatically when your audio is ready.
Sample Request
cURL
Python
🔐 Replace{path_to_your_audio_file},api_key, andwebhook_urlbefore executing.
Sample Response
Success (200 OK)
Webhook Response
Success (200 OK)
Common Errors
- 400 Bad Request: Invalid request. Possibly due to missing parameters or unsupported formats.
- 500 Internal Server Error: Server encountered an error during processing.
Webhook Response
Once the file conversion is completed, the webhook receives:Output Fields
output_file_path: Direct URL to download the converted audio file.conversion_type: AlwaysFile Conversionfor this endpoint.conversion_id: A unique ID to track the request status.
Authorizations
Body
multipart/form-data
- Option 1
- Option 2
URL of the audio file to convert
Example:
"https://example.com/audio.mp3"
Target format for conversion
Available options:
mp3, wav, flac, ogg, aac, webm Example:
"wav"
Audio file to upload and convert directly
Target sample rate in Hz (optional) - can be any of [8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 192000]
Available options:
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 192000 Example:
44100
Target bit depth (16, 24, or 32)
Available options:
16, 24, 32 Example:
24
Callback URL for async processing results
Example:
"https://your-webhook-url.com/callback"