Generative AI
Making API Requests for GenAI Results
2 min
all of the elevateai generative ai api endpoints use a similar format, leveraging the unique interactionidentifier returned upon successfully declaring the audio , transcript , or chat interaction when the desired get get request successfully executes, an http status is returned to indicate the request was successful, along with a json response providing details specific to that endpoint details specific to an individual endpoint are covered on the generative ai api endpoint details page all endpoints support a get method the ask elevateai endpoint supports both post and get methods please refer to the documentation for individual endpoints for additional details the general request format to be used for all of the generative ai api requests is as follows // // general request format tab examples url https api elevateai com v1 interactions interactionidentifier endpoint name retrieve generative ai response method get request pathparameters kind required name interactionidentifier type string description interactionidentifier returned upon successfully declaring the interaction name endpoint kind required type string description the specific api endpoint for the desired generative ai response endpoints are covered on the generative ai api endpoint details page children queryparameters headerparameters kind required name x api token type string description valid api key associated with your account for authentication and usage tracking kind optional name accept encoding type string description recommended for bandwidth optimization will be gzip deflate br name accept language kind optional type string description to be used for the summary endpoint only ignored for other endpoints specify the language code for the desired language of the response e g pt br default is english children bodydataparameters formdataparameters results languages id z4ojaichyk2u3vesn0hc code nresponse varies per endpoint see details on the generative nai api endpoint details page n language 200 customlabel id 6qttbzwcfezjoynvekz7j code r n errormessage string r n language 404 customlabel id mmxzg5yt44i1nrwptnsz0 language 408 code n errormessage string n customlabel id kfxidu7ujmwezkkpdmlgs language 409 code n errormessage string n customlabel id fxuu7xzds9skzxgkwqys6 language 422 code n errormessage string n customlabel id 8gwtb2s2si rzstxr43ns language 429 code n errormessage string n customlabel id kkg0mwjjz0tiqbag mrlg language 500 code n errormessage string n customlabel id efyxrewbsfmfamajrxirb language 504 code n errormessage string n customlabel selectedlanguageid efyxrewbsfmfamajrxirb examples languages id ummdkjjjmmc26zwnwt4zd language curl code curl location globoff https api elevateai com v1 interactions interactionidentifier endpoint n header accept application json n header content type application json customlabel id pwwvbxehuwgbzdr60de1a language nodejs code var request require request ; nvar options n method get n url https api elevateai com v1 interactions interactionidentifier endpoint n headers n accept application json n content type application json n n ; nrequest options function error response n if error throw new error error ; n console log response body ; n ; n customlabel id w2ghhrl avckiqarqdsv language javascript code var myheaders new headers ; nmyheaders append accept application json ; nmyheaders append content type application json ; n nvar requestoptions n method get n headers myheaders n redirect follow n ; n nfetch https api elevateai com v1 interactions interactionidentifier endpoint requestoptions n then response response text n then result console log result n catch error console log error error ; customlabel id kc32w5xjn4iia7sv9xzxb language python code import requests nimport json n nurl https api elevateai com v1 interactions interactionidentifier endpoint n npayload nheaders n accept application json n content type application json n n nresponse requests request get url headers headers data payload n nprint response text n customlabel id 7qsihiykdydm4cvf3i1ly language ruby code require uri nrequire json nrequire net http n nurl uri https api elevateai com v1 interactions interactionidentifier endpoint n nhttps net http new url host url port nhttps use ssl true n nrequest net http get new url nrequest accept application json nrequest content type application json n nresponse https request request nputs response read body n customlabel selectedlanguageid pwwvbxehuwgbzdr60de1a description currentnewparameter label header parameter value headerparameters // // retryable responses the following response codes leave the interaction endpoint in a retryable state calling code should handle these responses gracefully and retry appropriately response message meaning 408 requesttimeout the generative ai model was not able to respond in an acceptable amount of time 429 toomanyrequests by default, each account is allowed up to 10 simultaneous generative ai requests at one time this response indicates that more than 10 are being attempted