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

# Get Shift Details

> Call this API to query the details of a shift by shift ID, including the shift name, clock-in times, and break periods.

Call this API to query the details of a shift by shift ID, such as the shift name, clock-in times, and break periods.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/shift/query](https://api.dingtalk.io/topapi/attendance/shift/query) |
| 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 | bE74xxxx | The App credential used to call this API.   - 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 App API to obtain it. |

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| op\_user\_id | String | Yes | user123 | The userId of the operator. |
| shift\_id | Number | Yes | 678215070 | The shift ID. Call the [Get Shift Summaries](https://help.dingtalk.io/open/development/enterprise-shift-query-in-batches.md) API to obtain the value of the id parameter. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/shift/query" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d946568c-08dd-44bf-acd3-cfc07d7829dd' \
-d 'op_user_id=dd_dd' \
-d 'shift_id=2445'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/query");
OapiAttendanceShiftQueryRequest req = new OapiAttendanceShiftQueryRequest();
req.setOpUserId("user123");
req.setShiftId(678215070L);
OapiAttendanceShiftQueryResponse 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.OapiAttendanceShiftQueryRequest("https://api.dingtalk.io/topapi/attendance/shift/query")

req.op_user_id="dd_dd"
req.shift_id=2445
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 OapiAttendanceShiftQueryRequest;
$req->setOpUserId("dd_dd");
$req->setShiftId("2445");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/shift/query");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/query");
OapiAttendanceShiftQueryRequest req = new OapiAttendanceShiftQueryRequest();
req.OpUserId = "dd_dd";
req.ShiftId = 2445L;
OapiAttendanceShiftQueryResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | TopShiftVo | | The shift details. |
| shift\_group\_name | String | Attendance shift | The name of the shift group. |
| corp\_id | String | dinge87f1xxxx | The organization ID. |
| shift\_setting | TopShiftSettingVo | | The shift settings. |
| shift\_id | Number | 678215070 | The shift ID. |
| gmt\_modified | Date | 2020-09-06 15:49:27 | The time when the shift was last modified. |
| corp\_id | String | dinge87f1xxxx | The organization ID. |
| work\_time\_minutes | Number | 600 | The working duration, in minutes. A value of -1 indicates that this feature is disabled. |
| id | Number | 233840112 | The shift settings ID. |
| attend\_days | String | 12 | The number of attendance days for this shift. |
| gmt\_create | Date | 2020-09-06 15:49:27 | The created time. |
| name | String | B | The shift name. |
| id | Number | 678215070 | The shift ID. |
| sections | TopSectionVo\[] | | The clock-in sections. |
| punches | TopPunchVo\[] | | The clock-in points. |
| check\_type | String | OnDuty | The clock-in type:   - **OnDuty**: Clock in - **OffDuty**: Clock out |
| end\_min | Number | -1 | The latest allowed clock-in time.  The value is in minutes. Add this value to the clock-in time to calculate the latest clock-in time. |
| across | Number | 0 | Whether the clock-in time falls on the next day:   - **0**: Same day - **1**: Next day |
| check\_time | Date | 1970-01-01 19:00:00 | The clock-in time, as a Unix timestamp. Only the hour, minute, and second are meaningful. |
| permit\_minutes | Number | 0 | The allowed duration of early leave or late arrival, in minutes. |
| free\_check | Boolean | false | Whether clock-in is exempted:   - **true**: Clock-in exempted - **false**: Clock-in required |
| id | Number | 33928201 | The clock-in point ID. |
| begin\_min | Number | 20 | The earliest allowed time to clock in in advance, in minutes. |
| absenteeism\_late\_minutes | String | -1 | The duration of early leave or late arrival that counts as absenteeism, in minutes. |
| serious\_late\_minutes | String | -1 | The duration of early leave or late arrival that counts as serious, in minutes. |
| rests | TopRestVo\[] | | The break period information. |
| check\_type | String | OnDuty | The break type:   - **OnDuty**: Break start - **OffDuty**: Break end |
| across | Number | 1 | Whether the break time falls on the next day:   - **0**: Same day - **1**: Next day |
| check\_time | String | 1970-01-01 05:00:00 | The break time. |
| id | Number | 33928203 | The break point ID. |
| id | Number | 22979360 | The clock-in section ID. One clock-in and clock-out pair forms a section. A shift can contain multiple sections. |
| shift\_group\_id | Number | demo | The shift group ID. |
| owner | String | user123 | The userId of the shift owner. |
| success | Boolean | true | Whether the call succeeded.   - **true**: Success - **false**: Failed |
| errcode | Number | 0 | The return code. |
| errmsg | String | demo | The description of the return code. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg": "demo",
  "result": {
    "corp_id": "dinge87f1xxxx",
    "id": 678215070,
    "name": "B",
    "sections": [
      {
        "id": 316940162,
        "punches": [
          {
            "absenteeism_late_minutes": "-1",
            "across": 0,
            "check_time": "1970-01-01 19:00:00",
            "check_type": "OnDuty",
            "free_check": false,
            "id": 340055347,
            "permit_minutes": 0,
            "serious_late_minutes": "-1"
          },
          {
            "across": 1,
            "check_time": "1970-01-01 05:00:00",
            "check_type": "OffDuty",
            "free_check": false,
            "id": 340055348
          }
        ],
        "rests": []
      }
    ],
    "shift_setting": {
      "corp_id": "dinge87f1xxxx",
      "gmt_create": "2020-09-06 15:49:27",
      "gmt_modified": "2020-09-06 15:49:27",
      "id": 586985140,
      "is_deleted": "N",
      "shift_id": 678215070,
      "work_time_minutes": 600
    }
  },
  "success": true,
  "request_id": "3pph7tq865kz"
}
```

### Error Codes

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