Skip to content

Pre-recorded (batch) transcription of an audio file

Pre-recorded transcription turns a whole file (a call recording, a meeting, a podcast episode) into a transcript in one job. You send the file and its options, the API transcribes it in the background, and you read the result when it is done, or get it pushed to your server with a callback.

The API is Gladia’s pre-recorded API: the same paths, request and response bodies. Code written for Gladia’s cloud works here once its address and API key are changed, and the official SDKs work as they are.

Endpoints POST /v2/upload, POST /v2/pre-recorded, GET /v2/pre-recorded/{id}
Files Audio and video files up to 1000 MB, or a public URL (formats and limits)
Languages Every language of the model (the list)
Options Speakers, subtitles, translation, summarization and the other add-ons
Results Read with GET /v2/pre-recorded/{id}, or pushed with a callback
  1. Upload the file with POST /v2/upload. You get back an audio_url. A file already reachable on the internet can skip this step: give its URL directly in step 2.
  2. Create a job with POST /v2/pre-recorded: the audio_url and the options. You get back the job’s id.
  3. Read the job with GET /v2/pre-recorded/{id} until its status is done; its result holds the transcript.
Terminal window
curl -X POST https://eu1.api.gladia.io/v2/upload \
-H "x-gladia-key: $GLADIA_API_KEY" \
-F "audio=@call.wav"

The answer gives the file’s audio_url and what the API read of it:

{
"audio_url": "https://eu1.api.gladia.io/file/0199d7a2-0000-7000-8000-00000000f11e",
"audio_metadata": {
"id": "0199d7a2-0000-7000-8000-00000000f11e",
"filename": "call.wav",
"extension": "wav",
"size": 960044,
"audio_duration": 30.0,
"number_of_channels": 1,
"source": null
}
}

A file already online can be uploaded by its URL instead: send it as JSON, and the API downloads it and answers as above, audio_metadata.source being that URL. Use it when the link expires before your job runs (a presigned link of your bucket), or to keep a copy of the file with the job:

Terminal window
curl -X POST https://eu1.api.gladia.io/v2/upload \
-H "x-gladia-key: $GLADIA_API_KEY" \
-H "content-type: application/json" \
-d '{"audio_url": "https://files.example.com/calls/call.wav"}'
  • The same size limit as a file sent in the form (413 above it), counted in the same uploads at once.
  • The URL must be http or https, at a public address: a private, loopback or link-local address (10.x, 192.168.x, 127.0.0.1, 169.254.169.254) is refused (400), redirects included. Up to 5 redirects are followed.
  • A file the server does not serve (404, 403), a host that does not resolve or does not answer within 30 s, an empty file, or a file the server sends compressed (Content-Encoding: gzip: serve it as is) is a 400 whose validation_errors says which; nothing is stored.
  • On a cluster that does not transcribe from URLs (an on-premise one, as its operator chose), the JSON form is refused (400): send the file in the form.

Then start the job with that audio_url:

Terminal window
curl -X POST https://eu1.api.gladia.io/v2/pre-recorded \
-H "x-gladia-key: $GLADIA_API_KEY" \
-H "content-type: application/json" \
-d '{"audio_url": "https://eu1.api.gladia.io/file/0199d7a2-0000-7000-8000-00000000f11e", "language_config": {"languages": ["en"]}, "diarization": true}'
{
"id": "0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e",
"result_url": "https://eu1.api.gladia.io/v2/pre-recorded/0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e"
}

And read it until it is done:

Terminal window
curl https://eu1.api.gladia.io/v2/pre-recorded/$JOB_ID \
-H "x-gladia-key: $GLADIA_API_KEY"

status goes from queued (waiting to start) to processing (being transcribed), then done (the result is there) or error (error_code says why). Read it every few seconds: a file is usually transcribed in a fraction of its duration.

A done job’s result.metadata says how much audio was transcribed and how fast (the job, shortened):

{
"id": "0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e",
"kind": "pre-recorded",
"status": "done",
"result": {
"metadata": {
"audio_duration": 600.0,
"number_of_distinct_channels": 4,
"billing_time": 2400.0,
"transcription_time": 31.2,
"processing_time": 40.0,
"rtfx": 60.0
}
}
}
  • audio_duration: the file’s duration, in seconds.
  • billing_time: the audio transcribed, every channel counted: a 10 min file with 4 channels is 40 min.
  • processing_time: from the job’s creation (your file uploaded) to its end, its wait in the queue included: what you waited.
  • rtfx: billing_time / processing_time, the seconds of audio transcribed per second waited. 60: one hour of audio done in one minute.
  • transcription_time: the part of it the transcription itself took.

processing_time and rtfx come with GET /v2/pre-recorded/{id} and the list. The transcription.success callback carries the result as it was made, without them: read the job to get them.

