Gladia
Gladia
Let agents transcribe recorded audio and video with Gladia, then read what was said, who said it and when.
- Transcribe a recording from a public link, or upload a file first.
- Read the transcript with word timings, the detected language and speaker labels.
- Ask for summaries, translations, named entities, sentiment, custom vocabulary or PII redaction alongside the transcript.
- Browse recent transcriptions and download the audio each one used.
- With Write access: upload recordings, start new transcriptions and delete old ones.
Gladia bills each accepted transcription to your account by audio duration. Gladia does not deduplicate requests: sending the same recording twice creates two separately billed jobs.
Read access reads and downloads but cannot create or delete anything. This connector covers recorded audio up to 135 minutes (4 hours 15 minutes on Enterprise) and 1000 MB per job, not live transcription from a microphone.
Setup instructions
Setup instructions
Connect your Gladia account
- Choose the level for Access:
- Read to let agents read and download transcriptions without creating or deleting anything.
- Write to also let agents upload recordings, start transcriptions and delete jobs.
- Create an API key in the Gladia dashboard and copy it.
- Add the connection in Houston and paste the key as the API key.
Gladia bills transcriptions to the account that owns the key. New accounts get a one-time €50 credit; when it runs out, top up the wallet or upgrade the plan.
Advanced: plans, limits and access
Plans and concurrency
Free accounts run 3 transcriptions at a time, paid accounts 25 (with up to 300 more queued), and Enterprise capacity is agreed with Gladia. A transcription that hits the limit waits or fails with HTTP 429; the connection reports it as retryable.
Retention
Gladia keeps audio and transcripts for the retention window of your plan: one year on Free, three weeks on paid plans, and custom or zero retention on Enterprise. After that the audio and result are gone, and only job metadata remains. Delete a job in time if you need it removed sooner.
Enterprise zero data retention disables file uploads and later retrieval of transcripts and audio. It requires externally hosted recordings and your own callback endpoint to receive results; the upload-and-poll workflow is unavailable with that setting.
Changing access and revoking
- To change the access level, edit the connection in Houston; the same key keeps working.
- To revoke access, delete the key in the Gladia dashboard and remove the connection in Houston.
Files
Files
connector.luau
-- Gladia API v2 (https://docs.gladia.io/api-reference/v2/): pre-recorded speech-to-text jobs, their -- results and the audio they used. Arguments and results keep Gladia's native snake_case field names. type Options = {[string]: any} local API = "https://api.gladia.io" -- Gladia accepts files up to 1000 MB and transcribes at most 135 minutes per job. local MAX_UPLOAD = 1000 * 1000 * 1000 local MAX_BODY = 8 * 1024 * 1024 local NONE: {string} = table.freeze({}) local function text(value: any, field: string): string assert(type(value) == "string" and value ~= "", field .. " must be a nonempty string") return value end local function options(value: any): Options if value == nil then return {} end assert(type(value) == "table", "opts must be an object") for key in value do assert(type(key) == "string", "opts must have named fields") end return table.clone(value) end local function done(name: string, args: Options) local unknown = next(args) assert(unknown == nil, name .. " has no option " .. string.sub(tostring(unknown), 1, 64)) end -- Gladia job IDs are UUIDs and it answers HTTP 400 for anything else, so validate before the call. local function jobId(value: any): string local id = text(value, "id") assert( string.match(id, "^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$") ~= nil, "id must be a Gladia job UUID, as createTranscription and listTranscriptions return" ) return id end -- Moves the named fields from args into a query string; arrays repeat the key. local function query(args: Options, names: {string}): string local parts: {string} = {} for _, name in names do local value = args[name] args[name] = nil for key, item in (if type(value) == "table" then value else {value}) do assert( type(key) == "number" and (type(item) == "string" or type(item) == "number"), name .. " must be a string, a number or an array of them" ) table.insert(parts, url.encode(name) .. "=" .. url.encode(item)) end end return if #parts > 0 then "?" .. table.concat(parts, "&") else "" end local function failStatus(operation: string, response: HttpResponse): never local status = response.statusCode local message = "Gladia HTTP " .. tostring(status) -- An error body that stalls or breaks counts as empty, so the status and retryable survive. local read, raw: any = pcall(function() return await(response.body:readPrefix(16 * 1024)) end) if not read and type(raw) == "table" and raw.code ~= nil then error(raw, 0) end local ok, problem = false, nil if read then ok, problem = pcall(json.decode, raw) end if ok and type(problem) == "table" then if type(problem.message) == "string" and problem.message ~= "" then message ..= ": " .. string.sub(problem.message, 1, 600) end if type(problem.error_code) == "string" then message ..= " (" .. problem.error_code .. ")" end if type(problem.validation_errors) == "table" then local errors: {string} = {} for _, item in problem.validation_errors do if type(item) == "string" then table.insert(errors, item) end end if #errors > 0 then message ..= "; " .. string.sub(table.concat(errors, "; "), 1, 600) end end end local retry = response.headers["retry-after"] if retry and retry[1] then message ..= "; Retry-After: " .. string.sub(retry[1], 1, 32) end if status == 401 then message ..= ". Check that the API key is valid and still belongs to this Gladia account" elseif status == 403 and operation == "deleteTranscription" then message ..= ". Gladia deletes a job only once it is neither queued nor processing" elseif status == 429 then message ..= ". The Gladia account is at its concurrency or request-rate limit; wait before trying again" end return houston.fail({ operation = operation, layer = "upstream", upstream_status = status, retryable = status == 429 or status >= 500, message = message, }) end local function send(operation: string, method: string, href: string, headers: HttpHeaders?, body: (string | StreamReader)?): HttpResponse local sent, result: any = pcall(function() return await(http.request({method = method, url = href, headers = headers, body = body})) end) if not sent then if body ~= nil and type(body) ~= "string" then pcall(function() body:close() end) end if type(result) == "table" and result.code == "timeout" then houston.fail({ operation = operation, layer = "upstream", retryable = true, message = "Gladia did not answer in time. An accepted job is not lost: list transcriptions before creating another", }) end error(result, 0) end local response: HttpResponse = result if response.statusCode < 200 or response.statusCode >= 300 then failStatus(operation, response) end return response end -- A successful answer's JSON object, or {success=true} when a write answers without a body. Houston -- returns at most 8 MiB per call, so an oversized result fails with the limit named. local function decode(operation: string, response: HttpResponse): any local read, raw: any = pcall(function() return await(response.body:readAll(MAX_BODY)) end) if not read then if type(raw) == "table" and raw.code ~= nil then error(raw, 0) end houston.fail({ operation = operation, layer = "upstream", upstream_status = response.statusCode, retryable = false, message = "Gladia's answer exceeds Houston's 8 MiB limit. List the jobs and read a shorter one", }) end if string.match(raw, "^%s*$") then return {success = true} end local ok, value = pcall(json.decode, raw) if not ok or type(value) ~= "table" or not string.match(raw, "^%s*{") then houston.fail({ operation = operation, layer = "upstream", upstream_status = response.statusCode, retryable = false, message = "Gladia returned an invalid JSON object", }) end return value end -- Streams a response body to a session file; the path changes only when the whole body arrived. local function save(path: string, fetch: () -> HttpResponse): Options local output = fs.open(path, "w") local ok, err = pcall(function() output:write(fetch().body) await(output:close()) end) if not ok then output:cancel() pcall(function() await(output:close()) end) error(err, 0) end return {path = path, url = await(fs.signedGetUrl(path)), size = await(fs.stat(path)).size} end -- Gladia reads the media type of an uploaded part; name the common ones and leave the rest generic. local MEDIA_TYPES: {[string]: string} = { ["3gp"] = "video/3gpp", aac = "audio/aac", aif = "audio/aiff", aiff = "audio/aiff", amr = "audio/amr", caf = "audio/x-caf", flac = "audio/flac", m4a = "audio/mp4", mkv = "video/x-matroska", mov = "video/quicktime", mp3 = "audio/mpeg", mp4 = "video/mp4", mpeg = "audio/mpeg", mpg = "audio/mpeg", oga = "audio/ogg", ogg = "audio/ogg", opus = "audio/opus", wav = "audio/wav", webm = "audio/webm", wma = "audio/x-ms-wma", } local function mediaType(filename: string): string local extension = string.match(string.lower(filename), "%.([%w]+)$") return if extension then MEDIA_TYPES[extension] or "application/octet-stream" else "application/octet-stream" end local help: {text: string, functions: {[string]: any}} = { text = [[Gladia speech-to-text jobs of the Gladia account that owns this connection's API key. Every function takes one named options object with Gladia's snake_case fields and returns Gladia's JSON unchanged. Connector calls return completed values: use them directly, without await. A job's status is queued, processing, done or error; its result holds the transcript once it is done. Gladia keeps working on an accepted job for up to 2 hours, so queued and processing are not failures. Houston cannot pause between calls: to follow a job, call getTranscription again later, spacing the calls out. Results keep Gladia's shape: result.transcription.full_transcript, languages and utterances [{start, end, confidence, channel, speaker?, text, language, words}], plus sentences, subtitles, translation, summarization, named_entity_recognition, sentiment_analysis, audio_to_llm, diarization and pii_redaction sections when the job asked for them. Houston returns at most 8 MiB per call, so the full result of a very long recording can exceed it. Gladia keeps audio and results for the account's retention period (3 weeks on paid plans, a year on Free), then answers HTTP 404 with error_code retention_period_expired. Enterprise zero data retention disables uploads and later retrieval of results and audio. Use an external audio_url and callback=true with callback_config.url to receive results at your own endpoint. Gladia answers HTTP 429 when the account's concurrency or request rate is exhausted; wait and retry. Live transcription over WebSocket is not available through this connector.]], functions = {}, } local exports: {[string]: any} = {help = help} local READ = {readOnlyHint = true, openWorldHint = true} local WRITE = {readOnlyHint = false, destructiveHint = false, openWorldHint = true} local DESTRUCTIVE = {readOnlyHint = false, destructiveHint = true, openWorldHint = true} -- An options object schema with its required names and one complete example. local function schema(properties: Options, required: {string}, example: Options): Options return { type = "object", properties = properties, required = if #required > 0 then required else nil, additionalProperties = false, examples = {example}, } end -- Reads help.functions.getTranscription = { description = [[One pre-recorded job: {id, request_id, version, status (queued, processing, done or error), created_at, completed_at?, custom_metadata?, error_code?, kind, file, request_params, result}. result holds the transcript when status is done and is null otherwise. Call it again to follow a running job; between calls, wait. Polling faster does not finish the job.]], inputSchema = schema( {id = {type = "string", minLength = 1, description = "Job UUID from createTranscription or listTranscriptions."}}, {"id"}, {id = "45463597-20b7-4af7-b3b3-f5fb778203ab"} ), annotations = READ, } function exports.getTranscription(input: any): Options local args = options(input) local id = jobId(args.id) args.id = nil done("getTranscription", args) local job = decode("getTranscription", send("getTranscription", "GET", API .. "/v2/transcription/" .. id)) assert(type(job.id) == "string" and type(job.status) == "string", "Gladia returned an invalid job") return job end help.functions.listTranscriptions = { description = [[A page of jobs, newest first: {first, current, next, items}. offset starts at 0 and limit defaults to 20 (at most 100 here). date, before_date and after_date (ISO 8601, UTC) bound creation time; status keeps queued, processing, done or error, and kind keeps pre-recorded or live. next is null on the last page, else the URL of the following one: call again with offset increased by limit. Items carry their whole job, results included, so keep limit small. Live jobs listed here have no transcript to read through this connector.]], inputSchema = schema({ offset = {type = "integer", minimum = 0, description = "Number of jobs to skip; starts at 0."}, limit = {type = "integer", minimum = 1, maximum = 100, description = "Jobs per page; Gladia defaults to 20."}, date = {type = "string", minLength = 1, description = "Keep jobs created on this day, such as 2026-11-09."}, before_date = {type = "string", minLength = 1, description = "Keep jobs created before this ISO 8601 time."}, after_date = {type = "string", minLength = 1, description = "Keep jobs created after this ISO 8601 time."}, status = {type = "array", items = {type = "string"}, description = "queued, processing, done, error."}, kind = {type = "array", items = {type = "string"}, description = "pre-recorded or live."}, }, NONE, {status = {"done"}, limit = 10}), annotations = READ, } function exports.listTranscriptions(input: any): Options local args = options(input) local offset, limit = args.offset, args.limit if offset ~= nil then assert(type(offset) == "number" and offset == math.floor(offset) and offset >= 0, "offset must be an integer of at least 0") end if limit ~= nil then assert(type(limit) == "number" and limit == math.floor(limit) and limit >= 1 and limit <= 100, "limit must be an integer from 1 to 100") end local href = API .. "/v2/transcription" .. query(args, {"offset", "limit", "date", "before_date", "after_date", "status", "kind"}) done("listTranscriptions", args) local page = decode("listTranscriptions", send("listTranscriptions", "GET", href)) assert(type(page.items) == "table", "Gladia returned an invalid job page") return page end help.functions.downloadAudio = { description = [[Saves the audio or video file a job used to path, a session file, and returns {path, url, size, contentType}. url is a signed session link that expires. Gladia keeps the file for the account's retention period and then answers HTTP 404 with error_code retention_period_expired.]], inputSchema = schema( {id = {type = "string", minLength = 1, description = "Job UUID."}, path = {type = "string", minLength = 1, description = "Session file to write."}}, {"id", "path"}, {id = "45463597-20b7-4af7-b3b3-f5fb778203ab", path = "meeting.m4a"} ), annotations = READ, } function exports.downloadAudio(input: any): Options local args = options(input) local id = jobId(args.id) local path = text(args.path, "path") args.id, args.path = nil, nil done("downloadAudio", args) local contentType: string? = nil local saved = save(path, function() local response = send("downloadAudio", "GET", API .. "/v2/transcription/" .. id .. "/file") local kind = response.headers["content-type"] contentType = if kind then kind[1] else nil return response end) if contentType then saved.contentType = contentType end return saved end if not houston.allows("data:write") then help.text ..= [[ This connection is read-only: it lists and reads jobs and saves their audio, but cannot upload files, start transcriptions or delete jobs. Example: local page = gladia.listTranscriptions({status={'done'}, limit=10}); for _, job in page.items do print(job.id, job.created_at) end; local t = gladia.getTranscription({id=page.items[1].id}).]] end if houston.allows("data:write") then help.text ..= [[ To transcribe, pass a public audio or video URL as audio_url to createTranscription, or first upload a session file with uploadAudio and pass the audio_url it returns. Gladia fetches external URLs itself, so they must be reachable without credentials; signed links work. Limits: 1000 MB and 135 minutes per job (4h15 on enterprise plans) and at most 2 channels; splitting near 60 minutes transcribes better. createTranscription returns {id, result_url} once Gladia accepts the job. Gladia does not deduplicate: every accepted call is a new, separately billed job, so never resubmit an accepted one. After a timeout or an HTTP 5xx, list recent jobs before trying again. deleteTranscription removes a finished job with its audio and result. Example: local up = gladia.uploadAudio({path='call.m4a'}); local job = gladia.createTranscription({ audio_url=up.audio_url, diarization=true}); later, local t = gladia.getTranscription({id=job.id}); if t.status == 'done' then print(t.result.transcription.full_transcript) end.]] -- Writes help.functions.uploadAudio = { description = [[Uploads a session file, up to 1000 MB, and returns {audio_url, audio_metadata={id, filename, source, extension, size, audio_duration, number_of_channels}}. Pass audio_url to createTranscription. The whole upload must finish within Houston's call deadline, so for a large recording pass a public URL to createTranscription instead. Gladia keeps the file for the account's retention period.]], inputSchema = schema( {path = {type = "string", minLength = 1, description = "Session file holding the audio or video."}}, {"path"}, {path = "meeting.m4a"} ), annotations = WRITE, } function exports.uploadAudio(input: any): Options local args = options(input) local path = text(args.path, "path") args.path = nil done("uploadAudio", args) assert(await(fs.exists(path)), "path " .. path .. " is not a session file") local size = await(fs.stat(path)).size assert(size > 0, "path " .. path .. " is empty") assert(size <= MAX_UPLOAD, "Gladia accepts files up to 1000 MB; split or shorten this one") local filename = string.match(path, "[^/]+$") or path local file = fs.open(path, "r") local ok, form = pcall(function() await(file) return multipart.create({ {name = "audio", filename = filename, contentType = mediaType(filename), body = file}, }) end) if not ok then pcall(function() await(file:close()) end) error(form, 0) end local value = decode( "uploadAudio", send("uploadAudio", "POST", API .. "/v2/upload", {["Content-Type"] = {form.contentType}}, form.body) ) assert(type(value.audio_url) == "string" and value.audio_url ~= "", "Gladia returned no audio_url") return value end -- The documented InitTranscriptionRequest fields, minus the deprecated callback_url. Nested -- configuration objects are passed through as Gladia documents them. local REQUEST_FIELDS = { "audio_url", "model", "language_config", "sentences", "punctuation_enhanced", "diarization", "diarization_config", "translation", "translation_config", "summarization", "summarization_config", "named_entity_recognition", "custom_spelling", "custom_spelling_config", "sentiment_analysis", "audio_to_llm", "audio_to_llm_config", "pii_redaction", "pii_redaction_config", "custom_vocabulary", "custom_vocabulary_config", "subtitles", "subtitles_config", "callback", "callback_config", "custom_metadata", } help.functions.createTranscription = { description = [[Starts a pre-recorded job and returns {id, result_url}. audio_url is required: the audio_url uploadAudio returned, or a public URL Gladia can fetch without credentials. Optional fields are Gladia's own: model (solaria-1 by default, also solaria-3 and solaria-fusion), language_config {languages=[...], code_switching?} (Gladia detects the language when languages is empty), sentences, punctuation_enhanced, diarization with diarization_config {min_speakers?, max_speakers?}, translation with translation_config {target_languages=[...], ...}, summarization with summarization_config {type (general, bullet_points or concise)}, named_entity_recognition, custom_spelling with custom_spelling_config, custom_vocabulary with custom_vocabulary_config {vocabulary=[...], ...}, sentiment_analysis, audio_to_llm with audio_to_llm_config {prompts=[...]}, pii_redaction with pii_redaction_config, subtitles with subtitles_config {formats=[...], ...}, callback with callback_config {url, method?} to have Gladia post the result, and custom_metadata to tag the job. Read getTranscription for the result; each accepted job is billed.]], inputSchema = schema({ audio_url = {type = "string", minLength = 1, description = "Gladia audio_url or public audio or video URL."}, model = {type = "string", minLength = 1, description = "solaria-1 (default), solaria-3 or solaria-fusion."}, language_config = {type = "object", description = "{languages=[...], code_switching?}."}, sentences = {type = "boolean"}, punctuation_enhanced = {type = "boolean"}, diarization = {type = "boolean"}, diarization_config = {type = "object", description = "{min_speakers?, max_speakers?}."}, translation = {type = "boolean"}, translation_config = {type = "object", description = "{target_languages=[...], ...}."}, summarization = {type = "boolean"}, summarization_config = {type = "object", description = "{type}."}, named_entity_recognition = {type = "boolean"}, custom_spelling = {type = "boolean"}, custom_spelling_config = {type = "object"}, custom_vocabulary = {type = "boolean"}, custom_vocabulary_config = {type = "object"}, sentiment_analysis = {type = "boolean"}, audio_to_llm = {type = "boolean"}, audio_to_llm_config = {type = "object", description = "{prompts=[...]}."}, pii_redaction = {type = "boolean"}, pii_redaction_config = {type = "object"}, subtitles = {type = "boolean"}, subtitles_config = {type = "object", description = "{formats, ...}."}, callback = {type = "boolean"}, callback_config = {type = "object", description = "{url, method?}."}, custom_metadata = {type = "object", description = "Tags attached to the job."}, }, {"audio_url"}, { audio_url = "https://files.gladia.io/example/audio-transcription/split_infinity.wav", language_config = {languages = {"en"}}, diarization = true, diarization_config = {min_speakers = 1, max_speakers = 4}, }), annotations = WRITE, } function exports.createTranscription(input: any): Options local args = options(input) assert(args.audio_url ~= nil, "audio_url is required") local audio = text(args.audio_url, "audio_url") assert(string.match(audio, "^https?://") ~= nil, "audio_url must be an http or https URL") local body: Options = {} for _, field in REQUEST_FIELDS do local value = args[field] args[field] = nil if value ~= nil then body[field] = value end end if body.model ~= nil then text(body.model, "model") end done("createTranscription", args) local value = decode( "createTranscription", send("createTranscription", "POST", API .. "/v2/transcription", {["Content-Type"] = {"application/json"}}, json.encode(body)) ) assert(type(value.id) == "string" and value.id ~= "", "Gladia returned no job id") return value end help.functions.deleteTranscription = { description = [[Deletes a job with its audio and result, and returns {success=true}. Gladia answers HTTP 403 while the job is still queued or processing: wait for it to finish, or read it instead. Deleting is permanent and the job cannot be transcribed again without uploading or fetching the audio once more.]], inputSchema = schema( {id = {type = "string", minLength = 1, description = "Job UUID."}}, {"id"}, {id = "45463597-20b7-4af7-b3b3-f5fb778203ab"} ), annotations = DESTRUCTIVE, } function exports.deleteTranscription(input: any): Options local args = options(input) local id = jobId(args.id) args.id = nil done("deleteTranscription", args) return decode("deleteTranscription", send("deleteTranscription", "DELETE", API .. "/v2/transcription/" .. id)) end end return exportshouston.json
{ "schema_version": 2, "name": "Gladia", "verification_key": "1e48e216259bbfcdcd245351d78a94ae6cca578b843bc7a3c5498cc1baafa929", "files": [ "connector.luau" ], "icon": "icon.svg", "access": [ { "name": "data", "label": "Access", "levels": [ { "value": "read", "label": "Read" }, { "value": "write", "label": "Write" } ], "default": "read" } ], "auth": { "api_key": { "type": "manual", "label": "API key", "config": { "token": { "type": "secret", "label": "API key", "description": "Create a key in the Gladia dashboard under API keys. Gladia bills every transcription to the account that owns the key.", "required": true } } } }, "proxy": [ { "match": { "protocol": "http", "host": [ "api.gladia.io" ], "method": [ "GET" ], "path": [ "/v2/transcription", "/v2/transcription/{id}", "/v2/transcription/{id}/file" ] }, "action": { "headers": { "remove": [ "Authorization" ], "set": { "x-gladia-key": "{{auth.api_key.token}}" } } } }, { "if": "{{ allows access.data \"write\" }}", "match": { "protocol": "http", "host": [ "api.gladia.io" ], "method": [ "POST" ], "path": [ "/v2/upload", "/v2/transcription" ] }, "action": { "headers": { "remove": [ "Authorization" ], "set": { "x-gladia-key": "{{auth.api_key.token}}" } } } }, { "if": "{{ allows access.data \"write\" }}", "match": { "protocol": "http", "host": [ "api.gladia.io" ], "method": [ "DELETE" ], "path": [ "/v2/transcription/{id}" ] }, "action": { "headers": { "remove": [ "Authorization" ], "set": { "x-gladia-key": "{{auth.api_key.token}}" } } } } ] }icon.svg
README.md
--- description: Turn recorded meetings, calls and voice notes into transcripts with Gladia. --- # Gladia Let agents transcribe recorded audio and video with Gladia, then read what was said, who said it and when. - Transcribe a recording from a public link, or upload a file first. - Read the transcript with word timings, the detected language and speaker labels. - Ask for summaries, translations, named entities, sentiment, custom vocabulary or PII redaction alongside the transcript. - Browse recent transcriptions and download the audio each one used. - With **Write** access: upload recordings, start new transcriptions and delete old ones. > Gladia bills each accepted transcription to your account by audio duration. > Gladia does not deduplicate requests: sending the same recording twice creates > two separately billed jobs. **Read** access reads and downloads but cannot create or delete anything. This connector covers recorded audio up to 135 minutes (4 hours 15 minutes on Enterprise) and 1000 MB per job, not live transcription from a microphone.SETUP.md
# Connect your Gladia account 1. Choose the level for **Access**: - **Read** to let agents read and download transcriptions without creating or deleting anything. - **Write** to also let agents upload recordings, start transcriptions and delete jobs. 2. Create an API key in the [Gladia dashboard](https://app.gladia.io/apikeys) and copy it. 3. Add the connection in Houston and paste the key as the **API key**. Gladia bills transcriptions to the account that owns the key. New accounts get a one-time €50 credit; when it runs out, top up the wallet or upgrade the plan. ## Advanced: plans, limits and access ### Plans and concurrency Free accounts run 3 transcriptions at a time, paid accounts 25 (with up to 300 more queued), and Enterprise capacity is agreed with Gladia. A transcription that hits the limit waits or fails with HTTP 429; the connection reports it as retryable. ### Retention Gladia keeps audio and transcripts for the retention window of your plan: one year on Free, three weeks on paid plans, and custom or zero retention on Enterprise. After that the audio and result are gone, and only job metadata remains. Delete a job in time if you need it removed sooner. Enterprise [zero data retention](https://docs.gladia.io/chapters/limits-and-specifications/data-retention) disables file uploads and later retrieval of transcripts and audio. It requires externally hosted recordings and your own callback endpoint to receive results; the upload-and-poll workflow is unavailable with that setting. ### Changing access and revoking - To change the access level, edit the connection in Houston; the same key keeps working. - To revoke access, delete the key in the [Gladia dashboard](https://app.gladia.io/apikeys) and remove the connection in Houston.tests
authentication.luau
return { contract = function(m) m.authentication({ { auth = { token = "synthetic-method-secret" }, config = {}, endpoint = { "GET", "https://api.gladia.io/v2/transcription" }, expected = "synthetic-method-secret", header = "x-gladia-key", method = "api_key", publisher = {}, }, }) end, }examples.luau
-- Every documented example runs as a real call against a permissive Gladia mock. return { scenario = {publisher = {}, config = {}, auth_method = "api_key", auth_config = {token = "gladia-fixture-key"}}, access = {data = "write"}, configure = function() calls = 0 fs = fixture.files() http = {request = function(req) calls += 1 if req.body ~= nil and type(req.body) ~= "string" then await(req.body:readAll()) end assert(string.match(req.url, "^https://api%.gladia%.io/v2/") ~= nil, req.url) return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader( '{"id":"45463597-20b7-4af7-b3b3-f5fb778203ab","status":"done","items":[],"audio_url":"https://api.gladia.io/file/1","result_url":"https://api.gladia.io/v2/transcription/45463597-20b7-4af7-b3b3-f5fb778203ab"}')}) end} end, run = function(c) local file = fs.open("meeting.m4a", "w") file:write("fake-m4a-bytes") await(file:close()) local names = {} for name in c do if name ~= "help" then table.insert(names, name) end end table.sort(names) for _, name in names do fixture.example(name) end assert(calls == #names, "an example made no request") end, }files.luau
-- Native file and Reader ownership, including media larger than the JSON result limit. return { scenario = {access = {data = "write"}, config = {}, auth_method = "api_key", auth_config = {token = "gladia-fixture-key"}}, configure = function() fs = fixture.files() opened = {} local open = fs.open fs.open = function(path, mode) local file = open(path, mode) if mode == "r" then table.insert(opened, file) end return file end requests = 0 admissionFailure = false transportTimeout = false responseStatus = 200 responseBody = nil http = {request = function(req) requests += 1 if admissionFailure then rejectedBody = req.body error("HTTP admission failed") end if transportTimeout then error({code = "timeout", message = "request timed out"}) end if req.body ~= nil then assert(req.method == "POST" and req.url == "https://api.gladia.io/v2/upload") assert(type(req.body) ~= "string", "upload buffered the audio") uploadContentType = req.headers["Content-Type"][1] local received = open("received.multipart", "w") received:write(req.body) await(received:close()) end return fixture.operation({statusCode = responseStatus, headers = {}, body = responseBody or fixture.reader('{"audio_url":"https://api.gladia.io/file/audio-1"}')}) end} end, run = function(c) local id = "45463597-20b7-4af7-b3b3-f5fb778203ab" local block = string.rep("a", 1024 * 1024) local size = 8 * #block + 17 local input = fs.open("large.wav", "w") for _ = 1, 8 do await(input:write(block)) end await(input:write(string.rep("a", 17))) await(input:close()) assert(c.uploadAudio({path = "large.wav"}).audio_url == "https://api.gladia.io/file/audio-1") local sentSize = await(fs.stat("received.multipart")).size assert(sentSize > size and sentSize < size + 1024, "multipart lost audio bytes") assert(not pcall(function() await(opened[#opened]:read(1)) end), "upload left its input file open") local received = fs.open("received.multipart", "r") local prefix = await(received:read(1024)).data assert(string.find(prefix, 'name="audio"; filename="large.wav"', 1, true)) assert(string.find(prefix, "Content-Type: audio/wav", 1, true)) local boundary = string.match(uploadContentType, "boundary=(.+)$") assert(boundary and string.sub(prefix, 1, #boundary + 4) == "--" .. boundary .. "\r\n") local _, headerEnd = string.find(prefix, "\r\n\r\n", 1, true) assert(headerEnd) await(received:seek(headerEnd, "start")) local remaining = size while remaining > 0 do local chunk = await(received:read(math.min(remaining, #block))) assert(not chunk.done and chunk.data == string.rep("a", #chunk.data), "multipart changed audio bytes") remaining -= #chunk.data end assert(await(received:readAll()) == "\r\n--" .. boundary .. "--\r\n", "multipart trailer disagrees with its Content-Type") await(received:close()) local invalid = fs.open("invalid\nname.wav", "w") invalid:write("audio") await(invalid:close()) local before = requests local ok, err = pcall(c.uploadAudio, {path = "invalid\nname.wav"}) assert(not ok and requests == before, "invalid multipart filename reached HTTP") assert(not pcall(function() await(opened[#opened]:read(1)) end), "multipart construction left the audio file open") -- A refused request must release both the multipart Reader and its owned File. admissionFailure = true before = requests ok, err = pcall(c.uploadAudio, {path = "large.wav"}) assert(not ok and string.find(tostring(err), "HTTP admission failed", 1, true), tostring(err)) assert(requests == before + 1, "upload failure was replayed") assert(not pcall(function() await(opened[#opened]:read(1)) end), "HTTP admission left the audio file open") assert(not pcall(function() await(rejectedBody:readAll()) end), "HTTP admission left the multipart Reader open") admissionFailure = false transportTimeout = true before = requests ok, err = pcall(c.createTranscription, {audio_url = "https://example.com/audio.wav"}) assert(not ok and string.find(tostring(err), "list transcriptions before creating another", 1, true), tostring(err)) assert(string.find(tostring(err), '"retryable":true', 1, true), tostring(err)) assert(requests == before + 1, "timed-out creation was replayed") transportTimeout = false -- Download streams beyond the string limit, preserving every byte. responseBody = fixture.reader(string.rep("d", size)) local saved = c.downloadAudio({id = id, path = "download.wav"}) assert(saved.size == size and saved.path == "download.wav" and type(saved.url) == "string") local downloaded = fs.open("download.wav", "r") local total = 0 while true do local chunk = await(downloaded:read(1024 * 1024)) if chunk.done then break end assert(chunk.data == string.rep("d", #chunk.data)) total += #chunk.data end await(downloaded:close()) assert(total == size) -- A failed replacement preserves the old file, even after partial incoming bytes. local original = fs.open("keep.wav", "w") original:write("original audio") await(original:close()) responseBody = stream.concat({"partial replacement", gzip.decode(fixture.reader("not gzip"))}) ok = pcall(c.downloadAudio, {id = id, path = "keep.wav"}) assert(not ok, "broken audio stream returned success") local preserved = fs.open("keep.wav", "r") assert(await(preserved:readAll()) == "original audio") await(preserved:close()) responseStatus, responseBody = 403, fixture.reader('{"message":"Audio access denied"}') ok, err = pcall(c.downloadAudio, {id = id, path = "keep.wav"}) assert(not ok and string.find(tostring(err), "Gladia HTTP 403: Audio access denied", 1, true), tostring(err)) assert(not string.find(tostring(err), "neither queued nor processing", 1, true), "download error used deletion advice") preserved = fs.open("keep.wav", "r") assert(await(preserved:readAll()) == "original audio") await(preserved:close()) end, }manifest.luau
return { contract = function(m) local api = "https://api.gladia.io" local job = api .. "/v2/transcription/45463597-20b7-4af7-b3b3-f5fb778203ab" local reads = { "GET " .. api .. "/v2/transcription", "GET " .. api .. "/v2/transcription?limit=10&status=done&status=error&kind=pre-recorded", "GET " .. job, "GET " .. job .. "/file", } local writes = { "POST " .. api .. "/v2/upload", "POST " .. api .. "/v2/transcription", "DELETE " .. job, } -- Each allowed route carries the key in x-gladia-key, replacing a caller's, and drops Authorization. local function keyed(r, routes) for _, route in routes do local method, href = string.match(route, "^(%S+) (.+)$") local recipe, err = m.recipe(r, method, href) if err ~= nil then m.fail("%s denied: %s", route, err) end m.rejectPreparedOverrides(recipe, r.Context, route) local headers, problem = m.prepare(recipe, r.Context, { Authorization = { "Bearer forged" }, ["x-gladia-key"] = { "forged" } }) if problem ~= nil or m.header(headers, "x-gladia-key") ~= "gladia-fixture-key" or m.header(headers, "Authorization") ~= "" then m.fail("%s prepared %s: %s", route, headers, problem) end end end for _, level in { "read", "write" } do local r, err = m.resolve(nil, {}, { token = "gladia-fixture-key" }, "api_key", { data = level }) assert(r and not err, tostring(err)) keyed(r, reads) if level == "write" then keyed(r, writes) else m.routes(r, "", false, writes) end -- Routes the connector never calls stay closed at both access levels: the legacy and live -- APIs, history, other hosts and path tricks. m.routes(r, "", false, { "POST " .. api .. "/v2/pre-recorded", "GET " .. api .. "/v2/pre-recorded", "POST " .. api .. "/v2/live", "GET " .. api .. "/v2/live", "PATCH " .. api .. "/v2/live/45463597-20b7-4af7-b3b3-f5fb778203ab", "GET " .. api .. "/v1/history", "GET " .. api .. "/v1/models", "POST " .. api .. "/audio/text/audio-transcription", "PUT " .. job, "PATCH " .. job, "DELETE " .. api .. "/v2/transcription", "DELETE " .. job .. "/file", "GET " .. job .. "/file/extra", "GET " .. api .. "/v2/transcription/%2e%2e/file", "GET " .. api .. "/v2/upload", "GET https://api.gladia.io.example.com/v2/transcription", "GET https://app.gladia.io/apikeys", "GET http://api.gladia.io:8080/v2/transcription", }) end end, }reads.luau
-- A connection with Read access: job reads, paging, audio downloads and Gladia's errors. return { scenario = {publisher = {}, config = {}, auth_method = "api_key", auth_config = {token = "gladia-fixture-key"}}, access = {data = "read"}, configure = function() requests, responses = {}, {} fs = fixture.files() http = {request = function(req) assert(req.headers == nil or (req.headers.Authorization == nil and req.headers["x-gladia-key"] == nil), "the proxy injects the key") table.insert(requests, req) assert(#responses > 0, "unexpected request: " .. req.method .. " " .. req.url) local response = table.remove(responses, 1) return fixture.operation({statusCode = response.status or 200, headers = response.headers or {}, body = fixture.reader(response.body or "{}")}) end} end, run = function(c) local API = "https://api.gladia.io/v2/transcription" local ID = "45463597-20b7-4af7-b3b3-f5fb778203ab" local function last(method: string, href: string) local req = requests[#requests] assert(req.method == method and req.url == href, req.method .. " " .. req.url) return req end local function fails(expected: {string}, fn: (...any) -> any, ...: any): number local before = #requests local ok, err = pcall(fn, ...) assert(not ok, "call succeeded") for _, text in expected do assert(string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end return #requests - before end local names = {} for name in c do if name ~= "help" then table.insert(names, name) end end table.sort(names) assert(table.concat(names, ",") == "downloadAudio,getTranscription,listTranscriptions", "read got " .. table.concat(names, ",")) -- A finished job comes back unchanged, transcript included. responses = {{body = '{"id":"' .. ID .. '","request_id":"G-1","version":2,"status":"done","created_at":"2026-11-09T10:00:00Z","completed_at":"2026-11-09T10:01:00Z","kind":"pre-recorded","post_session_metadata":{},"file":{"id":"f1","filename":"call.wav","source":null,"audio_duration":42.5,"number_of_channels":1},"request_params":{"diarization":true},"result":{"metadata":{"audio_duration":42.5,"number_of_distinct_channels":1,"billing_time":42.5,"transcription_time":3.1},"transcription":{"full_transcript":"Hello there.","languages":["en"],"utterances":[{"start":0.1,"end":1.2,"confidence":0.98,"channel":0,"speaker":0,"text":"Hello there.","language":"en","words":[{"word":"Hello","start":0.1,"end":0.5,"confidence":0.99}]}]}}}'}} local getArgs = {id = ID} local job = c.getTranscription(getArgs) assert(getArgs.id == ID, "getTranscription changed the caller's options") last("GET", API .. "/" .. ID) assert(job.status == "done" and job.result.transcription.full_transcript == "Hello there.") local utterance = job.result.transcription.utterances[1] assert(utterance.speaker == 0 and utterance.words[1].word == "Hello" and job.result.metadata.billing_time == 42.5) -- A running job has a null result. responses = {{body = '{"id":"' .. ID .. '","status":"processing","result":null}'}} local running = c.getTranscription({id = ID}) assert(running.status == "processing" and running.result == json.decode("null")) -- IDs and options are checked before any request. assert(fails({"id must be a Gladia job UUID"}, c.getTranscription, {id = "../v1/history"}) == 0) assert(fails({"id must be a nonempty string"}, c.getTranscription, {}) == 0) assert(fails({"getTranscription has no option job_id"}, c.getTranscription, {id = ID, job_id = ID}) == 0) -- Lists keep Gladia's page and repeat array filters; an empty page stays an array. responses = { {body = '{"first":"' .. API .. '?offset=0&limit=10","current":"' .. API .. '?offset=0&limit=10","next":"' .. API .. '?offset=10&limit=10","items":[{"id":"' .. ID .. '","status":"done","kind":"pre-recorded"}]}'}, {body = '{"first":"' .. API .. '","current":"' .. API .. '","next":null,"items":[]}'}, } local page = c.listTranscriptions({limit = 10, status = {"done", "error"}, kind = {"pre-recorded"}, after_date = "2026-11-01T00:00:00Z"}) last("GET", API .. "?limit=10&after_date=2026-11-01T00%3A00%3A00Z&status=done&status=error&kind=pre-recorded") assert(page.items[1].id == ID and type(page.next) == "string") local empty = c.listTranscriptions() last("GET", API) assert(json.encode(empty.items) == "[]" and type(empty.next) ~= "string") assert(fails({"limit must be an integer from 1 to 100"}, c.listTranscriptions, {limit = 500}) == 0) assert(fails({"offset must be an integer of at least 0"}, c.listTranscriptions, {offset = -20}) == 0) assert(fails({"listTranscriptions has no option custom_metadata"}, c.listTranscriptions, {custom_metadata = {user = "ana"}}) == 0) responses = {{body = '{"items":"none"}'}} fails({"Gladia returned an invalid job page"}, c.listTranscriptions) -- The audio streams to a session file. responses = {{headers = {["content-type"] = {"audio/wav"}}, body = "RIFF....WAVEfmt "}} local downloadArgs = {id = ID, path = "audio/call.wav"} local saved = c.downloadAudio(downloadArgs) assert(downloadArgs.id == ID and downloadArgs.path == "audio/call.wav", "downloadAudio changed the caller's options") last("GET", API .. "/" .. ID .. "/file") assert(saved.path == "audio/call.wav" and saved.size == 16 and saved.contentType == "audio/wav" and type(saved.url) == "string") assert(await(fs.open("audio/call.wav", "r"):readAll()) == "RIFF....WAVEfmt ") assert(fails({"downloadAudio has no option format"}, c.downloadAudio, {id = ID, path = "audio/call.wav", format = "wav"}) == 0) -- Expired audio fails with Gladia's error code and leaves no file behind. responses = {{status = 404, body = '{"timestamp":"2026-11-09T10:00:00Z","path":"/v2/transcription/x/file","request_id":"G-2","statusCode":404,"message":"Not found","error_code":"retention_period_expired"}'}} fails({"Gladia HTTP 404: Not found (retention_period_expired)", '"retryable":false', '"upstream_status":404', '"operation":"downloadAudio"'}, c.downloadAudio, {id = ID, path = "gone.wav"}) assert(not await(fs.exists("gone.wav"))) -- Gladia's errors keep the status and message; rate limits and outages are retryable. responses = {{status = 429, headers = {["retry-after"] = {"3"}}, body = '{"statusCode":429,"message":"Too many requests"}'}} fails({"Gladia HTTP 429: Too many requests", "Retry-After: 3", "concurrency or request-rate limit", '"retryable":true'}, c.listTranscriptions) responses = {{status = 401, body = '{"statusCode":401,"message":"Unauthorized"}'}} fails({"Gladia HTTP 401: Unauthorized", "Check that the API key", '"retryable":false'}, c.getTranscription, {id = ID}) responses = {{status = 503, body = "<html>unavailable</html>"}} fails({"Gladia HTTP 503", '"retryable":true'}, c.getTranscription, {id = ID}) responses = {{body = "not json"}} fails({"Gladia returned an invalid JSON object"}, c.getTranscription, {id = ID}) assert(#responses == 0) end, }writes.luau
-- A connection with Write access: uploads, job creation and deletion. return { scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "api_key", auth_config = {token = "gladia-fixture-key"}}, configure = function() requests, responses = {}, {} fs = fixture.files() http = {request = function(req) if req.url == "https://api.gladia.io/v2/upload" then assert(type(req.body) ~= "string", "audio must reach HTTP as a stream") end if req.body ~= nil and type(req.body) ~= "string" then req.body = await(req.body:readAll()) end table.insert(requests, req) assert(#responses > 0, "unexpected request: " .. req.method .. " " .. req.url) local response = table.remove(responses, 1) return fixture.operation({statusCode = response.status or 200, headers = response.headers or {}, body = fixture.reader(response.body or "{}")}) end} end, run = function(c) local API = "https://api.gladia.io" local ID = "45463597-20b7-4af7-b3b3-f5fb778203ab" local AUDIO = "https://api.gladia.io/file/6c09400e-23d2-4bd2-be55-96a5ececfa3b" local function last(method: string, href: string) local req = requests[#requests] assert(req.method == method and req.url == href, req.method .. " " .. req.url) assert(req.headers == nil or (req.headers.Authorization == nil and req.headers["x-gladia-key"] == nil), "the proxy injects the key") return req end local function fails(expected: {string}, fn: (...any) -> any, ...: any): number local before = #requests local ok, err = pcall(fn, ...) assert(not ok, "call succeeded") for _, text in expected do assert(string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end return #requests - before end local function write(path: string, bytes: string) local file = fs.open(path, "w") if bytes ~= "" then file:write(bytes) end await(file:close()) end local names = {} for name in c do if name ~= "help" then table.insert(names, name) end end table.sort(names) assert(table.concat(names, ",") == "createTranscription,deleteTranscription,downloadAudio,getTranscription,listTranscriptions,uploadAudio", "write got " .. table.concat(names, ",")) -- uploadAudio streams the session file as the multipart audio part, with its media type. write("calls/meeting.m4a", "fake-m4a-bytes") responses = {{body = '{"audio_url":"' .. AUDIO .. '","audio_metadata":{"id":"6c09400e-23d2-4bd2-be55-96a5ececfa3b","filename":"meeting.m4a","source":null,"extension":"m4a","size":14,"audio_duration":1.5,"number_of_channels":1}}'}} local uploadArgs = {path = "calls/meeting.m4a"} local uploaded = c.uploadAudio(uploadArgs) assert(uploadArgs.path == "calls/meeting.m4a", "uploadAudio changed the caller's options") local req = last("POST", API .. "/v2/upload") local contentType = req.headers["Content-Type"][1] assert(string.match(contentType, "^multipart/form%-data; boundary=") ~= nil, contentType) for _, part in {'name="audio"', 'filename="meeting.m4a"', "audio/mp4", "fake-m4a-bytes"} do assert(string.find(req.body, part, 1, true), "upload body lacks " .. part) end assert(uploaded.audio_url == AUDIO and uploaded.audio_metadata.audio_duration == 1.5) -- Unknown extensions upload as generic bytes; missing and empty files never reach Gladia. write("voice.xyz", "x") responses = {{body = '{"audio_url":"' .. AUDIO .. '","audio_metadata":{}}'}} c.uploadAudio({path = "voice.xyz"}) assert(string.find(last("POST", API .. "/v2/upload").body, "application/octet-stream", 1, true)) assert(fails({"path missing.wav is not a session file"}, c.uploadAudio, {path = "missing.wav"}) == 0) assert(fails({"uploadAudio has no option filename"}, c.uploadAudio, {path = "voice.xyz", filename = "override.wav"}) == 0) write("empty.wav", "") assert(fails({"path empty.wav is empty"}, c.uploadAudio, {path = "empty.wav"}) == 0) responses = {{body = '{"audio_metadata":{}}'}} fails({"Gladia returned no audio_url"}, c.uploadAudio, {path = "voice.xyz"}) -- createTranscription sends Gladia's own request fields as JSON, and only those given. responses = {{status = 201, body = '{"id":"' .. ID .. '","result_url":"' .. API .. '/v2/transcription/' .. ID .. '"}'}} local created = c.createTranscription({ audio_url = uploaded.audio_url, language_config = {languages = {"fr"}, code_switching = false}, diarization = true, diarization_config = {min_speakers = 2, max_speakers = 3}, summarization = true, summarization_config = {type = "bullet_points"}, custom_metadata = {meeting = "weekly"}, }) req = last("POST", API .. "/v2/transcription") assert(req.headers["Content-Type"][1] == "application/json") local body = json.decode(req.body) assert(body.audio_url == AUDIO and body.language_config.languages[1] == "fr" and body.language_config.code_switching == false) assert(body.diarization == true and body.diarization_config.max_speakers == 3 and body.summarization_config.type == "bullet_points") assert(body.custom_metadata.meeting == "weekly" and body.model == nil and body.translation == nil) assert(created.id == ID and created.result_url == API .. "/v2/transcription/" .. ID) -- Gladia's documentation also answers 200 on acceptance. responses = {{body = '{"id":"' .. ID .. '","result_url":"' .. API .. '/v2/transcription/' .. ID .. '"}'}} assert(c.createTranscription({audio_url = "https://example.com/podcast.mp3", model = "solaria-1"}).id == ID) assert(json.decode(last("POST", API .. "/v2/transcription").body).model == "solaria-1") -- Invalid requests never reach Gladia; Gladia's validation errors are reported. assert(fails({"audio_url is required"}, c.createTranscription, {diarization = true}) == 0) assert(fails({"audio_url must be an http or https URL"}, c.createTranscription, {audio_url = "file:///etc/passwd"}) == 0) assert(fails({"createTranscription has no option callback_url"}, c.createTranscription, {audio_url = "https://example.com/a.wav", callback_url = "https://example.com/hook"}) == 0) assert(fails({"model must be a nonempty string"}, c.createTranscription, {audio_url = "https://example.com/a.wav", model = ""}) == 0) responses = {{status = 422, body = '{"statusCode":422,"message":"Unprocessable","validation_errors":["Field language must be a string"]}'}} fails({"Gladia HTTP 422: Unprocessable; Field language must be a string", '"retryable":false'}, c.createTranscription, {audio_url = "https://example.com/a.wav"}) responses = {{status = 201, body = '{"result_url":"x"}'}} fails({"Gladia returned no job id"}, c.createTranscription, {audio_url = "https://example.com/a.wav"}) -- deleteTranscription answers 202 without a body. responses = {{status = 202, body = ""}} local deleteArgs = {id = ID} assert(c.deleteTranscription(deleteArgs).success == true) assert(deleteArgs.id == ID, "deleteTranscription changed the caller's options") last("DELETE", API .. "/v2/transcription/" .. ID) responses = {{status = 403, body = '{"statusCode":403,"message":"Forbidden"}'}} fails({"Gladia HTTP 403: Forbidden", "neither queued nor processing", '"retryable":false'}, c.deleteTranscription, {id = ID}) assert(fails({"id must be a Gladia job UUID"}, c.deleteTranscription, {id = "all"}) == 0) assert(fails({"deleteTranscription has no option force"}, c.deleteTranscription, {id = ID, force = true}) == 0) assert(#responses == 0) end, }