Overview
Turn spoken media into cue-ready subtitles in the source language and any number of target languages, in a single job. The service transcribes the source, translates into each target language you request, and, when you ask for it, segments every language into cues sized for on-screen display. The pipeline is asynchronous: submit a job with a publicly accessible or signed media URL, poll until it completes, then retrieve the result for each language.Prerequisites
1
Create an account
Sign up at CAMB.AI Studio if you haven’t already.
2
Get your API key
Go to Settings → API Keys in Studio and copy your key. See Authentication for details.
3
Install the SDK
4
Set your API key to use in your code
Code
In the Python SDK, subtitle results come back as a plain dict (
result["transcript"]), not a typed model like transcription’s get_transcription_result. The isinstance check above handles that shape safely.Generating multiple languages
List every locale you need intarget_languages to translate and segment all of them from the same media URL:
target_languages if you also want same-language, subtitle-ready cues for the original speech.
To fetch every language on the run in one call instead of one at a time, drop the language argument:
get_subtitle_result_for_language. With more than one, it returns a result keyed by language.
Subtitle Formatting
By default, target-language dialogue is translated but left unsegmented, the same speech-boundary segments you’d get from Translation, not subtitle-length cues. Passformatting_options to segment every language into cues sized for on-screen display, and export directly as srt or vtt:
max_segment_duration_in_seconds(default7.0): the longest a single cue may stay on screen.min_segment_duration_in_seconds(default1.0): the shortest a single cue may stay on screen.max_characters_in_segment(default42): the maximum number of characters allowed in one cue.
format_type (and optionally data_type) to the result call. The response then carries a single transcript string instead of a segment array:
Need a plain transcript in a single language instead of translated, multi-language subtitles? Use the Transcription tutorial. It shares the same
formatting_options field for subtitle-ready cues.Parameters
Required
Optional
Result shape
get_subtitle_result_for_language and get_subtitle_result return a transcript array for each language, with the same segment shape as transcription:
When a run has more than one language and you call
get_subtitle_result without a language, the result is keyed by language instead of being a single transcript array. When you pass format_type and/or data_type, every returned language carries a single transcript string (the rendered srt/vtt/txt content or a presigned URL to it) instead of a segment array.
Languages
The Python and TypeScript SDKs expect theLanguages enum for both source_language and target_languages:
If you’re calling the API directly (not via the SDK), pass the locale tag. Numeric language IDs still work but are deprecated.
For the full list of supported source and target languages, see the Source Languages and Target Languages reference.
Tips
- Supported formats:
.mp3,.wav,.aac,.flac,.mp4,.mov, and.mxf(MXF is enterprise-only). For best quality use a lossless format like WAV or FLAC. media_urlis required: host the recording and pass a publicly accessible or signed URL. Local file upload is not supported on the subtitle endpoint.target_languagesis required and non-empty: always pass it as a list, even for a single language.- Polling timeout: for long media, cap your polling loop (e.g. 60 attempts x 5s = 5 minutes) and handle the timeout gracefully.
- Pick the right source language: specifying the correct source language significantly improves both transcription and translation accuracy.
Next Steps
Create Subtitle API
Full API reference for the subtitle endpoint.
Poll Subtitle Result
Status polling endpoint reference.
Get Subtitle Run Result
Retrieve subtitle segments and timing data for every language on a run.
Transcription
Transcribe a single language, with the same subtitle-ready formatting options.