> ## 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 an Attendance Group

> Call this API to update the name, clock-in address, admins, clock-in rules, and other settings of an attendance group by attendance group ID.

Call this API to update the information of an attendance group by attendance group ID.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/group/modify](https://api.dingtalk.io/topapi/attendance/group/modify) |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi\_attendance\_group\_manage-Attendance group management permission |

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | b5e95d101165xxxx | The App credential used to call this API. Obtain it by calling the [Get the access\_token of an Internal App](https://help.dingtalk.io/open/development/obtain-orgapp-token) API. |

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| op\_user\_id | String | Yes | 123dfd | The user ID of the operator. |
| top\_group | Object | Yes | | The attendance group information. |
| shift\_vo\_list | Object\[] | No | | The shift information. |
| id | Number | No | 123 | The shift ID. Obtain the id value by calling the [Get Shift Summaries](https://help.dingtalk.io/open/development/enterprise-shift-query-in-batches.md) API. |
| id | Number | Yes | 123 | The attendance group ID.  **Note**  If you use the legacy attendance group identifier group\_key, call the [Convert groupKey to groupId](https://help.dingtalk.io/open/development/convert-groupkey-to-groupid.md) API to convert group\_key to group\_id. |
| name | String | No | Day Shift Attendance | The attendance group name. |
| positions | Object\[] | No | | The attendance address settings. |
| address | String | No | 21 Jinger Road, Biotech Industrial Park | The address. |
| corp\_id | String | No | 123dfd | The CorpId of the Organization. Find it on the Home page of the [Developer Console](https://open-dev.dingtalk.io/#/index). |
| latitude | String | No | 36.687495 | The latitude (up to 6 decimal places). |
| longitude | String | No | 101.750329 | The longitude (up to 6 decimal places). |
| title | String | No | Qinghai-Tibet Plateau Natural History Museum | The attendance location title. |
| accuracy | String | No | 0 | The accuracy.  **Note**  This field has no actual effect and does not affect accuracy. It was deprecated on March 7, 2022. |
| offset | Number | No | 300 | The attendance range. |
| manager\_list | String\[] | No | \["userId1","userId2"] | The list of user IDs of the attendance group Sub Admins. |
| enable\_camera\_check | Boolean | No | true | Specifies whether to enable photo clock-in.   - **true**: On - **false** (default): Off   **Note**  This parameter is deprecated. Use the open\_camera\_check parameter instead. |
| owner | String | No | 123dfdf | The user ID of the attendance group owner. |
| disable\_check\_when\_rest | Boolean | No | false | Specifies whether clock-in on rest days requires Approval.   - **true**: Required - **false**: Not required |
| skip\_holidays | Boolean | No | true | Specifies whether to skip public holidays.   - **true** (default): Skip - **false**: Do not skip |
| enable\_outside\_check | Boolean | No | true | Specifies whether field clock-in is allowed.   - **true** (default): Allow - **false**: Do not allow |
| disable\_check\_without\_schedule | Boolean | No | false | Specifies whether to prohibit employees from clocking in when no shift is scheduled.   - **true**: Prohibit - **false**: Do not prohibit |
| enable\_emp\_select\_class | Boolean | No | true | Specifies whether employees can select a shift to clock in when no shift is scheduled.   - **true**: Allow - **false**: Do not allow |
| resource\_permission\_map | Object | No | | The Sub Admin permission scope.   - **w**: Manageable - **r**: Read-only |
| camera\_check | String | No | w | Configure photo clock-in rules. |
| over\_time\_rule | String | No | r | Configure overtime rules. |
| check\_position\_type | String | No | w | Configure clock-in methods. |
| check\_time | String | No | r | Configure attendance time. |
| group\_type | String | No | w | Configure the attendance type. |
| group\_member | String | No | r | Configure attendance members. |
| schedule | String | No | w | Employee scheduling. |
| out\_side\_check | String | No | r | Configure field clock-in. |
| workday\_class\_list | Number\[] | No | \[12,12,12,12,0,0] | The weekly shift list.  **Note**   - Required for fixed shift attendance. 0 indicates a rest day. - Values in the array represent the daily scheduling from Sunday to Saturday, from left to right. |
| open\_camera\_check | Boolean | No | true | Specifies whether to enable photo clock-in.   - **true**: On - **false** (default): Off |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/modify" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=ca21b524-0a09-4909-b6e9-af087e28a86b' \
-d 'op_user_id=123dfd' \
-d 'top_group=null'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/modify");
OapiAttendanceGroupModifyRequest req = new OapiAttendanceGroupModifyRequest();
req.setOpUserId("user1");
TopGroupVo topGroupVo = new TopGroupVo();
topGroupVo.setOwner("user1");
topGroupVo.setEnableEmpSelectClass(true);
topGroupVo.setSkipHolidays(true);
List<TopPositionVo> positionVos = new ArrayList<TopPositionVo>();
TopPositionVo topPositionVo = new TopPositionVo();
positionVos.add(topPositionVo);
topPositionVo.setAddress("21 Jinger Road, Biotech Industrial Park");
topPositionVo.setCorpId("ding9f741xxxx");
topPositionVo.setLatitude("30.123");
topPositionVo.setAccuracy("0");
topPositionVo.setTitle("Qinghai-Tibet Plateau Natural History Museum");
topPositionVo.setLongitude("120.123");
topGroupVo.setPositions(positionVos);
topGroupVo.setEnableCameraCheck(true);
List<TopShiftVo> topShiftVos = new ArrayList<TopShiftVo>();
TopShiftVo topShiftVo = new TopShiftVo();
topShiftVos.add(topShiftVo);
topShiftVo.setId(678215070L);
topGroupVo.setShiftVoList(topShiftVos);
topGroupVo.setEnableOutsideCheck(true);
topGroupVo.setName("Test Attendance Group 1");
topGroupVo.setId(2987L);
topGroupVo.setManagerList(Arrays.asList("userId1"));
topGroupVo.setOffset(500L);
topGroupVo.setDisableCheckWithoutSchedule(false);
topGroupVo.setWorkdayClassList(Arrays.asList(12L,12L,12L,12L,12L,0L,0L));
req.setTopGroup(topGroupVo);
OapiAttendanceGroupModifyResponse 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.OapiAttendanceGroupModifyRequest("https://api.dingtalk.io/topapi/attendance/group/modify")

req.op_user_id="123dfd"
req.top_group=""
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 OapiAttendanceGroupAddRequest;
$req->setOpUserId("123dfd");

$top_group = new TopGroupVo;

// The following fields exist in the API documentation:
$top_group->name = "Day Shift Attendance";
$top_group->type = "TURN"; // FIXED: fixed shift attendance, TURN: shift-based attendance, NONE: flexible working hours
$top_group->enable_camera_check = "true";
$top_group->enable_outside_camera_check = "true";
$top_group->enable_outside_check = "true";
$top_group->enable_next_day = "false";
$top_group->modify_member = "true";
$top_group->offset = "500";
$top_group->default_class_id = "1234";
$top_group->manager_list = "[\"userId1\",\"userId2\"]";
$top_group->workday_class_list = "[12,12,12,12,12,0,0]";
$top_group->disable_check_without_schedule = "false";
$top_group->freecheck_work_days = "[1,2,3,4,5,6,0]";
$top_group->freecheck_day_start_min_offset = "240";
$top_group->disable_check_when_rest = "false";

// positions - List of attendance locations
$positions = new TopPositionVo;
$positions->title = "Qinghai-Tibet Plateau Natural History Museum";
$positions->address = "21 Jinger Road, Biotech Industrial Park";
$positions->latitude = "36.687495";
$positions->longitude = "101.750329";
$positions->accuracy = "0";
// Note: The corp_id field is not required in positions
$top_group->positions = array($positions);

// members - List of attendance group members
$members = new TopMemberVo;
$members->user_id = "1212jfkd";
$members->type = "StaffMember";
$members->role = "Attendance";
// Note: The corp_id field is not required in members
$top_group->members = array($members);

// wifis - List of WiFi clock-in points
$wifis = new TopWifiVo;
$wifis->ssid = "OFFICE-WiFi";
$wifis->mac_addr = "C0:E0:D0:E0:C0:0F";
// Note: The corp_id field is not required in wifis
$top_group->wifis = array($wifis);

// shift_vo_list - List of shifts
$shift_vo_list = new TopShiftVo;
$shift_vo_list->id = "123";
$top_group->shift_vo_list = array($shift_vo_list);

// resource_permission_map - Resource permission mapping
$resource_permission_map = new TopGroupManageRolePermissionVo;
$resource_permission_map->schedule = "w";
$resource_permission_map->group_member = "w";
$resource_permission_map->group_type = "r";
$resource_permission_map->check_time = "w";
$resource_permission_map->check_position_type = "r";
$resource_permission_map->over_time_rule = "r";
$resource_permission_map->camera_check = "w";
$resource_permission_map->out_side_check = "w";
$top_group->resource_permission_map = $resource_permission_map;

// The following fields do not exist in the API documentation and have been removed:
// - owner: Attendance group owner (set via manager_list instead)
// - enable_emp_select_class: Non-standard field
// - corp_id: The Organization ID is obtained from the token and does not need to be set in the request body
// - skip_holidays: Non-standard field
// - special_days: Non-standard field
// - id: Do not pass an ID during creation. The system generates it.

$req->setTopGroup($top_group);
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/add");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/modify");
OapiAttendanceGroupModifyRequest req = new OapiAttendanceGroupModifyRequest();
req.OpUserId = "123dfd";
OapiAttendanceGroupModifyRequest.TopGroupVoDomain obj1 = new OapiAttendanceGroupModifyRequest.TopGroupVoDomain();
List<OapiAttendanceGroupModifyRequest.TopShiftVoDomain> list3 = new List<OapiAttendanceGroupModifyRequest.TopShiftVoDomain>();
OapiAttendanceGroupModifyRequest.TopShiftVoDomain obj4 = new OapiAttendanceGroupModifyRequest.TopShiftVoDomain();
list3.Add(obj4);
obj4.Id = 123L;
obj1.ShiftVoList= list3;
obj1.Id = 123L;
obj1.Name = "Day Shift Attendance";
List<OapiAttendanceGroupModifyRequest.TopPositionVoDomain> list6 = new List<OapiAttendanceGroupModifyRequest.TopPositionVoDomain>();
OapiAttendanceGroupModifyRequest.TopPositionVoDomain obj7 = new OapiAttendanceGroupModifyRequest.TopPositionVoDomain();
list6.Add(obj7);
obj7.Address = "21 Jinger Road, Biotech Industrial Park";
obj7.CorpId = "123dfd";
obj7.Latitude = "36.687495";
obj7.Longitude = "101.750329";
obj7.Title = "Qinghai-Tibet Plateau Natural History Museum";
obj7.Accuracy = "0";
obj1.Positions= list6;
obj1.Offset = 300L;
obj1.ManagerList = "\"userId1\",\"userId2\"";
obj1.EnableCameraCheck = true;
obj1.Owner = "123dfdf";
obj1.SkipHolidays = true;
obj1.EnableOutsideCheck = true;
obj1.DisableCheckWithoutSchedule = false;
obj1.EnableEmpSelectClass = true;
obj1.WorkdayClassList = new long[] { 12,12,12,12,0,0 };
req.TopGroup_ = obj1;
OapiAttendanceGroupModifyResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | Object | | The attendance group result. |
| name | String | Day Shift Attendance | The attendance group name. |
| id | Number | 123 | The attendance group ID. |
| errmsg | String | 0 | The error message. |
| errcode | Number | ok | The error code. |
| success | Boolean | true | Indicates whether the call succeeded.   - **true**: Success - **false**: Failed |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "result":{
    "name":"Day Shift Attendance",
    "id":"123"
  },
  "errcode":0,
  "success":true,
  "errmsg":"ok"
}
```

### Error Codes

If the call returns an error, find solutions based on the error message in the [Global Error Codes](https://help.dingtalk.io/open/development/server-api-error-codes-1.md) document.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.