---
title: "Edit, resolve or reopen a comment"
method: PATCH
path: "/media/{mediaId}/comments/{commentId}"
tags: ["Comments"]
---

# Edit, resolve or reopen a comment

`PATCH /media/{mediaId}/comments/{commentId}`

## Request

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

Send exactly one of `body` or `isResolved`; both or neither returns 400.

- `body` edits the text. Only the author can edit a comment; anyone else gets 403 "You can only edit your own comments." No permission is needed to edit your own.
- `isResolved` resolves (`true`) or reopens (`false`) a thread. It needs the **Comments: Update** permission (on by default for admins and members) and works only on the first comment of a thread; a reply returns 400.

#### Errors

- `400` when the body breaks the rules above or fails validation.
- `403` when you edit someone else's comment (the error envelope shown), or resolve without the permission (`{"status": "failed", "message": "You do not have permission to perform this action"}`).
- `404` when the media or the comment does not exist, or the comment was deleted.

## Path parameters

- `mediaId` string, required
- `commentId` string, required

## Request body

- object
  - `body` string: New text. Author only. Comment text. Trimmed, then 1 to 5,000 characters.
  - `isResolved` boolean: `true` to resolve the thread, `false` to reopen it. First comment of a thread only.

## Response `200`

Success

- object
  - `status` 'success': `success` on every 2xx response.
  - `data` object: A comment.
    - `commentId` string: Id of the comment.
    - `mediaId` string: Id of the media.
    - `anchor` object, nullable: The passage the comment is on, or `null` for a comment on the whole file. Replies carry `null`.
      - `startWord` integer: Position of the first word.
      - `endWord` integer: Position of the last word, inclusive.
      - `exact` string: The quoted words, joined by single spaces.
      - `prefix` string: Up to 32 characters of transcript text before the quote.
      - `suffix` string: Up to 32 characters of transcript text after the quote.
      - `startInSec` number: Start time of the first word, in seconds.
      - `endInSec` number: End time of the last word, in seconds.
      - `speakerIds` string[]: Speakers of the quoted words.
      - `transcriptRevision` integer: The transcript revision these positions refer to.
    - `parentId` string, nullable: `commentId` of the thread's first comment for a reply, `null` for the first comment.
    - `body` string: Comment text. Empty on a deleted first comment that still has replies.
    - `mediaLabelId` string: Labelled passage the comment is linked to. Present only when one was linked.
    - `status` 'active' | 'shifted' | 'needs_review': Present only on comments with an anchor. `active`: the same words, possibly at new positions after an edit. `shifted`: most of the words survived an edit near the same time, but the text changed. `needs_review`: the words changed too much to follow; `anchor` then holds a suggested passage on the new transcript and `lastResolved` the last position a person confirmed.
    - `lastResolved` object: Present only while `status` is `needs_review`: the last position a person confirmed.
      - `startWord` integer: Position of the first word.
      - `endWord` integer: Position of the last word, inclusive.
      - `exact` string: The quoted words, joined by single spaces.
      - `prefix` string: Up to 32 characters of transcript text before the quote.
      - `suffix` string: Up to 32 characters of transcript text after the quote.
      - `startInSec` number: Start time of the first word, in seconds.
      - `endInSec` number: End time of the last word, in seconds.
      - `speakerIds` string[]: Speakers of the quoted words.
      - `transcriptRevision` integer: The transcript revision these positions refer to.
    - `isResolved` boolean: `true` once the thread is resolved. Only set on the first comment of a thread.
    - `resolvedBy` string: Id of the person who resolved the thread. Present only while it is resolved.
    - `isDeleted` boolean: `true` on a deleted first comment kept because it has replies.
    - `userId` string: Id of the author.
    - `createdAt` string, date-time: When it was posted.
    - `updatedAt` string, date-time: When it last changed.

## Other responses

- `400`: The body broke a rule or failed validation
- `403`: Not your comment, or no Comments: Update permission
- `404`: The media or comment does not exist

---

[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)
