Quickstart
The quickest way to try transcribing for free is by creating a Speechmatics account and using our web portal.
Set up your transcription job and click the button on the output page to get the code and use it in the API.
Using the Batch API
1. Create an API key
Create an API key in the portal here, which you'll use to securely access the API. Store the key as a managed secret.
Enterprise customers may need to speak to Support to get your API keys.
2. Pick and install a library
Check out our Batch Python client or JavaScript client to get started.
Install using pip:
pip install speechmatics-batch
Install using NPM:
npm install @speechmatics/batch-client
3. Grab a sample file
Download and save our example.wav
4. Insert API key
Paste your API key into YOUR_API_KEY in the code below.
import asyncio
from speechmatics.batch import AsyncClient, TranscriptionConfig
API_KEY = "YOUR_API_KEY"
AUDIO_FILE= "example.wav"
config = TranscriptionConfig(
diarization="speaker"
)
async def main():
client = AsyncClient(api_key=API_KEY)
result = await client.transcribe(
audio_file=AUDIO_FILE,
transcription_config=config
)
print(result.transcript_text)
await client.close()
asyncio.run(main())
You should see the following output:
SPEAKER S1: Welcome to Speechmatics. We're delighted that you've decided to try our speech to text software to get going. Just create an API key and submit a transcription request to our API. We hope you'll be very impressed by the results. Thank you.
// This example transcribes a file in NodeJS.
// For examples in other environments, see the link above
import { openAsBlob } from "node:fs"; //
import { BatchClient } from "@speechmatics/batch-client"; //
const client = new BatchClient({
apiKey: YOUR_API_KEY,
appId: "nodeJS-example",
}); //
console.log("Sending file for transcription...");
async function transcribeFile() {
const blob = await openAsBlob("./example.wav");
const file = new File([blob], "example.wav");
const response = await client.transcribe(
file,
{
transcription_config: {
language: "en",
operating_point: "enhanced",
},
},
"json-v2",
);
console.log("Transcription finished!");
console.log(
// Transcripts can be strings when the 'txt' format is chosen
typeof response === "string"
? response
: response.results.map((r) => r.alternatives?.[0].content).join(" "),
);
}
transcribeFile();
You should then see the following output:
Sending file for transcription...
Transcription finished!
Welcome to Speechmatics . We're delighted that you've decided to try our speech to text software to get going . Just create an API key and submit a transcription request to our API . We hope you'll be very impressed by the results . Thank you .
Next Steps
Now that you have a basic transcription working, explore these features to get more out of your audio.