Import an audio file into the system. You can either submit a local audio file with a POST request or import an online resource by providing a public URL.
|access_id required||uuid||One of your personal access_ids|
|file required||file||A file url or a local file upload (requires POST).
Upload a local file by performing a POST request with encoding-type "multipart/form-data" (corresponding to an html form with an <input type="file" />)
[wav, aif, au, flac, mp3-cbr, mp3-vbr, ogg, xml, json, jsonp, xmlp] default: mp3-vbr
The format to use in the response. If you select an audio format, see the table below that lists which parameters are available to control the quality for each format.
Note that for the formats "jsonp" or "xmlp", the HTTP status code will always be 200.
||Callback function name required when using the format "jsonp" or "xmlp."|
Arbitrary string to add to the logs.
Allows you to add any strings you might find helpful for later analysis of the request logs.
The imported file has to comply with the following restrictions:
Supported file formats
- .wav, .aif, .aiff, .au: Raw PCM Formats
- .flac: Free Lossless Audio Codec (recommended for high quality applications)
- .mp3: MPEG 1 Layer 3
- .ogg: Ogg Vorbis (Xiph)
Audio format limitations
- Channels: only 1 or 2 audio channels (mono or stereo)
- Length: maximum audio length of 15 minutes
- Size: maximum file size of 50mb
URL import limitations
- In order to import your own audio files please use one of your personal access_ids. The demo access_id used in the documentation and examples is limited to files hosted on sonicAPI.com.
- Only http and https protocols are supported
One way to upload your own files is to use a command line http client, for example cURL. Please note that you need to replace the access_id in the examples with one of yours or you will receive an error ("403 - File upload not allowed").
$ ACCESS_ID=deb464f7-f374-4ae8-a0b4-6c45cab86705 $ curl https://api.sonicapi.com/file/upload?access_id=$ACCESS_ID -Ffile=@Vocals.mp3This will upload the file "Vocals.mp3" from the current working directory (with a multipart/form-data POST request) and give a response like this:
Status code 201 means that the file was "created" on the server, and you can use the given file_id to use this file as input for any of the tasks.
<?xml version="1.0" encoding="utf-8"?> <response> <status code="201"/> <file file_id="b3fc0fd5-ec2c-489f-b1c3-867627092739" status="ready" href="/file/download?file_id=b3fc0fd5-ec2c-489f-b1c3-867627092739"/> </response>