Asynchronous transcription


In order to perform an asynchronous transcription, you must use a combination of the Generate pre-signed URL and Get transcription status functions.

Performing an asynchronous transcription

Available since API version: 2025-10-01

Below we will recommend a procedure to complete this task:

  1. Generate a Pre-signed URL for the audio file you want to transcribe. Remember that all the features to complete this task can be found at: Generate Pre-signed URL.
  2. Upload the audio file to the generated Pre-signed URL. Below is an example that performs this task:
TypeScript
fetch(presignedUrl, {
  method: "PUT",
  headers: {
    "Content-Type": "audio/wav",
  },
  body: preRecordedAudio as File,
})
  .then((response) => {
    if (response.ok) {
      // implement logic for successful request here
    } else {
      // implement logic for unsuccessful request here
    }
  })
  .catch((error) => {
    // implement the logic here when an exception occurs
  });
C#
using var client = new HttpClient();
var content = new ByteArrayContent(preRecordedAudio);
content.Headers.ContentType =
    new System.Net.Http.Headers.MediaTypeHeaderValue("audio/wav");

var response = await client.PutAsync(presignedUrl, content);

if (response.IsSuccessStatusCode)
{
    // implement logic for successful request here
}
else
{
    // implement logic for unsuccessful request here
}
Java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create(presignedUrl))
    .header("Content-Type", "audio/wav")
    .PUT(HttpRequest.BodyPublishers.ofByteArray(preRecordedAudio))
    .build();

HttpResponse<String> response = client.send(
    request, HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 200) {
    // implement logic for successful request here
} else {
    // implement logic for unsuccessful request here
}
Python
import requests

response = requests.put(
    presigned_url,
    data=pre_recorded_audio,
    headers={"Content-Type": "audio/wav"},
)

if response.ok:
    # implement logic for successful request here
    pass
else:
    # implement logic for unsuccessful request here
    pass

From this point on, all that remains is to wait for the audio transcription to finish. To know when this process ends, we can use two methods:

  1. If the callbackUrl parameter was sent when generating the Pre-signed URL, once the transcription is finished, the result of the transcription will be sent to the URL passed in this field.
  2. The /api/get-transcription endpoint can be called. For more details on how to use this endpoint, you can see the section: Get transcription status.