Submit an Interaction
Declare an Audio Interaction
Upload an Audio File
3 min
// // overview leveraging the unique interactionidentifier provided upon successfully declaring 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 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 in troubleshooting remember you can easily retrieve the processing status processing status of your interaction at any time! // // request parameters & code examples tab examples url https api elevateai com v1 interactions interactionidentifier upload name upload an interaction audio method post request pathparameters queryparameters headerparameters kind required name x api token type string description valid api key associated with your account for authentication and usage tracking bodydataparameters formdataparameters kind required name filename extension type string description parameter name will include the file type extension example filename wav with key providing path to local file results languages id ikvdsxifeiysauk1uae r code language 201 customlabel id ogn fhk6dtgaeyiv7jai code n errormessage string n language 400 customlabel id x6cj5u7giqecvl 2yh9jn code r n errormessage string r n language 401 customlabel id r7hyvo61gch9q quh9yrd code r n errormessage string r n language 409 customlabel id ahetomrrvklvugtebu xf code r n errormessage string r n language 413 customlabel selectedlanguageid ikvdsxifeiysauk1uae r examples languages id kwvfeilnlxh6 rbqvv a code curl location g request post https api elevateai com v1 interactions interactionidentifier upload n header x api token your api token n form filename wav path to file language curl customlabel id ghwoksuh8 z bynfz4eqk code var request require request ; nvar fs require fs ; nvar path require path ; n nvar filepath path to file n nvar options n method post n url https api elevateai com v1 interactions interactionidentifier upload n headers n x api token your api token n n formdata n filename wav n value fs createreadstream filepath n options n filename path parse filepath base n contenttype null n n n n ; nrequest options function error response n if error throw new error error ; n console log response body ; n ; n language nodejs customlabel id n9c0gdhrjpyuu1j yucew code var myheaders new headers ; nmyheaders append x api token your api token ; n nvar formdata new formdata ; nformdata append filename wav fileinput files 0 proxy ; n nvar requestoptions n method post n headers myheaders n body formdata n redirect follow n ; n nfetch https api elevateai com v1 interactions interactionidentifier upload requestoptions n then response response text n then result console log result n catch error console log error error ; language javascript customlabel id zeyyuzzwrn51zlfjklgiz code import requests n nurl https api elevateai com v1 interactions interactionidentifier upload n npayload nfiles n yourfilename extention yourfilename extention open path to file rb application octet stream n nheaders n x api token your api token n n nresponse requests request post url headers headers data payload files files n nprint response text language python customlabel id xs0yiye fd9e97ay7lad8 code require uri nrequire net http n nurl uri https api elevateai com v1 interactions interactionidentifier upload n nhttps net http new url host url port nhttps use ssl true n nrequest net http post new url nrequest x api token your api token nform data filename wav file open path to file nrequest set form form data multipart form data nresponse https request request nputs response read body language ruby customlabel id qzd 47 7rj83c9bkau0lm code var client new restclient https api elevateai com v1 interactions interactionidentifier upload ; r nclient timeout 1; r nvar request new restrequest method post ; r nrequest addheader x api token your api token ; r nrequest addfile filename wav path to file ; r nirestresponse response client execute request ; r nconsole writeline response content ; language csharp customlabel id fyoevnr8tt3npeymf8hu7 code ?php r nrequire once http request2 php ; r n request new http request2 ; r n request seturl https api elevateai com v1 interactions interactionidentifier upload ; r n request setmethod http request2 method post ; r n request setconfig array r n follow redirects true r n ; r n request setheader array r n x api token your api token r n ; r n request addupload filename wav path to file proxy content type header ; r ntry r n response request send ; r n if response getstatus 200 r n echo response getbody ; r n r n else r n echo unexpected http status response getstatus r n response getreasonphrase ; r n r n r ncatch http request2 exception e r n echo error e getmessage ; r n language php customlabel selectedlanguageid ghwoksuh8 z bynfz4eqk description currentnewparameter label header parameter value headerparameters