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

# LIVE Transcription Events

> The events of your organization's LIVE transcription sessions, as they happen, over one HTTP connection that stays open ([Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html), `text/event-stream`). One connection carries every session of the organization; `session_id` keeps the events of one.

| `event` | `data` | When |
|---|---|---|
| `started` | `session_id`, `status`, `started_at` | The session starts listening |
| `final` | `session_id` and a final sentence (`LiveTranscriptSegment`) | A sentence is complete: it will not change |
| `partial` | `session_id`, `text`, `start` | The sentence being said changed (sessions started with `include_partials`) |
| `ended` | `session_id`, `status`, `end_reason`, `error`, `duration_seconds`, `segments_count`, `ended_at` | The session is over |

```
id: 4821
event: final
data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","seq":57,"start":103.29,"end":104.88,"text":"I'm from Gambia.","language":"en","timestamp":"2026-12-03T11:20:03.290Z"}
```

**Resuming.** Every event except `partial` has an `id`, a number that grows by one with each event of your organization. When the connection is cut, reconnect with the last id you received in the `Last-Event-ID` header (an `EventSource` does it by itself) or in `after`: the stream resumes with the event that followed, so no final sentence is lost. Without either, the stream starts with the events to come; when `session_id` names a session that is already over, it starts with that session's `ended` event. The stream opens with the id it starts after and a `retry` delay, so a connection cut before any event still resumes where it should. The events of a session are kept until 24 hours after it ends. A `partial` has no id and is not replayed.

A comment line (`: keep-alive`) is sent every 15 seconds when there is nothing else to send. Connections are closed from time to time (deployments): reconnect with the last id.

