---
title: "Edit a chat message"
method: PUT
path: "/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}"
tags: ["chat"]
---

# Edit a chat message

`PUT /ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/{messageId}`

## Path parameters

- `apiVersion` 'v1', required
- `token` string, required
- `messageId` integer, required

## Headers

- `x-nextcloud-federation` string
- `OCS-APIRequest` boolean, required

## Request body

- object
  - `message` string, required — the message to send

## Response `200`

Message edited successfully

- object
  - `ocs` object, required
    - `meta` OCSMeta, required
      - `status` string, required
      - `statuscode` integer, required
      - `message` string
      - `totalitems` string
      - `itemsperpage` string
    - `data` ChatMessageWithParent, required
      - `actorDisplayName` string, required — Display name of the message author (can be empty for type `deleted_users` and `guests`)
      - `actorId` string, required — Actor id of the message author
      - `actorType` string, required — See [Constants - Actor types of chat messages](https://nextcloud-talk.readthedocs.io/en/latest/constants#actor-types-of-chat-messages)
      - `expirationTimestamp` integer, required — Unix time stamp when the message expires and should be removed from the clients UI without further note or warning (only available with `message-expiration` capability)
      - `message` string, required — Message string with placeholders (see [Rich Object String](https://github.com/nextcloud/server/issues/1706))
      - `messageParameters` object, required — Message parameters for `message` (see [Rich Object String](https://github.com/nextcloud/server/issues/1706))
      - `messageType` string, required — Currently known types are `comment`, `comment_deleted`, `system` and `command`
      - `systemMessage` string, required — Empty for normal chat message or the type of the system message (untranslated)
      - `deleted` true — Set to `true` when the message was deleted
      - `id` integer, required — ID of the comment
      - `isReplyable` boolean, required — True if the user can post a reply to this message (only available with `chat-replies` capability)
      - `markdown` boolean, required — Whether the message should be rendered as markdown or shown as plain text
      - `reactions` object, required — An array map with relation between reaction emoji and total count of reactions with this emoji
      - `reactionsSelf` string[] — When the user reacted this is the list of emojis the user reacted with
      - `referenceId` string, required — A reference string that was given while posting the message to be able to identify a sent message again (only available with `chat-reference-id` capability)
      - `timestamp` integer, required — Timestamp in seconds and UTC time zone
      - `token` string, required — Conversation token
      - `lastEditActorDisplayName` string — Display name of the last editing author (only available with `edit-messages` capability and when the message was actually edited)
      - `lastEditActorId` string — Actor id of the last editing author (only available with `edit-messages` capability and when the message was actually edited)
      - `lastEditActorType` string — Actor type of the last editing author - See [Constants - Actor types of chat messages](https://nextcloud-talk.readthedocs.io/en/latest/constants#actor-types-of-chat-messages) (only available with `edit-messages` capability and when the message was actually edited)
      - `lastEditTimestamp` integer — Unix time stamp when the message was last edited (only available with `edit-messages` capability and when the message was actually edited)
      - `silent` boolean — Whether the message was sent silently (only available with `silent-send-state` capability)
      - `threadId` integer — Thread ID if this message is part of a thread
      - `isThread` boolean — Whether this message is the root of a thread
      - `threadTitle` string — Title of the thread if this message is the root of a thread
      - `threadReplies` integer — Number of replies in the thread if this message is the root of a thread
      - `metaData` ChatMessageMetaData
        - `pinnedActorType` string — Actor type of the attendee that pinned the message - Required capability: `pinned-messages`
        - `pinnedActorId` string — Actor ID of the attendee that pinned the message - Required capability: `pinned-messages`
        - `pinnedActorDisplayName` string — Display name of the attendee that pinned the message - Required capability: `pinned-messages`
        - `pinnedAt` integer — Timestamp when the message was pinned - Required capability: `pinned-messages`
        - `pinnedUntil` integer — Timestamp until when the message is pinned. If missing the message is pinned infinitely - Required capability: `pinned-messages`
        - `threadId` integer — Set when a thread is created with this message. If missing, no thread creation is associated with this message
        - `threadTitle` string — Set when a thread is created with this message. If missing, no thread creation is associated with this message
        - `replyToMessageId` integer — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message id
        - `replyToConversationToken` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's group conversation token.
        - `replyToConversationName` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's group conversation name
        - `replyToActorDisplayName` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's actor display name
      - `parent` union
        - ChatMessage
          - `actorDisplayName` string, required — Display name of the message author (can be empty for type `deleted_users` and `guests`)
          - `actorId` string, required — Actor id of the message author
          - `actorType` string, required — See [Constants - Actor types of chat messages](https://nextcloud-talk.readthedocs.io/en/latest/constants#actor-types-of-chat-messages)
          - `expirationTimestamp` integer, required — Unix time stamp when the message expires and should be removed from the clients UI without further note or warning (only available with `message-expiration` capability)
          - `message` string, required — Message string with placeholders (see [Rich Object String](https://github.com/nextcloud/server/issues/1706))
          - `messageParameters` object, required — Message parameters for `message` (see [Rich Object String](https://github.com/nextcloud/server/issues/1706))
          - `messageType` string, required — Currently known types are `comment`, `comment_deleted`, `system` and `command`
          - `systemMessage` string, required — Empty for normal chat message or the type of the system message (untranslated)
          - `deleted` true — Set to `true` when the message was deleted
          - `id` integer, required — ID of the comment
          - `isReplyable` boolean, required — True if the user can post a reply to this message (only available with `chat-replies` capability)
          - `markdown` boolean, required — Whether the message should be rendered as markdown or shown as plain text
          - `reactions` object, required — An array map with relation between reaction emoji and total count of reactions with this emoji
          - `reactionsSelf` string[] — When the user reacted this is the list of emojis the user reacted with
          - `referenceId` string, required — A reference string that was given while posting the message to be able to identify a sent message again (only available with `chat-reference-id` capability)
          - `timestamp` integer, required — Timestamp in seconds and UTC time zone
          - `token` string, required — Conversation token
          - `lastEditActorDisplayName` string — Display name of the last editing author (only available with `edit-messages` capability and when the message was actually edited)
          - `lastEditActorId` string — Actor id of the last editing author (only available with `edit-messages` capability and when the message was actually edited)
          - `lastEditActorType` string — Actor type of the last editing author - See [Constants - Actor types of chat messages](https://nextcloud-talk.readthedocs.io/en/latest/constants#actor-types-of-chat-messages) (only available with `edit-messages` capability and when the message was actually edited)
          - `lastEditTimestamp` integer — Unix time stamp when the message was last edited (only available with `edit-messages` capability and when the message was actually edited)
          - `silent` boolean — Whether the message was sent silently (only available with `silent-send-state` capability)
          - `threadId` integer — Thread ID if this message is part of a thread
          - `isThread` boolean — Whether this message is the root of a thread
          - `threadTitle` string — Title of the thread if this message is the root of a thread
          - `threadReplies` integer — Number of replies in the thread if this message is the root of a thread
          - `metaData` ChatMessageMetaData
            - `pinnedActorType` string — Actor type of the attendee that pinned the message - Required capability: `pinned-messages`
            - `pinnedActorId` string — Actor ID of the attendee that pinned the message - Required capability: `pinned-messages`
            - `pinnedActorDisplayName` string — Display name of the attendee that pinned the message - Required capability: `pinned-messages`
            - `pinnedAt` integer — Timestamp when the message was pinned - Required capability: `pinned-messages`
            - `pinnedUntil` integer — Timestamp until when the message is pinned. If missing the message is pinned infinitely - Required capability: `pinned-messages`
            - `threadId` integer — Set when a thread is created with this message. If missing, no thread creation is associated with this message
            - `threadTitle` string — Set when a thread is created with this message. If missing, no thread creation is associated with this message
            - `replyToMessageId` integer — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message id
            - `replyToConversationToken` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's group conversation token.
            - `replyToConversationName` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's group conversation name
            - `replyToActorDisplayName` string — Set only when a message in a convo is private replied on a 1-1 room. Represents the parent message's actor display name
        - DeletedChatMessage
          - `id` integer, required — ID of the parent comment
          - `deleted` true, required — `true` when the parent is deleted

## Other responses

- `202` — Message edited successfully, but a bot or Matterbridge is configured, so the information can be replicated to other services
- `400` — Editing message is not possible, e.g. when the new message is empty or the message is too old
- `403` — Missing permissions to edit message
- `404` — Message not found
- `405` — Editing this message type is not allowed
- `413` — Message too long

---

[API](https://skmtc.net/nextcloud/apis/spreed-full.md) · [All operations](https://skmtc.net/nextcloud/apis/spreed-full/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nextcloud/spreed-full/versions/ef93f7206113/schema)
