How to Set Up the Rev AI API in Postman

RevBlogResourcesOther ResourcesSpeech-to-Text APIsHow to Set Up the Rev AI API in Postman

When working with the Rev transcription services, you’ll be interfacing with either the Rev.com or Rev.ai APIs. For more details on the differences and the use cases for these, see our article here. If you’d like to learn how to work with the Rev.com API for 99% accurate human-powered transcription, click here. In this article, we’ll walk you through how to get your credentials for the Rev.ai API up and running, how to perform authentication and log-in, and how to submit requests to various endpoints in order to get your transcriptions completed.

The Rev AI API provides machine-generated transcripts rather than human-powered transcripts, so it’s better for quick calls, fast turnaround times, and building speech recognition into applications and software. The Rev.com API is for highly accurate transcripts when you’re able to wait about 24 hours for the transcription professionals to work on your transcripts.

The Rev.ai API uses advanced artificial intelligence and machine learning to process your audio or video files and generate accurate transcriptions. More specifically, it uses speech-to-text models to match the speakers in your audio, determine what they’re saying, and record the result as text. The Rev.ai algorithms are smart enough to parse a speaker’s words, regardless of accent, disfluencies, background noise, and other complications in the audio. The APIs allow you to authenticate into your business account, submit and manage requests, monitor the status of orders, and receive transcription results as a simple download. Ready to get started?

Creating an Account and Generating an Access Token

To get started with the API, you’ll need to sign up for a free account on the Rev.ai homepage. Once you’ve done so, login to your account and proceed to the “access token” link on the sidebar. This will take you to a page that looks like this:

You’ll want to click on the button that says “generate token” and copy the result to your clipboard. This access token will be your key into the Rev.ai APIs for submitting and managing your transcription orders.

Your account will come pre-loaded with 300 free minutes of transcription, plenty of time to test out the API and assess whether it will work for your needs. Let’s create an order to get us started. Fire up Postman and create a new request. Go ahead and create a collection to save it in as well. You can call the collection something like “Rev.ai API”.

Now before we submit a job, we’ll have to add something called an authorization header to the request. This header allows you to authenticate with the Rev.ai API. Click on the tab in Postman that says “Authorization”. Then in the dropdown next to “Type” select the value “API Key”. For the Key entry, type in “Authorization”, and as your value type “Bearer” followed by your access token as shown in this screenshot. Replace $ACCESS_TOKEN with the actual value of your token as copied from your account page.

Now, the Rev.ai API actually has two different versions. The first is an asynchronous API which allows you to submit jobs and have them process in the background. The API can then be configured to notify you when the job finishes and you can download your transcription. This is the version of the API that most people will use.

The other version is a streaming API which is used for jobs that require real-time transcriptions. This can be useful, for example, if you’re live streaming a podcast and want transcriptions generated for your users on the fly but you don’t want to shell out for a live transcriptionist. We’re going to cover the asynchronous API in this post.

The base url for the asynchronous API is

https://api.rev.ai/speechtotext/v1

This is the URL to which endpoints are appended. So each request will be made to this url, plus one specific endpoint specifying the function to be used. For submitting a transcription job, we’ll be using the jobs endpoint.

Submitting a File

There are two ways to submit a file to the Rev.ai API. The first is to host the file on a server somewhere (such as your website or a podcasting platform) and then point Rev.ai to it. It is passed to the API using a key called “media_url”. This is probably the most convenient way for most users as it’s just a bit easier to submit a url through a request rather than a file. Rev.ai will handle the downloading of the file on its backend, so no need to worry about that. Note that you can’t use a Youtube URL as this is not a direct download link.

The other way to submit a file is via a direct upload as part of the POST request to the API. For this you need to use an encoding called multipart/form-data. Note, if you use this format you are restricted to files less than 2 GB in size. This is what we’ll use in this tutorial. Here’s how to provide a file in Postman. Navigate to the tab that says “body”, and hover over the “Key” field. You should see a small drop down field appear. Click that and select “File”.

Now you’ll be able to click the “select files” button underneath VALUE to upload your files. For this test, I’ll be using an MP3 audio file containing the Fresh Prince of Bel-Air theme song. In the box for KEY type “media”.

You can also provide an “options” key with a json value that specifies options to use with the request. The complete list of options is available in the API documentation. We will provide one option called “metadata” which just allows us to specify a short description of the audio file that we can use to reference it in the future.

Once you’ve got all of that info in there go ahead and enter the URL, make sure POST is selected as the request type, and click “Send”.

If the request is successful, you should get a response that looks like this.

You can see it has the ID of the request, the date it was created, the name of the audio file, the metadata description we provided, the current status of the transcription progress, and the type of the API we used, in our case “async”.

Now that the Rev.ai machine learning models are working on our request, let’s go ahead and keep tabs on it. We’ll create a new GET request that we can use to query the API and check the status of this job.

This request will be much simpler than the one before. We use the exact same URL, but we set the request type to get. We also use the same authorization headers as before. Finally, we add a key called “id” and set its value to be the order id that we received in response to the original POST request.

If the request is successful, you should see a result like the above. You’ll see that our order has finished and the file has been transcribed. Now we just need to download the transcription file!

Getting a Transcript

To download our transcript, we’ll use the “transcript” feature of the /jobs endpoint. This will be a simple GET request as before. Go ahead and create the new request in Postman and save it to the Rev.ai collection.

We’ll need to use the same Authorization header as in all our previous requests. We’ll also need to add one additional header called “Accept” which tells the API what format we want to receive our data in. Our choices are

application/vnd.rev.transcript.v1.0+json 

or

text/plain

For simplicity, we’ll use text/plain which will just give us the output as plain text that we can then copy into a Word document or similar file. The JSON version can be useful because it gives you confidence scores for each word in the transcription. You can then use these to, for example, filter out and manually correct words with a low confidence score.

Note that you’ll also want to uncheck the existing “Accept” header before adding your own. It should look something like this when finished.

Now, we can submit the final request. The full endpoint for getting your transcript will be

GET /jobs/{id}/transcript

You will need to substitute your actual job id for {id} in the url. Let’s take a look at the final version of our request URL as well as the plain text output that is returned as the response.