Get the transcription result
Get the result of the transcription
Section titled “Get the result of the transcription”https://gptunnel.ru/v1/audio/transcriptionsReturns the current transcription status and result. For automatic delivery, set callback_url when you create the task.
Request headers
| Parameter | Type | Required? | Description |
|---|---|---|---|
Authorization | string | Required | API key |
Request parameters
| Parameter | Type | Required? | Description |
|---|---|---|---|
task_id | string | Required | The id field from the task creation response |
Example request
Section titled “Example request”Set GPTUNNEL_API_KEY to your API key and TASK_ID to the id field from the task creation response. The Python example requires requests, and the cURL example requires jq.
import os
import requests
response = requests.get( 'https://gptunnel.ru/v1/audio/transcriptions', headers={'Authorization': os.environ['GPTUNNEL_API_KEY']}, params={'task_id': os.environ['TASK_ID']}, timeout=30,)response.raise_for_status()task = response.json()print(task['status'])
if task['status'] == 'done': for channel in task['result']['results']['channels']: alternatives = channel.get('alternatives') or [] if alternatives: print(alternatives[0].get('transcript', ''))elif task['status'] == 'failed': print(task.get('error_title'), task.get('error_description'))curl --fail-with-body --silent --show-error --get \ --url 'https://gptunnel.ru/v1/audio/transcriptions' \ --data-urlencode "task_id=${TASK_ID:?Set TASK_ID to the task ID returned when creating the task}" \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ | jq -r '.status, (.result.results.channels[]?.alternatives[0].transcript // empty), (.error_title // empty)'const url = new URL('https://gptunnel.ru/v1/audio/transcriptions')url.searchParams.set('task_id', process.env.TASK_ID)
const response = await fetch(url, { headers: { Authorization: process.env.GPTUNNEL_API_KEY },})
if (!response.ok) throw new Error(await response.text())const task = await response.json()console.log(task.status)
if (task.status === 'done') { for (const channel of task.result.results.channels) { if (channel.alternatives?.[0]?.transcript) { console.log(channel.alternatives[0].transcript) } }} else if (task.status === 'failed') { console.error(task.error_title, task.error_description)}Example response
Section titled “Example response”The example shows the result of transcribing the sample recording with deepgram-whisper-tiny. The response reports whisper-tiny in provider.
{ "code": 0, "id": "6a47bb78fb3f0d852e64c8e3", "status": "done", "result": { "provider": "whisper-tiny", "metadata": { "duration": 1.8840625, "channels": 1 }, "results": { "channels": [ { "alternatives": [ { "transcript": "The sky is blue today.", "confidence": 0.9200794 } ] } ] } }, "error_title": null, "error_description": null}{ "code": 0, "id": "6a47bb78fb3f0d852e64c8e3", "status": "processing", "result": null, "error_title": null, "error_description": null}{ "code": 0, "id": "6a47bb78fb3f0d852e64c8e3", "status": "failed", "result": null, "error_title": "SOURCE_UNREACHABLE", "error_description": "The source did not serve the audio file (failed to fetch remote content). Make sure the URL is publicly accessible to external servers without cookies or user-agent filtering, and returns a correct Content-Length."}{ "code": 4, "message": "Record not found."}| Status | What to Do |
|---|---|
processing |
The result is not ready (result: null). Continue polling or wait for the webhook. |
done |
Read the result and stop polling. |
failed |
Read error_title and error_description and stop polling. |
The statuses done and failed are final.
Webhook delivery (callback_url)
Section titled “Webhook delivery (callback_url)”If you supplied callback_url when you created the task, the API sends the result to that URL in a
POST request when the task reaches done or failed. Both the polling response and the webhook body include the task status, result, and the same
error_title and error_description fields. You can use those fields to handle errors in either case. Only the polling response includes code.
{ "id": "6a47bb78fb3f0d852e64c8e3", "status": "done", "url": null, "result": { "provider": "whisper-tiny", "metadata": { "duration": 1.8840625, "channels": 1 }, "results": { "channels": [ { "alternatives": [{ "transcript": "The sky is blue today.", "confidence": 0.9200794 }] } ] } }, "error_title": null, "error_description": null}{ "id": "6a47bb78fb3f0d852e64c8e3", "status": "failed", "url": null, "error_title": "SOURCE_UNREACHABLE", "error_description": "The source did not serve the audio file (failed to fetch remote content). Make sure the URL is publicly accessible to external servers without cookies or user-agent filtering, and returns a correct Content-Length."}Transcription errors (status: failed)
Section titled “Transcription errors (status: failed)”When status is failed, error_title contains a machine-readable reason code and error_description explains the failure.
| error_title | Cause | Should I repeat the request? |
|---|---|---|
SOURCE_UNREACHABLE |
The transcription provider could not download the file from audio_url. The host may block external servers, require cookies, or filter requests by User-Agent. |
No. First move the file to a host that the provider can reach without signing in. |
UNSUPPORTED_MEDIA |
The provider does not support the file codec or container. | No. Convert the file to a supported format (e.g. mp3 or wav). |
TIMEOUT_TRY_AGAIN_LATER |
Temporary service malfunction or overload. | Yes - repeat the request later. |
EXCEPTION |
Other processing error. | You can retry. If the error persists, contact support. |