服务端 API/消息/消息卡片/更新应用发送的消息卡片
# 更新应用发送的消息卡片

更新应用已发送的消息卡片内容。

**注意事项**：注意事项:
- 需要开启[机器人能力](https://open.larksuite.com/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)
- 若以user_access_token更新消息，该操作用户必须是卡片消息的发送者
- 仅支持对所有人更新**未撤回**的[「共享卡片」](ukTMukTMukTM/uAjNwUjLwYDM14CM2ATN)消息，需在卡片的config属性中，显式声明 =="update_multi":true==。 
- **不支持更新批量消息**
- 文本消息请求体最大不能超过150KB；卡片及富文本消息请求体最大不能超过30KB
- 仅支持修改14天内发送的消息
- 单条消息更新频控为**5QPS**

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.larksuite.com/open-apis/im/v1/messages/:message_id
HTTP Method | PATCH
接口频率限制 | [1000 次/分钟、50 次/秒](https://open.larksuite.com/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用**<br>开启任一权限即可 | 获取与发送单聊、群组消息(im:message)<br>以应用的身份发消息(im:message:send_as_bot)<br>更新消息(im:message:update)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `tenant_access_token`<br>或<br>`user_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：如何选择与获取 access token](https://open.larksuite.com/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | 是 | **固定值**："application/json; charset=utf-8"

### 路径参数

名称 | 类型 | 描述
---|---|---
message_id | string | 待更新的消息的ID，仅支持更新消息卡片(`interactive`类型)，详情参见[消息ID说明](https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/intro#ac79c1c2)<br>**示例值**："om_dc13264520392913993dd051dba21dcf"

### 请求体

名称 | 类型 | 必填 | 描述
---|---|---|---
content | string | 是 | 消息内容 json 格式，[发送消息 content 说明](https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json)，参考文档中的卡片格式<br>**示例值**："参考链接"

### 请求体示例
```json
{
    "content": "参考链接"
}
```

## 响应

### 响应体

名称 | 类型 | 描述
---|---|---
code | int | 错误码，非 0 表示失败
msg | string | 错误描述
data | \- | \-

### 响应体示例
```json
{
    "code": 0,
    "data": {},
    "msg": "ok"
}
```

### 错误码

HTTP状态码 | 错误码 | 描述 | 排查建议
---|---|---|---
400 | 230001 | Your request contains an invalid request parameter. | 参数错误，请根据接口返回的错误信息并参考文档检查输入参数。
400 | 230006 | Bot ability is not activated. | [机器人能力](https://open.larksuite.com/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)未启用 。可在[开发者后台](https://open.larksuite.com/app) -> 应用能力 -> 添加应用能力页面添加机器人功能，发布新版本后生效。
400 | 230011 | The message is recalled. | 消息已被撤回，不支持该操作。
400 | 230013 | Bot has NO availability to this user. | 机器人对用户没有[可用性](https://open.larksuite.com/document/home/introduction-to-scope-and-authorization/availability)。可在[开发者后台](https://open.larksuite.com/app) -> 应用发布 -> 版本管理与发布 -> 创建版本页面编辑应用的可用范围，发布新版本后生效。
400 | 230020 | This operation triggers the frequency limit. | 当前操作触发限频，请降低请求频率。
400 | 230025 | The length of the message content reaches its limit. | 消息体长度超出限制。文本消息最大不能超过150KB，卡片及富文本消息最大不能超过30KB；此外，若消息中包含大量样式标签，会使实际消息体长度大于您输入的请求体长度。
400 | 230027 | Lack of necessary permissions. | 暂不支持在外部群中进行本操作。
400 | 230028 | The messages do NOT pass the audit. | 消息DLP审查未通过，当消息内容中含有明文电话号码、明文个人邮箱等内容时可能会触发该错误；请根据接口返回的错误信息检查消息内容。
400 | 230031 | Message can only be modified within 14 days after sending. | 在消息发送后的14天内才可以修改消息内容。
400 | 230099 | Failed to create card content. | 创建卡片失败，失败原因请查看接口报错信息。
400 | 230110 | Action unavailable as the message has been deleted. | 消息已删除。
400 | 232009 | Your request specifies a chat which has already been dissolved. | 群组已被解散。

