---
title: "Edit a chat message"
method: PATCH
path: "/chat/threads/{chatId}/messages/{messageId}"
tags: ["Chat"]
---

# Edit a chat message

`PATCH /chat/threads/{chatId}/messages/{messageId}`

## Request

- Base URL: `https://viral.app/api/v1`
- URL: `https://viral.app/api/v1/chat/threads/{chatId}/messages/{messageId}`
- Auth: API key in header `x-api-key`

Replaces the text of a message. Participants see the new text marked as edited; in a group chat, creators the edit newly @mentions are notified. An API key can edit only the messages that same key sent. Messages typed in the dashboard (its owner's included), messages another key sent and system messages return 400.

## Path parameters

- `chatId` string, required
- `messageId` string, required

## Request body

- object
  - `content` string, required

## Response `200`

OK

- object
  - `message` object, required
    - `id` string, required
    - `chatId` string, required
    - `senderType` 'org' | 'creator' | 'system', required
    - `senderUserId` string, nullable, required
    - `senderDisplayName` string, nullable, required
    - `senderMember` object, nullable
      - `firstName` string, required
      - `image` string, nullable, required
    - `kind` string, required
    - `content` string, required
    - `metadata` object, nullable, required
    - `clientMessageId` string, required
    - `replyTo` object, nullable, required
      - `messageId` string, required
      - `senderType` 'org' | 'creator' | 'system', required
      - `senderUserId` string, nullable
      - `senderDisplayName` string, nullable, required
      - `senderMember` object, nullable
        - `firstName` string, required
        - `image` string, nullable, required
      - `contentPreview` string, required
      - `deleted` boolean, required
    - `reactions` object[], required
      - `emoji` string, required
      - `userId` string, required
      - `side` 'org' | 'creator', required
    - `attachments` object[], required
      - `id` string, required
      - `fileName` string, required
      - `mimeType` string, required
      - `sizeBytes` integer, required
      - `url` string, nullable, required
    - `createdAt` string, date-time, required
    - `editedAt` string, date-time, nullable, required
    - `deletedAt` string, date-time, nullable, required
    - `pinnedAt` string, date-time, nullable
    - `seenAt` string, date-time, nullable
    - `source` 'ui' | 'api' | 'copilot' | 'system', nullable
    - `language` string, nullable

## Other responses

- `400`: 400
- `401`: 401
- `402`: 402
- `404`: 404
- `408`: 408
- `429`: 429
- `500`: 500

---

[API](https://skmtc.dev/viral/apis/viral-app-api.md) · [All operations](https://skmtc.dev/viral/apis/viral-app-api/llms.txt) · [OpenAPI document](https://skmtc.dev/viral/apis/viral-app-api/revisions/31e97fa79ef1?raw)
