Skip to content

更新标签 ​

更新用户指定标签的名字、颜色等信息

请求 ​

项目值
HTTP URLhttps://open.feishu.cn/open-apis/mail/v1/user_mailboxes/:user_mailbox_id/labels/:label_id
HTTP MethodPATCH
接口频率限制5 次/秒
支持的应用类型custom
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用mail:user_mailbox.message:modify 修改邮件

请求头 ​

名称类型必填描述
Authorizationstring是tenant_access_token 或 user_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring是固定值:"application/json; charset=utf-8"

路径参数 ​

名称类型描述
user_mailbox_idstring用户邮箱地址。当使用用户身份访问时,可以输入"me"代表当前调用接口用户
示例值:"user@xxx.xx 或 me"
label_idstring标签ID,创建标签成功后返回的标签ID,或可通过列出标签、获取邮件详情等接口获得
示例值:"7620003644728938013"

请求体 ​

名称类型必填描述
labellabel是邮件标签,必须填写名字或颜色中的至少一个字段
  └ namestring否标签名称,可选填写。最长255个字符。
示例值:"test"
数据校验规则:
- 长度范围:1 ~ 255 字符
  └ background_colorstring否标签背景颜色,可选填写。支持以下颜色值:blue、indigo、purple、violet、carmine、red、orange、yellow、lime、green、turquoise、wathet
示例值:"blue"

请求体示例 ​

json
{
    "label": {
        "name": "test",
        "background_color": "blue"
    }
}

响应 ​

响应体 ​

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ labellabel标签
    └ idstring标签ID
    └ namestring标签名称,最长 255 个字符。支持嵌套标签,嵌套层级之间以 / 分隔(如 a/b/c 表示三级嵌套标签)。创建或更新嵌套标签时,需要传入完整路径(如 a/b/c),不能只传最后一级名称。
    └ background_colorstring标签背景颜色,支持以下颜色值:blue、indigo、purple、violet、carmine、red、orange、yellow、lime、green、turquoise、wathet
    └ messages_unreadint带有该标签的未读邮件数量

响应体示例 ​

json
{
    "code": 0,
    "msg": "success",
    "data": {
        "label": {
            "id": "7620003644728938013",
            "name": "test",
            "background_color": "blue",
            "messages_unread": 0
        }
    }
}

错误码 ​

HTTP状态码错误码描述排查建议
4001234000invalid params不合法的参数,请参考文档修改参数
5001234017internal error服务器内部错误,请稍后重试
4031234030permission deny无权限访问,请检查是否已经申请对应权限
4001234013user mailbox not found or user mailbox not active指定的邮箱地址不存在或邮箱地址状态不正常,请检查输入的邮箱地址
4001230100label not found指定的标签不存在,请检查输入的标签
4001230101label name already exists指定的标签名已经存在,无法重复创建,请更换标签名字
4001230103label name is reserved by system自定义标签无法使用系统内置的标签名,请更换标签名字

内容来源:飞书开放平台 · 自动爬取整理