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

# Update Message

> Update a specific message.

### Changelog
| Version      | Description | 
| ---------------- | ------------|
| 6.12.0           | Fixed `customFields` not updating if `text` was unchanged |
| 6.4.0            | Add previewUrls param       |        
| 0.49.0           | Added       |

## OpenAPI

````json POST /api/v1/chat.update
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Messaging"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Chat"
    },
    {
      "name": "DM"
    },
    {
      "name": "Auto-Translate"
    }
  ],
  "paths": {
    "/api/v1/chat.update": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Update Message",
        "description": "Update a specific message.\n\n### Changelog\n| Version      | Description | \n| ---------------- | ------------|\n| 6.12.0           | Fixed `customFields` not updating if `text` was unchanged |\n| 6.4.0            | Add previewUrls param       |        \n| 0.49.0           | Added       |",
        "operationId": "post-api-v1-chat.update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Auth-Token"
          },
          {
            "$ref": "#/components/parameters/UserId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "roomId": {
                    "type": "string",
                    "description": "The room ID where the message is."
                  },
                  "msgId": {
                    "type": "string",
                    "description": "The message ID to update."
                  },
                  "text": {
                    "type": "string",
                    "description": "Updated text for the message."
                  },
                  "previewUrls": {
                    "type": "array",
                    "description": "An array to define which URL previews should be retrieved from each message.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "customFields": {
                    "type": "object",
                    "description": "You can add custom fields for messages. For example, set priorities for messages.\n\nYou must enable this option and define the validation in the workspace settings. See the <a href='https://docs.rocket.chat/use-rocket.chat/workspace-administration/settings/message' target='_blank'>Message</a> settings for further information.",
                    "example": {
                      "priority": "high"
                    }
                  }
                },
                "required": [
                  "roomId",
                  "msgId",
                  "text"
                ]
              },
              "examples": {
                "Example": {
                  "value": {
                    "roomId": "64f0f82c2c26843a68c1f7ba",
                    "msgId": "vzGBzSwy6jJQDwtZe",
                    "text": "Updated list of links! https://google.com https://hola.org/ https://www.usepayday.com/ https://www.getbumpa.com/ https://www.atlassian.com/software/jira http://localhost:3000/",
                    "previewUrls": [
                      "https://google.com",
                      "http://localhost:3000/"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "rid": {
                          "type": "string"
                        },
                        "msg": {
                          "type": "string"
                        },
                        "ts": {
                          "type": "string"
                        },
                        "u": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          }
                        },
                        "_updatedAt": {
                          "type": "string"
                        },
                        "urls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "meta": {
                                "type": "object"
                              },
                              "ignoreParse": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "mentions": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "channels": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "md": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "value": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string"
                                    },
                                    "value": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "editedAt": {
                          "type": "string"
                        },
                        "editedBy": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Example": {
                    "value": {
                      "message": {
                        "_id": "vzGBzSwy6jJQDwtZe",
                        "rid": "64f0f82c2c26843a68c1f7ba",
                        "msg": "Updated list of links! https://google.com https://hola.org/ https://www.usepayday.com/ https://www.getbumpa.com/ https://www.atlassian.com/software/jira http://localhost:3000/",
                        "ts": "2023-09-20T17:27:59.945Z",
                        "u": {
                          "_id": "rbAXPnMktTFbNpwtJ",
                          "username": "roxie",
                          "name": "test test"
                        },
                        "_updatedAt": "2023-09-20T22:22:45.793Z",
                        "urls": [
                          {
                            "url": "https://google.com",
                            "meta": {}
                          },
                          {
                            "url": "https://hola.org/",
                            "meta": {},
                            "ignoreParse": "true"
                          },
                          {
                            "url": "https://www.atlassian.com/software/jira",
                            "meta": {},
                            "ignoreParse": "true"
                          },
                          {
                            "url": "http://localhost:3000/",
                            "meta": {}
                          }
                        ],
                        "mentions": [],
                        "channels": [],
                        "md": [
                          {
                            "type": "PARAGRAPH",
                            "value": [
                              {
                                "type": "PLAIN_TEXT",
                                "value": "Updated list of links! "
                              },
                              {
                                "type": "LINK",
                                "value": {
                                  "src": {
                                    "type": "PLAIN_TEXT",
                                    "value": "https://google.com"
                                  },
                                  "label": [
                                    {
                                      "type": "PLAIN_TEXT",
                                      "value": "https://google.com"
                                    }
                                  ]
                                }
                              },
                              {
                                "type": "PLAIN_TEXT",
                                "value": " "
                              },
                              {
                                "type": "LINK",
                                "value": {
                                  "src": {
                                    "type": "PLAIN_TEXT",
                                    "value": "https://hola.org/"
                                  },
                                  "label": [
                                    {
                                      "type": "PLAIN_TEXT",
                                      "value": "https://hola.org/"
                                    }
                                  ]
                                }
                              },
                              {
                                "type": "PLAIN_TEXT",
                                "value": " "
                              },
                              {
                                "type": "LINK",
                                "value": {
                                  "src": {
                                    "type": "PLAIN_TEXT",
                                    "value": "https://www.atlassian.com/software/jira"
                                  },
                                  "label": [
                                    {
                                      "type": "PLAIN_TEXT",
                                      "value": "https://www.atlassian.com/software/jira"
                                    }
                                  ]
                                }
                              },
                              {
                                "type": "PLAIN_TEXT",
                                "value": " "
                              },
                              {
                                "type": "LINK",
                                "value": {
                                  "src": {
                                    "type": "PLAIN_TEXT",
                                    "value": "http://localhost:3000/"
                                  },
                                  "label": [
                                    {
                                      "type": "PLAIN_TEXT",
                                      "value": "http://localhost:3000/"
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        ],
                        "editedAt": "2023-09-20T22:22:45.737Z",
                        "editedBy": {
                          "_id": "rbAXPnMktTFbNpwtJ",
                          "username": "roxie"
                        }
                      },
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "The required \"messageId\" param is missing. [error-messageid-param-not-provided]",
                      "errorType": "error-messageid-param-not-provided"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The `authToken` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      },
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The `userId` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      }
    },
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

