Skip to main content
Call this API to update a group member’s nickname within a chat. This applies to scenarios where group admins standardize member nicknames or where members modify their own nicknames.

Request

Basic information
HTTP URLhttps://oapi.dingtalk.io/topapi/chat/updategroupnick
HTTP MethodPOST
Supported app typesappType-Internal app
Required permissionspermission-qyapi_chat_manage-DingTalk group basic information management permission

Query parameters

NameTypeRequiredExampleDescription
access_tokenStringYesbeE3xxxxThe app credential used to call this API. Obtain it through the API for getting the access_token of an internal app.

Request body

NameTypeRequiredExampleDescription
useridStringYesuser123The userId of the group member whose nickname is to be updated. You can obtain the member’s userId through the Get group chat information API.
chatidStringYeschate3929fxxxxThe group chat ID. You can obtain the chatid value through the API for creating a group.
group_nickStringYesDingTalk AssistantThe member’s nickname within the group.

Request example

curl -X POST "https://oapi.dingtalk.io/topapi/chat/updategroupnick" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=61a72xxxx8d62' \
-d 'chatid=0' \
-d 'group_nick=nick' \
-d 'userid=0'
Java
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/chat/updategroupnick");
OapiChatUpdategroupnickRequest req = new OapiChatUpdategroupnickRequest();
req.setUserid("user123");
req.setChatid("chate39f540d572b71cf97a556d95929fxxxx");
req.setGroupNick("DingTalk Assistant");
OapiChatUpdategroupnickResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
Python
import dingtalk.api

req=dingtalk.api.OapiChatUpdategroupnickRequest("https://oapi.dingtalk.io/topapi/chat/updategroupnick")

req.userid="0"
req.chatid="0"
req.group_nick="nick"
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
PHP
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiChatUpdategroupnickRequest;
$req->setUserid("0");
$req->setChatid("0");
$req->setGroupNick("nick");
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.io/topapi/chat/updategroupnick");
C#
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/chat/updategroupnick");
OapiChatUpdategroupnickRequest req = new OapiChatUpdategroupnickRequest();
req.Userid = "0";
req.Chatid = "0";
req.GroupNick = "nick";
OapiChatUpdategroupnickResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);

Response

Response body

NameTypeExampleDescription
errcodeNumber0The return code.
errmsgStringokThe description of the return code.
successBooleantrueIndicates whether the action succeeded. - true: Success - false: Failed
request_idStringid1aatxt9mcoThe request ID.

Response example

{
  "errcode": 0,
  "errmsg": "ok",
  "success": true,
  "request_id": "id1aatxt9mco"
}

Error codes

If an error is returned when you call this API, refer to the Global error codes document to find the solution based on the error message.
Error code (errorcode)Error message (errmsg)Solution
40003Invalid useridVerify that the userid is entered correctly.
34001Invalid chatidVerify that the chatid is correct.
41049Contains prohibited contentModify the nickname you entered.
60124The user is not in the corresponding groupUpdate the users in the group.
400002Parameter errorCheck that the parameters are entered according to the requirements above.
400001System errorTry again later.