A live session of yours that ended with its audio recorded can be the file: give its id as from_session_id in place of audio_url. The pass transcribes the call’s recording, and its live transcript speeds it up (it is used as a draft, never as the result). This is the post-call pass that finalization runs for you at the end of a session.

{
"from_session_id": "0199d7a2-0000-7000-8000-0000000c0a11",
"model": "solaria-3",
"diarization": true
}
  • Exactly one of audio_url and from_session_id.
  • The session must be yours (a member’s key reaches its own sessions only), ended, and recorded: anything else is a 400 (from_session_id: no such live session, ... has not ended, ... was not recorded). The key needs the live scope (realtime_stt) as well, else a 403.
  • The job’s file is the session’s recording (source: /v2/live/{id}/file).

The official SDK does the three steps in one call, and polls for you:

transcribe_file.py
import os
import sys
from gladiaio_sdk import GladiaClient
API_URL = os.environ.get("GLADIA_API_URL", "https://eu1.api.gladia.io")
client = GladiaClient(api_key=os.environ["GLADIA_API_KEY"], api_url=API_URL)
# A local file is uploaded first; a URL is transcribed directly.
job = client.prerecorded().transcribe(
sys.argv[1],
{"language_config": {"languages": ["en"]}, "diarization": True},
interval=1,
)
print(job.result.transcription.full_transcript)

The options are Gladia’s pre-recorded options: model, language_config, diarization, translation, summarization, named_entity_recognition, sentiment_analysis, pii_redaction, custom_vocabulary, custom_spelling, subtitles, sentences, and the custom_metadata you want back with the job. The API reference lists them all, and Add-ons says what each add-on returns and which run on Gladia Enterprise. An option the API does not know, or a value of the wrong type, is refused with a 400 before anything starts, and validation_errors says which.

model is solaria-1 (the default) or solaria-3; each has its own price per hour of audio. On a cluster whose pre-recorded hosts do not serve solaria-1, a job that names it runs on the model they serve. Models are named by the same code names as in real time. trantoria-1, solaria-4 and the solaria-2 family (solaria-2, solaria-2.1, solaria-2-med-en, solaria-2-med-de, solaria-2-en-dict) are on Gladia’s staging only for now, unbilled, while they are measured: they have no price yet, so every other cluster refuses them with a 400 before the job starts (validation_errors names the models the cluster takes). A name off the list, such as Gladia’s solaria-fusion, is refused with a 400 everywhere. audio_to_llm runs once your cluster connects an LLM for it (Add-ons).

custom_metadata stays with your job: it comes back in the job, in its callback, and filters the list (GET /v2/pre-recorded?custom_metadata={"call_id":"42"}).

  • GET /v2/pre-recorded lists your jobs, newest first, with the same filters as Gladia’s API (status, date, before_date, after_date, custom_metadata) and a next link to the following page.
  • GET /v2/pre-recorded/{id}/file downloads the file of a job, when it was uploaded with POST /v2/upload.
  • DELETE /v2/pre-recorded/{id} deletes a job, its result and its uploaded file. A running job is stopped.
Terminal window
curl -X DELETE https://eu1.api.gladia.io/v2/pre-recorded/$JOB_ID \
-H "x-gladia-key: $GLADIA_API_KEY"
  • Not on every cluster yet. Where pre-recorded transcription is not turned on, POST /v2/upload and POST /v2/pre-recorded answer 400 (“… on this cluster”): do not retry.
  • One upload, your jobs only. An audio_url of POST /v2/upload works for your workspace’s jobs only; another workspace gets 400 audio_url: no such uploaded file.
  • One upload, many jobs. An audio_url of POST /v2/upload feeds any number of your jobs: to compare options, models or add-ons on the same file, send one job per option set without uploading the file again. Deleting a job keeps the file while another job uses it; the last job’s deletion deletes it.
  • Files up to 1000 MB. A larger upload is refused with 413. The formats, the other limits and the online video URLs (YouTube, TikTok) a job takes: Supported formats and limits.
  • Limits per workspace: 8,100 s of audio per file, 200 jobs created per minute, 300 jobs waiting and 25 processing at once, as on Gladia’s API. See Pre-recorded limits.
  • 5 uploads at once per workspace (your account manager can raise it). One more is answered 429 with a Retry-After header: wait that many seconds and send it again. Uploads that ended free their place at once.
  • The duration of a non-WAV upload is null in audio_metadata: the API does not decode the file at upload. The job’s file.audio_duration gives it once transcribed.
  • API keys with scopes need the Pre-recorded STT scope (async_stt) for the pre-recorded API.
  • A failed job is not billed. A job is billed on its result.metadata.billing_time, once done.
  • The older /v2/transcription paths of Gladia Classic (Gladia’s cloud API) work too, on the same jobs: they are deprecated aliases of /v2/pre-recorded, kept only for clients migrated from Gladia Classic, and may be removed (decommissioned) in a future release. Do not use them in new integrations (API reference).