apyhub
Back
▣ INGESTION KIT

Convert Speech to Text & Subtitles API

What it does

The Audio to SRT API turns an audio or video file into subtitles or a transcript. Send a public url or a base64-encoded file in audio, then set format to srt, vtt, txt or json. MP3 works as well as video files, so you can send recordings as they are.

For captions, max_chars (20 to 200, default 84) and max_seconds (1 to 30, default 7) control how long each cue is, so subtitles stay readable in video players and editors. The json format returns the full text, the duration in seconds, timed segments with start and end times, an average confidence score, and billed_minutes. Set word_timestamps to true to get every word with its own start time, end time and confidence.

Teams use the Audio to SRT API as a video to SRT and subtitle generator for YouTube and course videos. Others add closed captions for accessibility, make podcasts and recorded calls searchable, and store meeting transcripts. It works from Python, Node.js or any language that can send an HTTP request. AI agents can call it through ApyHub MCP.

For plain transcription of WAV recordings, see the Speech to Text API. To turn text back into audio, use the Text to Speech API.

POST
Transcribe audio or video
https://api.eu.apyhub.com/callable-labs/convert-speech-to-text-subtitles/v1/transcribe

QUICKSTART

GUIDE

Quickstart

Transcribe an audio file from a public URL and return subtitles/transcript in the default JSON format.

curl -X POST "https://api.eu.apyhub.com/callable-labs/convert-speech-to-text-subtitles/v1/transcribe" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "audio": {
      "url": "https://assets.apyhub.com/samples/sample-speech.mp3"
    }
  }'

What you'll get back

Returns a JSON object with text (the full transcript), duration (audio length in seconds), segments (the timed transcript segments), confidence (average token confidence from 0 to 1), and billed_minutes (minutes charged, rounded up).

{
  "text": "Hello and welcome to the show.",
  "duration": 61.2,
  "segments": [
    {
      "start": 0.32,
      "end": 2.4,
      "text": "Hello and welcome to the show."
    }
  ],
  "confidence": 0.97,
  "billed_minutes": 2
}
TRY ITLIVE · 25 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
TranscribeRequest*
Choose how to send the file: a public URL or the file encoded as base64.
Public URL*
Public http(s) URL of the audio or video file
`json` (transcript, segments, timings), `srt`, `vtt` or `txt`
Longest segment or subtitle cue, in characters
Longest segment or subtitle cue, in seconds

About this endpoint

What it does

Transcribes an audio or video file and returns a structured transcript. You can provide the source either as a public URL or as base64/data URI content, and choose an output format for the transcription.

Request Body

ParameterTypeMandatoryDescription
audioObjectYesSource file for transcription. Provide one of audio.url or audio.base64.
audio.urlStringNoPublic http(s) URL of the audio or video file. Max length: 2048 characters.
audio.base64StringNoThe file as base64 or a data: URI.
formatENUMNoOutput format. Allowed values: json (transcript, segments, timings), srt, vtt, txt. Default: json.
max_charsIntegerNoLongest segment or subtitle cue, in characters. Default: 84. Minimum: 20. Maximum: 200.
max_secondsNumberNoLongest segment or subtitle cue, in seconds. Default: 7. Minimum: 1. Maximum: 30.
word_timestampsBooleanNoInclude every word with its start, end and confidence in json output. Default: false.

Response

Returns a JSON object with text as a string, duration as a number, segments as an array of objects, confidence as a number, and billed_minutes as an integer. The response is the transcription result, including the full transcript text, total audio duration, per-segment timing data, confidence, and billed minutes.

ParameterTypeMandatoryDescription
textStringYesThe whole transcript, punctuated and capitalised.
durationNumberYesAudio duration in seconds.
segmentsObject ArrayYesTranscript segments. Each segment includes start, end, and text; words is present when word_timestamps is enabled.
confidenceNumberYesAverage token confidence, 0–1.
billed_minutesIntegerYesAudio minutes this request counts against the plan, rounded up and at least 1.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.