Upload an Audio File
// Overview
Leveraging the unique interactionIdentifier provided upon successfully declaring an audio interactiondeclaring the audio interaction, this endpoint enables you to upload valid audio for processing directly from the host machine as a multipart/form-data request.
Pro tip: Providing access to audio files via the downloadUri is highly recommended for fastest processing times.
When this POST request successfully executes, an HTTP status is returned to indicate the request was successful and the file is in the process of being uploaded by the Service.
If an error occurs when requesting to upload interaction, a standard HTTP response code is retuned to indicate the request was unsuccessful, along with a JSON response containing additional details to assist with troubleshooting.
Remember: You can easily retrieve the processing statusprocessing status of your interaction at any time; click hereclick here for more.
// Request Parameters & Code Examples
var request = require('request');
var fs = require('fs');
var path = require('path');
var filepath = '/path/to/file'
var options = {
'method': 'POST',
'url': 'https://api.elevateai.com/v1/interactions/{interactionIdentifier}/upload',
'headers': {
'X-API-Token': '{Your-API-Token}'
},
formData: {
'filename.wav': {
'value': fs.createReadStream(filepath),
'options': {
'filename': path.parse(filepath).base,
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Need more help? Contact the ElevateAI Support team.