Pre-recorded (batch) transcription callbacks (webhooks)
Instead of reading a job until it is done, you can have its result POSTed to your server when it ends. Ask for it when you create the job:
{ "audio_url": "https://eu1.api.gladia.io/file/0199d7a2-0000-7000-8000-00000000f11e", "callback": true, "callback_config": { "url": "https://hooks.example.com/gladia", "method": "POST" }, "custom_metadata": { "call_id": "42" }}The URL must be https, on a public address. Gladia’s older callback_url field works too, as on Gladia Classic
(Gladia’s cloud API, api.gladia.io): it stands for "callback": true and a POST to that URL when the request
has neither callback nor callback_config. With "callback": false, or a callback_config without
"callback": true, no callback is sent. callback_url is deprecated: it is kept only for clients migrated from
Gladia Classic. Do not use it in new integrations: it may be removed (decommissioned) in a future release. Use
"callback": true with callback_config.url instead
(Deprecated Gladia Classic compatibility).
Payload
Section titled “Payload”A job that is done sends transcription.success, its payload being the job’s result:
{ "id": "0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e", "event": "transcription.success", "payload": { "metadata": { "audio_duration": 30.0, "billing_time": 30.0, "transcription_time": 4.2 }, "transcription": { "full_transcript": "Hello, how can I help you?", "languages": ["en"], "utterances": [] } }, "custom_metadata": { "call_id": "42" }}A job that failed sends transcription.error, with the same code as the job’s error_code:
{ "id": "0199d7a2-6a10-7c22-8d4e-5f6a7b8c9d0e", "event": "transcription.error", "error": { "code": 422, "message": "audio could not be decoded" }, "custom_metadata": { "call_id": "42" }}The callback is sent once, when the job ends; when your server cannot be reached or answers with a 5xx, it is
retried a few times (a 4xx is not retried). The job keeps its result: read it with GET /v2/pre-recorded/{id} if a callback was missed.
Verify the signature
Section titled “Verify the signature”Each callback is signed with your workspace’s callback signing secret, in the x-gladia-signature header, as
the live callbacks are: verify it the same way before trusting the body.
Coming from Gladia’s cloud API
Section titled “Coming from Gladia’s cloud API”A receiver written for Gladia’s cloud API reads these callbacks unchanged: the same method (POST, or PUT with
callback_config.method), the same application/json body, the same transcription.success and
transcription.error events with the same fields. What differs:
| Gladia’s cloud API | Gladia Enterprise | |
|---|---|---|
custom_metadata when the request had none |
left out | null |
error.message |
always “An error occurred. Contact our support for more information.” | what failed (audio could not be decoded) |
| Signature | none | x-gladia-signature (verify it); a receiver that ignores it still works |
| Retries | up to 10 attempts, 1 second apart, 4xx answers included, for up to 5 minutes |
3 attempts with a growing delay, network errors and 5xx only |
| Time to answer | up to 5 minutes per call | 5 seconds per call: answer first, process afterwards |
"callback": true with only callback_url |
refused (callback_config required) |
accepted: callback_url is called (deprecated: use callback_config.url) |
Account webhooks: transcription.created, transcription.success, transcription.error sent to the account’s webhook endpoints, with the job id only |
yes | no: set callback on each job, and read the job with GET /v2/pre-recorded/{id} |