---
title: "Update Transcript"
method: PUT
path: "/media/transcript/{mediaId}"
tags: ["Media (Audio/Video)"]
---

# Update Transcript

`PUT /media/transcript/{mediaId}`

## Request

- Base URL: `https://api.speakai.co/v1`
- URL: `https://api.speakai.co/v1/media/transcript/{mediaId}`
- Auth: API key in header `x-speakai-key` and API key in header `x-access-token`

Replaces the transcript of a media file with the array you send. Read the transcript first with `GET /media/transcript/{mediaId}`, change what you need, and send the whole array back.

#### Avoid overwriting someone else's save

Send `expectedTranscriptRevision` with the `transcriptRevision` you read. If anyone saved the transcript since, the request returns 409 "This transcript changed since you opened it. Reload to keep editing." and changes nothing: read the transcript again, reapply your change, and save with the new revision. Leave it out and the save always goes through, replacing whatever is there.

A successful save increases the revision by one and returns the new value. Labels and comments on passages are then moved to follow their words in the background.

#### Request rules

- `transcript` needs at least one sentence; an empty transcript cannot be saved.
- Sentence `id` values must be unique when you send `expectedTranscriptRevision`.
- Keys that are not listed below return 400.

#### Errors

- `400` when the body fails validation.
- `404` when your company has no media with that id.
- `409` when `expectedTranscriptRevision` is stale.

## Path parameters

- `mediaId` string, required

## Request body

- object
  - `transcript` object[], required: The full transcript, as an array of sentences. At least one.
    - `id` number, required: Sentence id. Must be unique across the array when you send `expectedTranscriptRevision`.
    - `speakerId` string, required: Speaker id. Trimmed, required.
    - `speaker` object: The team member matched to this speaker, when there is one. Every key may be empty or `null`.
      - `userId` string, nullable: Matched user id.
      - `name` string, nullable: Matched name.
      - `email` string, nullable: Matched email.
    - `text` string, required: Sentence text. Trimmed. An empty string is accepted.
    - `confidence` number, required: Sentence confidence, as returned by the transcript endpoint.
    - `language` string: Language code, as returned by the transcript endpoint.
    - `score` object: Sentence sentiment, as returned by the transcript endpoint. Send it back so a save does not drop it.
      - `compound` number, required
      - `neg` number, required
      - `neu` number, required
      - `pos` number, required
    - `instances` object[]: Timing of the sentence.
      - `start` string, required: Start time as `HH:MM:SS.mmm`. Required.
      - `end` string, required: End time as `HH:MM:SS.mmm`. Required.
      - `startInSec` number
      - `endInSec` number
      - `adjustedStart` string: Adjusted start time.
      - `adjustedEnd` string: Adjusted end time.
    - `entities` object[]: Word-level entries, as returned by the transcript endpoint. Not validated further.
  - `expectedTranscriptRevision` integer: Optional. The `transcriptRevision` you read the transcript at. Integer, 0 or more. When it is stale the save returns 409 and nothing is written.

## Response `200`

Success

- object
  - `status` 'success': `success`.
  - `message` string: `Updated successfully.`
  - `data` object
    - `transcriptRevision` integer: The transcript revision after this save.

## Other responses

- `400`: The body failed validation
- `404`: No media with that id in your company
- `409`: The transcript changed since you read it

---

[API](https://skmtc.dev/speakai/apis/speak-ai-api.md) · [All operations](https://skmtc.dev/speakai/apis/speak-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/speakai/apis/speak-ai-api/revisions/52d777e6d46e?raw)
