By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

"Hello World" Example

In this post we show in three steps what is needed to run your first transcription using Voicegain API.

We assume that you already signed up for Voicegain account and logged into the portal.

Step 1: Create new Context

Main reason to create new Context is to establish new authentication realm. Access to each Context can be separately controlled, so it is easy to disable access to certain Context without affecting other Contexts.

Contexts are also used for specifying default ASR settings.

You can create a new Context from the Context Dash

Creating new Context in Voicegain Web Portal

Step 2: Generate Authentication token

Voicegain APIs use JWT (JSON Web Tokens) to identify and authenticate the account making the request. In order to make API requests you need to generate a JWT which can easily be done from the portal.

Generate new JWT token from Voicegain Portal

Step 3: Run the curl command

Below is the complete input and output from curl command that submits a Web API request to Voicegain Synchronous Speech-to-Text API

$ curl -i -H 'Content-Type: application/json' \> -H 'Accept: application/json' \> -H "Authorization: Bearer  eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2FwaS52b2ljZWdhaW4uYWkvdjEiLCJzdWIiOiIwMTdkYTYzMy1iZTgwLTRhMjQtOWI2Yi03NTkzYzRhZjZhMjgifQ.8Vi9K4Or0sFPbieMusA6MHFRvojlQof1WazsClJFFeI" \> -d '{"audio" : {"source" : {"fromUrl" : {"url" : "" }}}}' \>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 Dload  Upload   Total   Spent    Left  Speed100   385    0   213  100   172     34     28  0:00:06  0:00:06 --:--:--    57HTTP/2 200server: openrestydate: Thu, 19 Mar 2020 22:42:24 GMTcontent-type: application/json;charset=UTF-8vary: Accept-Encodingstrict-transport-security: max-age=15724800; includeSubDomains{"session":{"sessionId":"0-0k7zcawfu003b9ug37u1x26pbjp8"},"result":{"status":"MATCH","lastEvent":"RECOGNITION-COMPLETE","alternatives":[{"utterance":"hello is any one out there","confidence":0.8323419690132141}]}}

In this case, the audio to be transcribed was retrieved from a URL. Audio can alternatively also be submitted in-line (within request).

Note that synchronous transcription has audio length limit of 60 seconds. Longer audio requires use of asynchronous transcription API.

For asynchronous transcription requests it is possible to stream the audio, e.g. via websocket. You can see some of Voicegain API documentation at:

Sign up for an app today
* No credit card required.


Interested in customizing the ASR or deploying Voicegain on your infrastructure?

Contact Us →