> ## 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.

# Batch Add Attendance Members

> Call this API to add up to 100 employees at a time to a specified attendance group by group_key.

Call this API to add attendance members in batches to a specified attendance group by groupKey. This API supports adding employees only. It does not support adding departments.

## Request

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

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | 4c9ebd2b1534xxxx | 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\_userid | String | No | user01 | The user ID of the operator. |
| group\_key | String | Yes | CEDDxxxx | The attendance group ID.  **Note**  If your attendance group identifier is group\_id, call the [Convert groupId to groupKey](https://help.dingtalk.io/open/development/groupid-to-groupkey.md) API to convert group\_id to group\_key. |
| user\_id\_list | String\[] | Yes | user02,user03 | The list of user IDs. Maximum: 100. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/users/add" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e0f3d9xxxxa9b71' \
-d 'group_key=0151E0xxxx917E876' \
-d 'op_userid=123456' \
-d 'user_id_list=123456%2C123457'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/users/add");
OapiAttendanceGroupUsersAddRequest req = new OapiAttendanceGroupUsersAddRequest();
req.setOpUserid("user01");
req.setGroupKey("CEDDxxxx");
req.setUserIdList("user02,user03");
OapiAttendanceGroupUsersAddResponse 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.OapiAttendanceGroupUsersAddRequest("https://api.dingtalk.io/topapi/attendance/group/users/add")

req.op_userid="123456"
req.group_key="0151E02xxxx7E876"
req.user_id_list="123456,123457"
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 OapiAttendanceGroupUsersAddRequest;
$req->setOpUserid("123456");
$req->setGroupKey("0151E0xxxx7E876");
$req->setUserIdList("123456,123457");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/users/add");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/users/add");
OapiAttendanceGroupUsersAddRequest req = new OapiAttendanceGroupUsersAddRequest();
req.OpUserid = "123456";
req.GroupKey = "0151E02xxxx917E876";
req.UserIdList = "123456,123457";
OapiAttendanceGroupUsersAddResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | Result | | The returned result. |
| error\_info\_list | ErrorInfo\[] | | The list of errors. |
| failure\_list | String\[] | | The list of failed entries. |
| msg | String | business fault | The error message. |
| code | String | 1000 | The error code. |
| success\_list | String\[] | | The list of successful entries. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Whether the request succeeded.   - **true**: Success - **false**: Failed |
| request\_id | String | w8iju9gfb236 | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "result": {
    "success_list": [
      "user456",
      "manager4220"
    ]
  },
  "success": true,
  "request_id": "w8iju9gfb236"
}
```

### Error Codes

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


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