> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Subtitle Result for Language

> Retrieves the transcript in a specific language of a completed subtitle run using the provided `run_id`, with optional export to `srt`/`vtt`/`txt`.

Fetches subtitles for **one language** of a completed subtitle run.

* **By default** (no query params) you get the **structured JSON transcript** for that language: `{ "transcript": [ {start, end, text, speaker}, ... ] }`.
* **When you pass `format_type` and/or `data_type`**, the transcript is exported and returned as `{ "transcript": <presigned url | raw text> }`, the same parameter values and response shape as [Get Transcription Result](get-transcription-run-result).

<Info>
  The `{language}` path parameter must be the run's source language or one of the target languages from [Create Subtitle](create-subtitle). Pass a locale tag (`es-es`, `fr-fr`); numeric IDs still work but are deprecated.
</Info>

If the run was created with `formatting_options` on [Create Subtitle](create-subtitle), the segments already follow subtitle timing and length rules.

## Choosing your output

| Parameter            | Values                                                  | Behaviour                                                                            |
| :------------------- | :------------------------------------------------------ | :----------------------------------------------------------------------------------- |
| *(none)*             | n/a                                                     | Structured JSON transcript: `{ "transcript": [ {start, end, text, speaker}, ... ] }` |
| `data_type=file`     | `srt` / `vtt` / `txt` via `format_type` (default `txt`) | `{ "transcript": "<presigned url>" }`: a downloadable file                           |
| `data_type=raw_data` | `srt` / `vtt` / `txt` via `format_type` (default `txt`) | `{ "transcript": "<raw text>" }`: the rendered text inline                           |

`format_type` (`srt`/`vtt`/`txt`) and `data_type` (`raw_data`/`file`) use the exact same values as [Get Transcription Result](get-transcription-run-result). Need every language at once? Use [Get Subtitle Result](get-subtitle-run-result) — it supports the same export params for all languages in one call.

## Implementation Example

```python [expandable] theme={null}
import requests

API_KEY = "your_api_key_here"
RUN_ID = 12345
LANGUAGE = "es-es"  # Locale tag; numeric IDs (e.g. 23) still work but are deprecated

url = f"https://client.camb.ai/apis/sub-result/{RUN_ID}/{LANGUAGE}"
headers = {"x-api-key": API_KEY}

# 1) Default: structured JSON transcript for this language
result = requests.get(url, headers=headers).json()
for segment in result["transcript"]:
    print(f"[{segment['start']} - {segment['end']}] {segment['speaker']}: {segment['text']}")

# 2) Export: presigned URL to an SRT file
srt = requests.get(
    url, headers=headers, params={"format_type": "srt", "data_type": "file"}
).json()
print(f"SRT file: {srt['transcript']}")

# 3) Export: raw VTT text inline
vtt = requests.get(
    url, headers=headers, params={"format_type": "vtt", "data_type": "raw_data"}
).json()
print(vtt["transcript"][:150])
```

## Understanding the Response Structure

The response is always a JSON object with a single `transcript` field. Its value depends on the parameters.

### Default: structured transcript (no params)

```json theme={null}
{
  "transcript": [
    { "start": 5.0,  "end": 12.0, "text": "Bienvenidos a nuestra discusión sobre IA.", "speaker": "SPEAKER_0" },
    { "start": 13.0, "end": 18.0, "text": "Gracias por invitarme.",                    "speaker": "SPEAKER_1" }
  ]
}
```

| Field     | Description                            |
| :-------- | :------------------------------------- |
| `start`   | Start time of the segment (seconds)    |
| `end`     | End time of the segment (seconds)      |
| `text`    | Text for the segment, in that language |
| `speaker` | Speaker identifier                     |

### Export: file (`data_type=file`)

```json theme={null}
{ "transcript": "https://storage.example.com/.../output_transcript.srt?..." }
```

`transcript` is a presigned URL to the rendered file. The file content matches your `format_type`:

#### TXT (`format_type=txt`)

```
[00:00:05 - 00:00:12] SPEAKER_0: Bienvenidos a nuestra discusión sobre IA.
[00:00:13 - 00:00:18] SPEAKER_1: Gracias por invitarme.
```

#### SRT (`format_type=srt`)

```
1
00:00:05,000 --> 00:00:12,000
SPEAKER_0: Bienvenidos a nuestra discusión sobre IA.

2
00:00:13,000 --> 00:00:18,000
SPEAKER_1: Gracias por invitarme.
```

#### VTT (`format_type=vtt`)