Receive each sentence of your [LIVE transcription sessions](https://docs.vidnavigator.com/api-reference/endpoint/tiktok-live-transcribe.md) as it is said, over one HTTP connection that stays open.

> [!NOTE]
>
> This endpoint is a stream that stays open, so it has no playground. Try it with `curl -N`, as below.

## Overview

The answer is a stream of [Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html) (`text/event-stream`).

- **One connection carries every session** of your organization. Pass `session_id` to receive the events of one session only.
- Every event except `partial` has an `id`, a number that grows by one with each event of your organization. Reconnect with the last `id` you received and the stream resumes with the event that followed: **no final sentence is lost**.
- Without `Last-Event-ID` or `after`, the stream starts with the events to come. When `session_id` names a session that is already over, it starts with that session's `ended` event, so a reader waiting for the end is told at once.
- The events of a session are kept until 24 hours after it ends.
- A comment line (`: keep-alive`) is sent every 15 seconds when there is nothing else to send.
- The server closes the connection from time to time (deployments). This is expected: reconnect with the last `id`.
- An open stream keeps its sessions going. Closing it does not stop them, but a session nobody follows for 2 minutes (no stream, no read, no webhook) stops by itself with `end_reason: "no_reader"`: reconnect promptly, or [stop](https://docs.vidnavigator.com/api-reference/endpoint/tiktok-live-transcribe-stop.md) the sessions you leave.

Reading the stream costs nothing.

## Request Parameters

| Parameter       | In     | Required | Description                                                                                                           |
| --------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `session_id`    | query  | No       | Keep the events of this session only.                                                                                 |
| `after`         | query  | No       | Resume after this event `id`. `0` replays every event still kept.                                                     |
| `Last-Event-ID` | header | No       | The same as `after`, the way browsers' `EventSource` and most Server-Sent Events clients send it when they reconnect. |

## Example Usage

```bash cURL
# -N turns off curl's buffering, so each event prints as it arrives
curl -N "https://api.vidnavigator.com/v1/tiktok/live/transcribe/events?session_id=3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55" \
  -H "X-API-Key: YOUR_API_KEY"
```

```python Python
from vidnavigator import VidNavigatorClient

client = VidNavigatorClient(api_key="YOUR_API_KEY")

# Reconnects by itself, with the id of the last event received
for event in client.stream_tiktok_live_transcription_events(session_id="3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55"):
    print(event.event, event.id, event.data)
```

```javascript JavaScript
import { VidNavigatorClient } from 'vidnavigator';

const vn = new VidNavigatorClient({ apiKey: 'YOUR_API_KEY' });

// Reconnects by itself, with the id of the last event received
const events = vn.streamTikTokLiveTranscriptionEvents({ session_id: '3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55' });
for await (const event of events) {
  console.log(event.event, event.id, event.data);
}
```

## The Stream

```text
retry: 3000

id: 4820
event: started
data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","status":"listening","started_at":"2026-12-03T11:18:20.031Z"}

event: partial
data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","text":"I'm from","start":103.29}

id: 4821
event: final
data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","seq":57,"start":103.29,"end":104.88,"text":"I'm from Gambia.","language":"en","timestamp":"2026-12-03T11:20:03.290Z"}

: keep-alive

id: 4822
event: ended
data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","status":"ended","end_reason":"live_ended","error":null,"duration_seconds":1830.4,"segments_count":412,"ended_at":"2026-12-03T11:48:50.512Z"}
```

Each event has an `event` line (its type) and one `data` line: a JSON object that always carries `session_id`. Events are separated by an empty line.

| `event`   | `data`                                                                                                                           | When                                                                       |
| --------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `started` | `session_id`, `status`, `started_at`                                                                                             | The session starts listening                                               |
| `final`   | `session_id` and a final sentence: `seq`, `start`, `end`, `text`, `language`, `timestamp`, and `speaker` with `include_speakers` | A sentence is complete: it will not change                                 |
| `partial` | `session_id`, `text`, `start`                                                                                                    | The sentence being said changed (sessions started with `include_partials`) |
| `ended`   | `session_id`, `status`, `end_reason`, `error`, `duration_seconds`, `segments_count`, `ended_at`                                  | The session is over                                                        |

- A `final` sentence has the fields of a [sentence](https://docs.vidnavigator.com/api-reference/endpoint/tiktok-live-transcribe-session.md#segments). Its `seq` counts the sentences of its session, from 1, without gaps.
- A `partial` is updated several times a second and can still change. It has no `id` and is not replayed: the `final` sentence that follows replaces it.
- On `ended`, `status` is `ended` (see `end_reason`) or `failed` (see `error`). The values are those of [the session](https://docs.vidnavigator.com/api-reference/endpoint/tiktok-live-transcribe.md#the-session).
- The stream opens with a block that holds no event: `retry`, how many milliseconds Server-Sent Events clients wait before they reconnect, and `id`, the number the stream starts after. Keep that `id` like any other: a connection cut before the first event then resumes where it should. Lines that start with `:` are comments: ignore them.

## Resuming

Keep the `id` of the last event you handled. When the connection is cut, or when your own process restarts, connect again with that `id`:

```bash Last-Event-ID header
curl -N "https://api.vidnavigator.com/v1/tiktok/live/transcribe/events" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Last-Event-ID: 4821"
```

```bash after parameter
curl -N "https://api.vidnavigator.com/v1/tiktok/live/transcribe/events?after=4821" \
  -H "X-API-Key: YOUR_API_KEY"
```

The stream resumes with event `4822`. `after=0` replays every event still kept, then goes on with the new ones.

- The `id` counts the events of your **organization**, every session together, so one number resumes a connection that carries several sessions. With `session_id`, the ids you receive can skip numbers: the events of your other sessions took them.
- The events of a session are no longer replayed once it ended more than 24 hours ago. Until then, the sentences of a session can also be read in pages with [`GET /tiktok/live/transcribe/{session_id}`](https://docs.vidnavigator.com/api-reference/endpoint/tiktok-live-transcribe-session.md).
- The Python and JavaScript SDKs reconnect by themselves with the last `id`. A reconnect loop over plain HTTP is in the guide: [Transcribing a TikTok LIVE in Real Time](https://docs.vidnavigator.com/guides/tiktok-live-transcription.md#event-stream).

## Error Cases

Errors are answered as JSON, before the stream starts.

| Status | `error`             | When                                                                                       |
| ------ | ------------------- | ------------------------------------------------------------------------------------------ |
| `400`  | `invalid_parameter` | `after` (or `Last-Event-ID`) is not an event id                                            |
| `403`  | `access_denied`     | LIVE transcription is not enabled for your organization                                    |
| `404`  | `session_not_found` | No session with this `session_id` in your organization, or it ended more than 24 hours ago |

## OpenAPI

````yaml GET /tiktok/live/transcribe/events
openapi: 3.0.3
info:
  title: VidNavigator Developer API
  version: 1.0.0
servers:
  - url: https://api.vidnavigator.com/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /tiktok/live/transcribe/events:
    get:
      summary: Stream LIVE transcription events
      description: |-
        The events of your organization's LIVE transcription sessions, as they happen, over one HTTP connection that stays open ([Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html), `text/event-stream`). One connection carries every session of the organization; `session_id` keeps the events of one.

        | `event` | `data` | When |
        |---|---|---|
        | `started` | `session_id`, `status`, `started_at` | The session starts listening |
        | `final` | `session_id` and a final sentence (`LiveTranscriptSegment`) | A sentence is complete: it will not change |
        | `partial` | `session_id`, `text`, `start` | The sentence being said changed (sessions started with `include_partials`) |
        | `ended` | `session_id`, `status`, `end_reason`, `error`, `duration_seconds`, `segments_count`, `ended_at` | The session is over |

        ```
        id: 4821
        event: final
        data: {"session_id":"3f0c1c1e-7a52-4d0e-9a3b-0d2f8c1b7e55","seq":57,"start":103.29,"end":104.88,"text":"I'm from Gambia.","language":"en","timestamp":"2026-12-03T11:20:03.290Z"}
        ```

        **Resuming.** Every event except `partial` has an `id`, a number that grows by one with each event of your organization. When the connection is cut, reconnect with the last id you received in the `Last-Event-ID` header (an `EventSource` does it by itself) or in `after`: the stream resumes with the event that followed, so no final sentence is lost. Without either, the stream starts with the events to come; when `session_id` names a session that is already over, it starts with that session's `ended` event. The stream opens with the id it starts after and a `retry` delay, so a connection cut before any event still resumes where it should. The events of a session are kept until 24 hours after it ends. A `partial` has no id and is not replayed.

        A comment line (`: keep-alive`) is sent every 15 seconds when there is nothing else to send. Connections are closed from time to time (deployments): reconnect with the last id.
      operationId: streamTikTokLiveTranscriptionEvents
      tags:
        - Speech to text
      parameters:
        - name: session_id
          in: query
          required: false
          description: Keep the events of this session only.
          schema:
            type: string
            format: uuid
        - name: after
          in: query
          required: false
          description: Resume after this event id (same as the `Last-Event-ID` header). `0` replays every event still kept.
          schema:
            type: integer
            minimum: 0
        - name: Last-Event-ID
          in: header
          required: false
          description: The id of the last event received on a previous connection.
          schema:
            type: integer
            minimum: 0
      responses:
        "200":
          description: The stream of events. It stays open until you close it.
          content:
            text/event-stream:
              schema:
                type: string
                description: "Server-Sent Events: `id`, `event` and `data` lines, `data` being one JSON object."
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          description: LIVE transcription is not enabled for the organization of this API key (`access_denied`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  error:
                    type: string
                    enum:
                      - access_denied
                      - insufficient_scope
                  error_code:
                    type: string
                    enum:
                      - access_denied
                      - insufficient_scope
                  message:
                    type: string
        "404":
          description: No session with this id in your organization (`session_not_found`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  error:
                    type: string
                    enum:
                      - session_not_found
                  error_code:
                    type: string
                    enum:
                      - session_not_found
                  message:
                    type: string
        "429":
          $ref: "#/components/responses/RateLimitExceeded"
        "500":
          $ref: "#/components/responses/InternalServerError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"
components:
  responses:
    BadRequest:
      description: Bad request - invalid parameters. On /transcribe the `error` field may be `missing_parameter`, `unsupported_url`, `invalid_url`, `request_body_required`, `video_too_long`, or `no_videos_found` (the post carries no video).
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
              message:
                type: string
    Unauthorized:
      description: The API key is missing (`missing_api_key`), unknown or malformed (`invalid_api_key`), or deactivated (`api_key_deactivated`).
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - missing_api_key
                  - invalid_api_key
                  - api_key_deactivated
              error_code:
                type: string
                description: Same as `error`.
              message:
                type: string
    RateLimitExceeded:
      description: "Too many requests (`rate_limit_exceeded`). Wait `Retry-After` seconds before the next call. Limits: https://docs.vidnavigator.com/api-reference/rate-limiting"
      headers:
        Retry-After:
          description: Seconds to wait before the next call.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Calls allowed in the current window for this kind of call.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: "Calls left in the current window: 0 on this answer."
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - rate_limit_exceeded
              error_code:
                type: string
                description: Same as `error`.
              message:
                type: string
              retry_after_seconds:
                type: integer
                description: Same as the `Retry-After` header.
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - metadata_fetch_failed
                  - audio_extraction_failed
                  - transcription_failed
                  - internal_server_error
              message:
                type: string
    ServiceUnavailable:
      description: "The service is briefly unable to authenticate or bill the request (`service_unavailable`). Nothing was charged: retry after the `Retry-After` seconds."
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: string
                enum:
                  - service_unavailable
              error_code:
                type: string
                description: Same as `error`.
              message:
                type: string
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key authentication. Include your VidNavigator API key in the X-API-Key header.
````
