Initiate a session
/v2/live Creates a live session with its options and returns the WebSocket URL to stream its audio to.
Authentication: your API key in the x-gladia-key header (Authentication).
Example
curl -X POST https://eu1.api.gladia.io/v2/live \ -H "x-gladia-key: $GLADIA_API_KEY" \ -H "content-type: application/json" \ -d '{ "encoding": "wav/pcm", "sample_rate": 16000, "bit_depth": 16, "channels": 1, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "messages_config": { "receive_partial_transcripts": true } }'import os
import requests
API_URL = os.environ.get("GLADIA_API_URL", "https://eu1.api.gladia.io")response = requests.post( f"{API_URL}/v2/live", headers={"x-gladia-key": os.environ["GLADIA_API_KEY"]}, json={ "encoding": "wav/pcm", "sample_rate": 16000, "bit_depth": 16, "channels": 1, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "messages_config": { "receive_partial_transcripts": True } }, timeout=10,)response.raise_for_status()print(response.json())const API_URL = process.env.GLADIA_API_URL ?? "https://eu1.api.gladia.io";const response = await fetch(`${API_URL}/v2/live`, { method: "POST", headers: { "x-gladia-key": process.env.GLADIA_API_KEY, "content-type": "application/json", }, body: JSON.stringify({ "encoding": "wav/pcm", "sample_rate": 16000, "bit_depth": 16, "channels": 1, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "messages_config": { "receive_partial_transcripts": true } }),});if (!response.ok) { throw new Error(`${response.status} ${await response.text()}`);}console.log(await response.json());Try it
Parameters
-
regionstring · queryWhere the audio is processed. Every endpoint processes it in its own region (eu1: Europe, us1: United States); a region the endpoint does not serve finds no model and the session is refused.
one of:
eu,us,eu-west,us-west
Body
-
encodingstringEncoding of the audio you send.
default:
"wav/pcm"· one of:wav/pcm,wav/alaw,wav/ulaw -
bit_depthintegerBit depth of the audio.
wav/alawandwav/ulaware 8-bit.default:
16· one of:8,16,24,32 -
sample_rateintegerSample rate of the audio, in Hz.
default:
16000· one of:8000,16000,32000,44100,48000 -
channelsintegerNumber of interleaved audio channels. Each channel is transcribed on its own: put each speaker of a call on their own channel to know who said what without diarization.
default:
1· 1 to 8 -
custom_metadataobjectAny JSON object, kept with the session: returned by
GET /v2/live/{id}, sent to your callback, and a filter ofGET /v2/live. -
modelstringThe model, by name, optionally with a latency profile (
solaria-3-fast), or a latency profile alone (fast). Omitted: the default model of your account.one of:
solaria-3,solaria-1,trantoria-1,solaria-3-fast,solaria-3-medium,solaria-3-balanced,solaria-3-precise,solaria-1-fast,solaria-1-medium,solaria-1-balanced,solaria-1-precise,trantoria-1-fast,trantoria-1-medium,trantoria-1-balanced,trantoria-1-precise,fast,medium,balanced,precise -
endpointingnumberSilence, in seconds, that ends an utterance and produces its final transcript. Short values give faster finals and may cut sentences at hesitations.
default:
0.64· 0.01 to 10 -
maximum_duration_without_endpointingnumberLongest utterance, in seconds: a final is forced after this much speech without a pause. Omitted: no limit.
5 to 60
-
language_configobjectThe languages to expect.
2 fields
-
languagesarray of stringThe languages that may be spoken (ISO 639-1 codes). Empty: the language is detected. One or more codes: the session is transcribed in the first one, unless
code_switching. -
code_switchingbooleanDetect the language as the conversation goes, among
languageswhen given: for speakers who switch languages.default:
false
-
-
realtime_processingobjectProcessing applied to each final transcript, during the session.
8 fields
-
custom_vocabularybooleanBias the transcription toward the words of
custom_vocabulary_config.default:
false -
custom_vocabulary_configobjectThe words to favour. Required with
custom_vocabulary.default:
null2 fields
-
vocabularyarray of string or object requiredWords or phrases, as strings or as objects with their own options.
3 fields
-
valuestring requiredThe word or phrase.
-
intensitynumberHow strongly it is favoured, from 0 to 1.
default:
null· 0 to 1 -
pronunciationsarray of stringOther ways it may be pronounced, written as they sound.
default:
null
-
-
default_intensitynumberHow strongly the words are favoured, from 0 to 1, when an entry sets none.
default:
null· 0 to 1
-
-
custom_spellingbooleanRewrite words as
custom_spelling_configsays.default:
false -
custom_spelling_configobjectThe spellings to apply. Required with
custom_spelling.default:
null1 fields
-
spelling_dictionaryobject requiredThe spelling to write (key) for each variant heard (values):
{"Gladia": ["gladya", "glad ia"]}. Whole words, case-insensitive.
-
-
translationbooleanTranslate each final transcript into the target languages.
default:
false -
translation_configobjectThe target languages. Required with
translation.default:
null1 fields
-
target_languagesarray of string requiredThe languages to translate into (ISO 639-1 codes).
at least 1 item(s)
-
-
named_entity_recognitionbooleanThe same as the top-level
named_entity_recognition: true.default:
false -
sentiment_analysisbooleanThe sentiment (positive, neutral, negative) and emotion of each final, in a
sentiment_analysismessage after it.default:
false
-
-
messages_configobjectThe messages sent on the WebSocket.
9 fields
-
receive_partial_transcriptsbooleanPartial transcripts, updated while the utterance is spoken.
default:
false -
receive_final_transcriptsbooleanThe final transcript of each utterance.
default:
true -
receive_speech_eventsbooleanspeech_startandspeech_end.default:
true -
receive_pre_processing_eventsbooleanPre-processing messages.
default:
true -
receive_realtime_processing_eventsbooleanMessages of the realtime processing:
translation,named_entity_recognition,sentiment_analysis.default:
true -
receive_post_processing_eventsbooleanpost_transcriptandpost_final_transcript, at the end.default:
true -
receive_acknowledgmentsbooleanaudio_chunkandstop_recordingacknowledgments.default:
true -
receive_errorsbooleanerrormessages.default:
true -
receive_lifecycle_eventsbooleanstart_recording,end_recordingandend_session.default:
false
-
-
callbackbooleanAlso send the session's messages to
callback_config.url, by HTTP POST.default:
false -
callback_configobjectWhere and which messages the callback receives. Required with
callback.default:
null10 fields
-
urlstring requiredThe HTTPS URL that receives the messages, one POST each.
uri
-
receive_partial_transcriptsbooleanPartial transcripts.
default:
false -
receive_final_transcriptsbooleanFinal transcripts.
default:
true -
receive_speech_eventsbooleanspeech_startandspeech_end.default:
false -
receive_pre_processing_eventsbooleanPre-processing messages.
default:
true -
receive_realtime_processing_eventsbooleanMessages of the realtime processing.
default:
true -
receive_post_processing_eventsbooleanpost_transcriptandpost_final_transcript.default:
true -
receive_acknowledgmentsbooleanAcknowledgments.
default:
false -
receive_errorsbooleanerrormessages.default:
false -
receive_lifecycle_eventsbooleanstart_session,start_recording,end_recordingandend_session.default:
true
-
-
profilestringLatency profile:
fastgives the earliest transcripts,precisethe most accurate ones. The same as a profile inmodel.default:
null· one of:fast,medium,balanced,precise -
diarizationbooleanSpeaker labels on single-channel audio: each utterance and word gets a
speakernumber.default:
false -
diarization_configobjectDiarization options.
2 fields
-
number_of_speakersintegerExpected number of speakers, when you know it.
at least 1
-
max_speakersintegerHighest number of speakers to tell apart.
at least 1
-
-
punctuationbooleanPunctuation and casing of the transcripts. On unless
false.default:
true -
end_of_turnboolean or objectEnd-of-turn detection for voice agents: an
end_of_turnmessage when the speaker has finished their turn, judged from how they speak and not from silence alone.trueuses the defaults (GET /v2/live/defaults), an object overrides some of them. Off when omitted.default:
false7 fields
-
thresholdnumberEnd-of-turn probability, between 0 and 1 (excluded), above which the turn ends.
default:
null· 0 to 1 -
silence_msintegerSilence, in milliseconds, before a turn is evaluated.
default:
null· 0 to 10000 -
stop_snumberSilence, in seconds, that ends the turn whatever the probability.
default:
null· 0 to 60 -
emit_scoresbooleanAlso send an
end_of_turn_scoremessage for each evaluation, to calibratethreshold.default:
null -
window_snumberAudio, in seconds, an evaluation reads before the silence (at most 8).
default:
null· 0 to 8 -
speech_dbfsnumberLevel, in dBFS, under which audio counts as silence.
default:
null· -100 to 0 -
reeval_msintegerInterval, in milliseconds, between two evaluations of the same silence.
default:
null· 0 to 10000
-
-
numeralsboolean or objectSpoken numbers, amounts and clock times written with digits in the final transcripts ("one thousand three hundred fifty five dollars" becomes "$1,355", "at nine fifteen" "at 9:15");
text_rawkeeps the words. Where the turn router runs (the default; not withturn_router: false), it guides them: phone numbers are also written in their country's format ("06 12 34 56 78") and dates the language's way ("March 12, 2026").trueuses the countries of the language spoken, an object sets the country.default:
false1 fields
-
regionstringThe country whose phone numbers and dates the transcripts are written in: an ISO 3166-1 alpha-2 code in capitals (
CH,CA). Omitted: the countries where the language is spoken.default:
null
-
-
named_entity_recognitionboolean or objectNamed entities (people, places, organizations, dates, amounts…) tagged in the final transcripts, and a
named_entity_recognitionmessage after each final.truetags every type.default:
false2 fields
-
entitiesstring or array of string or objectWhich types: a preset (
pii,pci,phi,contact,financial,name,location,date…), a list of types and presets, or{"enable": [...], "disable": [...]}.2 fields
-
enablearray of string -
disablearray of string
-
-
thresholdnumberConfidence, from 0 to 1, under which an entity is ignored.
default:
0.5· 0 to 1
-
-
piiboolean or objectPersonal data (names, phone numbers, emails, card numbers…) redacted in the final transcripts, and a
piimessage after each final. With redaction on, no partial transcript is sent.default:
false6 fields
-
entitiesstring or array of string or objectWhich types to redact: a preset (
pii, the default;pci,phi,contact,financial…), a list of types and presets, or{"enable": [...], "disable": [...]}.default:
"pii"2 fields
-
enablearray of string -
disablearray of string
-
-
modestringmarkerreplaces the data with an element (<pii:phone_number id="1"/>),maskwith mask characters inside the element,tagkeeps the text inside the element.default:
"marker"· one of:marker,mask,tag -
thresholdnumberConfidence, from 0 to 1, under which a span is not redacted.
default:
0.5· 0 to 1 -
mask_characterstringThe character of
maskmode.default:
"*" -
coreferencestringHow mentions of the same entity get the same
id:heuristics(the default),exact(same text only) oroff.default:
"heuristics"· one of:heuristics,exact,off -
return_entitiesbooleanAlso return the redacted text in the
piimessage (text).default:
false
-
-
turn_routerboolean or objectThe number hold: an utterance stays open while a number, an amount or an address is still being dictated, so it is not cut at each pause. On by default where the model supports it;
falseturns it off.1 fields
-
holdbooleanThe number hold.
-
Responses
201 The session is created.
-
idstring requiredIdentifier of the session (a time-ordered UUID).
-
created_atstring requiredCreation date (ISO 8601, UTC).
-
urlstring requiredWebSocket URL to stream the audio to. It carries a single-use token: connect within 60 seconds. Reconnecting to the same URL after a dropped connection resumes the session.
{ "id": "0199d7a2-5c3e-7b41-9f0a-3c2d1e4f5a6b", "created_at": "2026-10-12T09:04:17.210Z", "url": "wss://eu1.api.gladia.io/v2/live?token=eyJhbGciOi..."} 400 The request is invalid: validation_errors lists why.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"}401 No API key, or an unknown one.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"} 402 Your workspace has no credits left (insufficient_credits): new sessions are refused until credits are added; sessions already running are not stopped.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"}403 The key may not do this (its scopes, or the addresses it may be used from).
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"}429 Your account already has its maximum number of open sessions.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"} 500 No model in this region runs the session as asked (its model, languages and features together), or none has room right now: no inference endpoint available.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"}503 The service cannot answer right now: try again.
{ "statusCode": 400, "timestamp": "2026-10-12T09:04:17.210Z", "path": "/v2/live", "message": "Invalid parameter(s). See validation_errors for more details.", "request_id": "G-1a2b3c4d", "validation_errors": [ "sample_rate Input should be 8000, 16000, 32000, 44100 or 48000" ], "error": "string"}