```
WEBVTT

00:00:05.000 --> 00:00:12.000
SPEAKER_0: Bienvenidos a nuestra discusión sobre IA.

00:00:13.000 --> 00:00:18.000
SPEAKER_1: Gracias por invitarme.
```

### Export: raw data (`data_type=raw_data`)

The same rendered content is returned inline as a string:

```json theme={null}
{ "transcript": "1\n00:00:05,000 --> 00:00:12,000\nSPEAKER_0: Bienvenidos a nuestra discusión sobre IA.\n\n..." }
```

<Info>The presigned file URL expires after 24 hours, so download your file soon.</Info>

## Building a Complete Workflow

* [Create Subtitle](create-subtitle): submit your media for subtitle generation
* [Get Subtitle Task Status](poll-subtitle-result): determine when your subtitles are ready
* [Get Subtitle Result](get-subtitle-run-result): every language at once (same export params)


## OpenAPI

````yaml get /sub-result/{run_id}/{language}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /sub-result/{run_id}/{language}:
    get:
      tags:
        - Apis
      summary: Get Subtitle Result For Language
      description: >-
        Get the subtitle transcript for one language of a completed subtitle
        project using the run_id. Returns the structured JSON transcript by
        default (`{"transcript": [ {start, end, text, speaker} ]}`). Passing
        `format_type` and/or `data_type` exports the transcript and returns
        `{"transcript": <presigned url | raw text>}`, matching the dubbing
        `/transcript` endpoint.
      operationId: get_subtitle_result_for_language_sub_result__run_id___language__get
      parameters:
        - name: run_id
          in: path
          required: true
          description: >-
            The unique identifier for the run, which was generated during the
            subtitle creation process and returned upon task completion.
          schema:
            $ref: '#/components/schemas/RunIDParam'
            title: Run Id
        - name: language
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/LanguageInput'
            description: >-
              The language to fetch, either the run's source language or one of
              its target languages. Pass a locale tag (`en-us`, `fr-fr`,
              `es-es`). Numeric language IDs still work but are deprecated. [See
              all source
              languages](/api-reference/endpoint/get-source-languages).
            example: ''
        - name: format_type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/TranscriptFileFormat'
              - type: 'null'
            title: Format Type
          description: >-
            Subtitle format for the transcript export: `srt`, `vtt` or `txt`.
            When omitted (and `data_type` is also omitted) the structured JSON
            transcript is returned instead of an exported file.
        - name: data_type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/TranscriptDataType'
              - type: 'null'
            title: Data Type
          description: >-
            How the exported transcript is returned once
            `format_type`/`data_type` is set: `file` returns a presigned URL,
            `raw_data` returns the raw text. Same values and response shape as
            the dubbing `/transcript` endpoint. In export mode the effective
            defaults are `format_type=txt`, `data_type=file`.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transcript:
                    anyOf:
                      - type: array
                        items:
                          $ref: '#/components/schemas/DialogueItem'
                      - type: string
                    title: Transcript
                    description: >-
                      Structured dialogue array by default; a string (presigned
                      URL for `data_type=file`, or raw text for
                      `data_type=raw_data`) in export mode.
                title: Subtitle Result
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    RunIDParam:
      type: integer
      title: Run ID
      description: >-
        The unique identifier for the run, which was generated during the
        creation process and returned upon task completion.
    LanguageInput:
      type: string
      title: Language
    TranscriptFileFormat:
      type: string
      enum:
        - srt
        - vtt
        - txt
      default: txt
      title: TranscriptFileFormat
    TranscriptDataType:
      type: string
      enum:
        - raw_data
        - file
      default: file
      title: TranscriptDataType
    DialogueItem:
      type: object
      description: >-
        A JSON that represents a single piece of dialogue or speech within a
        given time range. It includes details about the timing (start and end),
        the content of the dialogue (text), and the speaker who delivers the
        dialogue
      properties:
        start:
          type: number
          format: float
          title: Start Time
          description: The start time (in seconds) of the dialogue.
        end:
          type: number
          format: float
          title: End Time
          description: The end time (in seconds) of the dialogue.
        text:
          type: string
          title: Dialogue Text
          description: The actual text content of the dialogue spoken by the speaker.
        speaker:
          type: string
          title: Speaker Name
          description: The name or identifier of the speaker delivering the dialogue.
      required:
        - start
        - end
        - text
        - speaker
      title: DialogueItem
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        The `x-api-key` is a custom header required for authenticating requests
        to our API. Include this header in your request with the appropriate API
        key value to securely access our endpoints. You can find your API key(s)
        in the 'API' section of our studio website.

````