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

# Update a group member's nickname

> Call this API to update a group member's nickname in the group, useful when admins standardize nicknames or members change their own nicknames.

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 URL              | [https://api.dingtalk.io/topapi/chat/updategroupnick](https://api.dingtalk.io/topapi/chat/updategroupnick) |
| HTTP Method           | POST                                                                                                       |
| Supported app types   | appType-Internal app                                                                                       |
| Required permissions  | permission-qyapi\_chat\_manage-DingTalk group basic information management permission                      |

### Query parameters

| Name          | Type   | Required | Example  | Description                                                                                                                                                    |
| ------------- | ------ | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Yes      | beE3xxxx | The app credential used to call this API. Obtain it through the API for getting the [access\_token of an internal app](/open/development/obtain-orgapp-token). |

### Request body

| Name        | Type   | Required | Example            | Description                                                                                                                                                                                |
| ----------- | ------ | -------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| userid      | String | Yes      | user123            | The userId of the group member whose nickname is to be updated. You can obtain the member's userId through the [Get group chat information](/open/development/obtain-a-group-session) API. |
| chatid      | String | Yes      | chate3929fxxxx     | The group chat ID. You can obtain the chatid value through the API for creating a group.                                                                                                   |
| group\_nick | String | Yes      | DingTalk Assistant | The member's nickname within the group.                                                                                                                                                    |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.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

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.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

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiChatUpdategroupnickRequest("https://api.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

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
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://api.dingtalk.io/topapi/chat/updategroupnick");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.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

| Name        | Type    | Example      | Description                                                                       |
| ----------- | ------- | ------------ | --------------------------------------------------------------------------------- |
| errcode     | Number  | 0            | The return code.                                                                  |
| errmsg      | String  | ok           | The description of the return code.                                               |
| success     | Boolean | true         | Indicates whether the action succeeded.   - **true**: Success - **false**: Failed |
| request\_id | String  | id1aatxt9mco | The request ID.                                                                   |

### Response example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "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](/open/development/server-api-error-codes-1) document to find the solution based on the error message.

| Error code (errorcode) | Error message (errmsg)                     | Solution                                                                   |
| ---------------------- | ------------------------------------------ | -------------------------------------------------------------------------- |
| 40003                  | Invalid userid                             | Verify that the userid is entered correctly.                               |
| 34001                  | Invalid chatid                             | Verify that the chatid is correct.                                         |
| 41049                  | Contains prohibited content                | Modify the nickname you entered.                                           |
| 60124                  | The user is not in the corresponding group | Update the users in the group.                                             |
| 400002                 | Parameter error                            | Check that the parameters are entered according to the requirements above. |
| 400001                 | System error                               | Try again later.                                                           |
