> ## 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 User Attendance Data

> Call this API to get attendance data based on the user ID and query date, including clock-in records, clock-in results, and approval lists.

Call this API to get a user's attendance data, including clock-in records, clock-in results, and approval lists.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/getupdatedata](https://api.dingtalk.io/topapi/attendance/getupdatedata) |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Permissions | permission-qyapi\_get\_attendance\_data-Attendance data read permission |

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | 6d1bxxxx | The app credential used to call this API. Get 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 |
| - | - | - | - | - |
| userid | String | Yes | user01 | The user ID. |
| work\_date | Date | Yes | 2021-01-14 | The query date. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/getupdatedata" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e67ccxxxx2144c' \
-d 'userid=userId123456' \
-d 'work_date=2018-05-02+00%3A00%3A00'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getupdatedata");
OapiAttendanceGetupdatedataRequest req = new OapiAttendanceGetupdatedataRequest();
req.setUserid("user01");
req.setWorkDate(StringUtils.parseDateTime("2021-01-14"));
OapiAttendanceGetupdatedataResponse 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.OapiAttendanceGetupdatedataRequest("https://api.dingtalk.io/topapi/attendance/getupdatedata")

req.userid="userId123456"
req.work_date="2018-05-02 00:00:00"
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 OapiAttendanceGetupdatedataRequest;
$req->setUserid("userId123456");
$req->setWorkDate("2018-05-02 00:00:00");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/getupdatedata");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getupdatedata");
OapiAttendanceGetupdatedataRequest req = new OapiAttendanceGetupdatedataRequest();
req.Userid = "userId123456";
req.WorkDate = DateTime.Parse("2018-05-02 00:00:00");
OapiAttendanceGetupdatedataResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| errmsg | String | ok | The description of the return code. |
| result | AtCheckInfoForOpenVo | | The call result. |
| work\_date | Date | 2021-01-14 00:00:00 | The query date. |
| attendance\_result\_list | AtAttendanceResultForOpenVo\[] | | The clock-in results. |
| record\_id | Number | 53429818546 | The clock-in record ID. |
| source\_type | String | USER | The clock-in source.   - **USER**: Clock-in by the user - **BOSS**: Corrected by the manager - **APPROVE**: Approval system - **SYSTEM**: Attendance system - **AUTO\_CHECK**: Automatic clock-in |
| plan\_check\_time | Date | 2021-01-14 09:00:00 | The standard clock-in time. |
| class\_id | Number | 709595172 | The shift ID. |
| location\_method | String | MAP | The location method. |
| location\_result | String | Normal | The location result.   - **Normal**: Within range - **Outside**: Out of range - **NotSigned**: Not clocked in |
| outside\_remark | String | Field work | The field work note. |
| plan\_id | Number | 176929277767 | The scheduling ID. |
| user\_address | String | Greentown Future Park | The address where the user clocked in. |
| group\_id | Number | 710705191 | The attendance group ID. |
| user\_check\_time | Date | 2021-01-14 11:21:59 | The time when the user clocked in. |
| procInst\_id | String | PRO-xxx | The approval form ID. |
| check\_type | String | OnDuty | The clock-in type.   - **OnDuty**: Clock in - **OffDuty**: Clock out |
| time\_result | String | Late | The time result of the clock-in.   - **Normal**: Normal - **Early**: Early leave - **Late**: Late arrival - **SeriousLate**: Serious late arrival - **Absenteeism**: Absenteeism due to late arrival - **NotSigned**: Not clocked in |
| userid | String | user01 | The user ID. |
| approve\_list | AtApproveForOpenVo\[] | | The list of approval forms. |
| duration\_unit | String | day | The unit of the approval form. |
| duration | String | 2.0 | The duration. |
| sub\_type | String | Annual leave | The subtype name. |
| tag\_name | String | 请假 (Leave request) | The approval form type name. Supported types:   - **请假** (Leave request) - **出差** (Business trip) - **外出** (Going out) - **加班** (Overtime) |
| procInst\_id | String | 1234abcd | The approval form ID. |
| begin\_time | Date | 2019-08-15 | The start time of the approval form. |
| biz\_type | Number | 3 | The approval form type:   - **1**: Overtime - **2**: Business trip/Going out - **3**: Leave request |
| end\_time | Date | 2019-08-17 | The end time of the approval form. |
| gmt\_finished | Date | 2019-08-15 | The time when the approval form was approved. |
| check\_record\_list | AtAttendanceRecordForOpenVo\[] | | The clock-in details. |
| record\_id | Number | 52710882700 | The clock-in record ID. |
| source\_type | String | | The clock-in source.   - **USER**: Clock-in by the user - **BOSS**: Corrected by the manager - **APPROVE**: Approval system - **SYSTEM**: Attendance system - **AUTO\_CHECK**: Automatic clock-in |
| user\_accuracy | String | 15.0 | The user's location accuracy. |
| valid\_matched | Boolean | false | Indicates whether the record matches the clock-in result.   - **true**: Matched - **false**: Not matched |
| user\_check\_time | Date | 2021-01-14 11:19:04 | The time when the user clocked in. |
| user\_longitude | String | 120.017267 | The clock-in longitude. |
| user\_ssid | String | office-wifi-1 | The Wi-Fi name. |
| base\_accuracy | String | 0.0 | The basic location accuracy. |
| user\_mac\_addr | String | 11:11:11:11:11:11 | The MAC address. |
| user\_latitude | String | 30.285938 | The clock-in latitude. |
| base\_address | String | Test | The basic clock-in address. |
| invalid\_record\_msg | String | Secondary confirmation required | The reason why the clock-in is invalid. |
| invalid\_record\_type | String | Other | The type of invalid clock-in. |
| corpId | String | dinge8xxxx | The organization ID (corpId). |
| class\_setting\_info | AtClassSettingInfoForOpenVo | | The break periods for the current schedule. |
| rest\_time\_vo\_list | AtRestTimeVo\[] | | The break information within the shift. |
| rest\_end\_time | Number | 0 | The break end time. |
| rest\_begin\_time | Number | 0 | The break start time. |
| errcode | Number | 0 | The return code. |
| success | Boolean | true | Indicates whether the call succeeded.   - **true**: Success - **false**: Failed |
| request\_id | String | f1zwcp4fr28h | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "result": {
    "approve_list": [],
    "attendance_result_list": [
      {
        "location_method": "MAP",
        "record_id": 53429818546,
        "group_id": 710705191,
        "location_result": "Normal",
        "class_id": 709595172,
        "time_result": "Late",
        "user_address": "Greentown Future Park",
        "user_check_time": "2021-01-14 11:21:59",
        "plan_check_time": "2021-01-14 09:00:00",
        "check_type": "OnDuty",
        "source_type": "USER",
        "plan_id": 176929277767
      }
    ],
    "corpId": "dinge8xxxx",
    "work_date": "2021-01-14 09:00:00",
    "userid": "user01",
    "check_record_list": [
      {
        "record_id": 52710882700,
        "user_check_time": "2021-01-14 11:19:04",
        "valid_matched": false,
        "user_accuracy": "15.0",
        "source_type": "USER",
        "invalid_record_msg": "Field clock-in requires approval",
        "invalid_record_type": "Other",
        "user_longitude": "120.017267",
        "user_latitude": "30.286036"
      },
      {
        "record_id": 53019968340,
        "user_check_time": "2021-01-14 17:00:45",
        "valid_matched": false,
        "source_type": "USER",
        "invalid_record_msg": "Clock-in is not available at this time. Contact your admin.",
        "invalid_record_type": "Other"
      }
    ]
  },
  "success": true,
  "request_id": "f1zwcp4fr28h"
}
```

### Error Codes

If an error occurs when you call this API, 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.