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

# Check Whether Users Belong to the Current Attendance Group

> Call this API with member IDs and a member type to check whether employees or departments belong to an attendance group, returning the matches.

Call this API to check whether a department or an employee belongs to an attendance group.

## API Call Description

* If you check an employee list, this API returns the userId values of the employees in the attendance group.
* If you check a department list, this API returns the IDs of the departments in the attendance group. It does not return the userId list of the employees in those departments.

For example, the attendance members of an attendance group include the **Test Department** and the employee **John**. The Test Department includes the employee Mike. The API returns the following results for different departments or users:

* If you check Mike's userId, this API does not return Mike's userId.
* If you check John's userId, this API returns John's userId.
* If you check the Test Department ID, this API returns the Test Department ID.
* If you check whether John and Mike are in the attendance group, this API returns John's userId.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/group/member/listbyids](https://api.dingtalk.io/topapi/attendance/group/member/listbyids) |
| HTTP Method | POST |
| Supported app types | appType-Internal app　appType-Third-party enterprise app |
| Permissions | permission-qyapi\_attendance\_group\_read-Attendance group query permission |

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | 6d1bxxxx | - For an internal app, call the [Get the access\_token of an internal app](https://help.dingtalk.io/open/development/obtain-orgapp-token) API to obtain it. - For a third-party enterprise app, call the Get the access\_token of a third-party enterprise API to obtain it. |

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| op\_user\_id | String | Yes | dd\_dd | The userId of the operator. |
| group\_id | Number | Yes | 98562 | 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. |
| member\_ids | String | Yes | user123,user456 | The member IDs. Each ID can be a userId or a deptId. Separate multiple IDs with commas (,). Each call supports up to 20 values. |
| member\_type | Number | Yes | 0 | The member type:   - **0**: Employee - **1**: Department |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/member/listbyids" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=9bacfaxxxx71260' \
-d 'group_id=1234' \
-d 'member_ids=dd_dd' \
-d 'member_type=0' \
-d 'op_user_id=dd_dd'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/member/listbyids");
OapiAttendanceGroupMemberListbyidsRequest req = new OapiAttendanceGroupMemberListbyidsRequest();
req.setOpUserId("user123");
req.setMemberIds("user123,user456");
req.setMemberType(0L);
req.setGroupId(68593L);
OapiAttendanceGroupMemberListbyidsResponse 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.OapiAttendanceGroupMemberListbyidsRequest("https://api.dingtalk.io/topapi/attendance/group/member/listbyids")

req.op_user_id="dd_dd"
req.member_ids="dd_dd"
req.member_type=0
req.group_id=1234
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 OapiAttendanceGroupMemberListbyidsRequest;
$req->setOpUserId("dd_dd");
$req->setMemberIds("dd_dd");
$req->setMemberType("0");
$req->setGroupId("1234");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/member/listbyids");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/member/listbyids");
OapiAttendanceGroupMemberListbyidsRequest req = new OapiAttendanceGroupMemberListbyidsRequest();
req.OpUserId = "dd_dd";
req.MemberIds = "dd_dd";
req.MemberType = 0L;
req.GroupId = 1234L;
OapiAttendanceGroupMemberListbyidsResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| request\_id | String | z81tif88lkot | The request ID. |
| errmsg | String | ok | The description of the return code. |
| errcode | Number | 0 | The return code. |
| success | Boolean | true | Indicates whether the call succeeded.   - **true**: Success - **false**: Failed |
| result | String\[] | \["user123","user456"] | The IDs of the members that belong to the attendance group. Each ID can be a userId or a deptId. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg":"ok",
  "result": [
    "user123",
    "user456"
  ],
  "success": true,
  "request_id": "4nvsqf4ij2xq"
}
```

### Error Codes

If the API call 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.