Back to cookbook
STTBeginnerBatchpython

Transcribe an audio file

Run your first async transcription with a local audio file or public audio URL.

What you will build

This guide runs the official Soniox async transcription example against an audio file and prints the transcript in your terminal.

Use async transcription when you already have a recorded file. Soniox accepts either a public audio URL or a local file uploaded through the Files API.

Before you start

Create a Soniox account, open the Console, and create an API key for your project. Export it in your terminal:

export SONIOX_API_KEY=<YOUR_API_KEY>

Clone the official examples repository:

git clone https://github.com/soniox/soniox_examples
cd soniox_examples/speech_to_text/python_sdk

Set up Python dependencies:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Transcribe the sample file

Run the async SDK example with the included sample audio file:

python soniox_sdk_async.py --audio_path ../assets/coffee_shop.mp3

The script uploads the local file, creates a transcription job, waits for completion, fetches the transcript, prints it, and cleans up the uploaded file and transcription.

Transcribe a public audio URL

If your audio file is already available over HTTP, pass its URL instead:

python soniox_sdk_async.py --audio_url "https://soniox.com/media/examples/coffee_shop.mp3"

For local files, the async API uses a file_id. For public files, it uses audio_url.

Use your own audio

Replace the sample path with your own file:

python soniox_sdk_async.py --audio_path /path/to/audio.mp3

Soniox detects the audio format for file transcription. Supported formats include aac, aiff, amr, asf, flac, mp3, ogg, wav, webm, m4a, and mp4.

Next step

Open the async transcription docs when you are ready to wire the same flow into your application. The lower-level API flow is:

  • Upload a local file with the Files API, or pass a public audio_url.
  • Create a transcription job.
  • Wait for the job to complete or receive a webhook.
  • Fetch the transcript.
  • Delete temporary files and finished transcriptions when you no longer need them.

Start building with Soniox

Get an API key in the console, then use the docs to connect the cookbook pattern to your application.