> ## 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 Query Scheduling Information of Users

> Call this API to batch query users' scheduling information within a date range using a list of user IDs, retrieving multiple users per request.

Call this API to batch query the scheduling information of employees on a specific day.

## Request

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

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | bE74xxxx | The App credential used to call this API. - For an Internal app, obtain it by calling [Get the access\_token of an Internal App](https://help.dingtalk.io/open/development/obtain-orgapp-token). - For a Third-party enterprise app, obtain it by calling the API that gets the access\_token of a third-party organization. |

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| op\_user\_id | String | Yes | user456 | The user ID of the operator. |
| userids | String | Yes | user123 | The list of user IDs to query. Separate multiple user IDs with commas. Pass up to 50 user IDs at a time. |
| from\_date\_time | Number | Yes | 1565591096000 | The start date, as a Unix timestamp in milliseconds. **Note** - The interval between the start time and the end time cannot exceed 7 days. - The query time must be within the last 180 days. |
| to\_date\_time | Number | Yes | 1565591096000 | The end date, as a Unix timestamp in milliseconds. **Note** - The interval between the start time and the end time cannot exceed 7 days. - The query time must be within the last 180 days. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=9ad3xxxx82a10' \
-d 'from_date_time=1565591096000' \
-d 'op_user_id=dd_dd' \
-d 'to_date_time=1565591096000' \
-d 'userids=dd_dd%2Cduogui'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.setOpUserId("user456");
req.setUserids("user123,user456");
req.setFromDateTime(1565591096000L);
req.setToDateTime(1565591096000L);
OapiAttendanceScheduleListbyusersResponse 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.OapiAttendanceScheduleListbyusersRequest("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers")

req.op_user_id="dd_dd"
req.userids="dd_dd,duogui"
req.from_date_time=1565591096000
req.to_date_time=1565591096000
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 OapiAttendanceScheduleListbyusersRequest;
$req->setOpUserId("dd_dd");
$req->setUserids("dd_dd,duogui");
$req->setFromDateTime("1565591096000");
$req->setToDateTime("1565591096000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.OpUserId = "dd_dd";
req.Userids = "dd_dd,duogui";
req.FromDateTime = 1565591096000L;
req.ToDateTime = 1565591096000L;
OapiAttendanceScheduleListbyusersResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | TopScheduleVo\[] | demo | The query result. |
| check\_type | String | OnDuty | The attendance type: - **Onduty**: Clock-in at the start of work - **OffDuty**: Clock-out at the end of work |
| plan\_check\_time | Date | 2021-01-14 09:00:00 | The scheduled clock-in time. |
| group\_id | Number | 394775001 | The attendance group ID. |
| userid | String | user456 | The user ID. |
| approve\_id | Number | 1234 | The ID of the Approval form bound to the schedule. **Note** This field is not returned if no Approval form exists for the day. |
| work\_date | Date | 2021-01-14 00:00:00 | The workday, indicating the specific day of the schedule. |
| id | Number | 56676915454 | The schedule ID. |
| shift\_version | Number | 588655171 | The shift version. |
| shift\_id | Number | 677995086 | The shift ID. A value of 0 indicates a day off. |
| is\_rest | String | N | Indicates whether the day is a day off: - **Y**: The day is scheduled as a day off - **N**: The day is not a day off |
| success | Boolean | true | Indicates whether the request succeeded. - **true**: Success - **false**: Failed |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The return message. |
| request\_id | String | qkqbwcw3bq2 | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg":"ok",
  "result": [
    {
      "check_type": "OnDuty",
      "group_id": 394775001,
      "id": 56676915454,
      "is_rest": "N",
      "plan_check_time": "2021-01-14 09:00:00",
      "shift_id": 709595172,
      "shift_version": 617320362,
      "userid": "user456",
      "work_date": "2021-01-14 00:00:00"
    },
    {
      "check_type": "OffDuty",
      "group_id": 394775001,
      "id": 56676915454,
      "is_rest": "N",
      "plan_check_time": "2021-01-14 18:00:00",
      "shift_id": 709595172,
      "shift_version": 617320362,
      "userid": "user456",
      "work_date": "2021-01-14 00:00:00"
    }
  ],
  "success": true,
  "request_id": "4cmy9twx4atn"
}
```

### Error Codes

If a call to this API returns an error, find a solution 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.