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

# Query the List of Leave Rules

> Call this API to query the list of leave rules in your organization and obtain information such as the leave name, leave unit, and leave source.

Call this API to query the list of leave rules in your organization, including the leave name and leave unit.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/vacation/type/list](https://api.dingtalk.io/topapi/attendance/vacation/type/list) |
| HTTP Method | POST |
| Supported app types | appType-Internal app　appType-Third-party enterprise app |
| Required permissions | permission-qyapi\_holiday\_readonly-DingTalk leave read 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 the [Get the access\_token of an Internal App](https://help.dingtalk.io/open/development/obtain-orgapp-token) API. - For a Third-party enterprise app, obtain it by calling the API for getting the access\_token of a third-party organization. |

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| op\_userid | String | Yes | user01 | The user ID of an Admin in your organization who has App permissions for the **OA Approval** App. |
| vacation\_source | String | No | all | The leave source. Valid values:   - **"all"**: Returns all leave types. - **""**: Returns only the leave types created by calling the API for adding leave rules. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/vacation/type/list" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=43aexxxxd897cd9' \
-d 'op_userid=03085665764167' \
-d 'vacation_source=all'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/list");
OapiAttendanceVacationTypeListRequest req = new OapiAttendanceVacationTypeListRequest();
req.setOpUserid("user01");
req.setVacationSource("all");
OapiAttendanceVacationTypeListResponse 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.OapiAttendanceVacationTypeListRequest("https://api.dingtalk.io/topapi/attendance/vacation/type/list")

req.op_userid="03085665764167"
req.vacation_source="all"
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 OapiAttendanceVacationTypeListRequest;
$req->setOpUserid("03085665764167");
$req->setVacationSource("all");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/vacation/type/list");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/list");
OapiAttendanceVacationTypeListRequest req = new OapiAttendanceVacationTypeListRequest();
req.OpUserid = "03085665764167";
req.VacationSource = "all";
OapiAttendanceVacationTypeListResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| request\_id | String | 3k4z2hq8pv2x | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Indicates whether the request succeeded.   - **true**: Yes - **false**: No |
| result | Result\[] | | The returned results. |
| leave\_code | String | 037477sdfsxxxx | The unique identifier of the leave rule. |
| leave\_name | String | Annual leave | The leave name. |
| leave\_view\_unit | String | day | The leave unit.   - **day**: Day - **halfDay**: Half day - **hour**: Hour |
| leave\_certificate | LeaveCertificateVo | | The leave certificate. |
| leave\_certificate.unit | String | hour | The unit of the leave certificate.   - **hour**: Hour - **day**: Day |
| leave\_certificate.duration | Number | 1 | The leave duration above which a leave certificate is required. |
| leave\_certificate.enable | Boolean | false | Indicates whether the leave certificate is turned on.   - **true**: On - **false**: Off |
| leave\_certificate.prompt\_information | String | Leave information | The prompt text shown for a leave request. |
| submit\_time\_rule | SubmitTimeRuleVo | | The time-limited submission rule. |
| submit\_time\_rule.time\_value | Number | 18 | The limit value.   - When timeUnit is **day**, the valid range is 0 to 30 days. - When timeUnit is **hour**, the valid range is 0 to 24 hours. |
| submit\_time\_rule.time\_unit | String | hour | The time unit.   - **day**: Day - **hour**: Hour |
| submit\_time\_rule.time\_type | String | before | The limit type.   - **before**: Submit in advance - **after**: Submit retroactively |
| submit\_time\_rule.enable\_time\_limit | Boolean | false | Indicates whether time-limited submission is turned on.   - **true**: On - **false**: Off |
| biz\_type | String | general\_leave | The leave type.   - **general\_leave**: Regular leave - **lieu\_leave**: Overtime converted to compensatory leave |
| natural\_day\_leave | String | true | Indicates whether the leave duration is calculated by calendar day.   - **true**: Calculate the leave duration by calendar day. - **false**: Do not calculate the leave duration by calendar day.  **Note**  When the value is **false**, the leave duration is calculated based on the User's scheduling during the leave period when the User submits a leave request. |
| validity\_type | String | absolute\_time | The validity type.   - **absolute\_time**: Absolute time - **relative\_time**: Relative time |
| validity\_value | String | 12-31 | The extension date.   - When validity\_type is **absolute\_time**, this value is not empty and uses the "yy-mm" format. - When validity\_type is **relative\_time**, this value is an integer greater than 1. |
| hours\_in\_per\_day | Number | 1000 | The working hours per day, in units of 1/100 hour.  For example: 1 day = 10 hours = 1000. |
| source | String | inner | The leave source.   - **external**: Custom leave created through the Open API - **inner**: Leave created in the OA admin console |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg":"ok",
  "result": [
    {
      "biz_type": "general_leave",
      "hours_in_per_day": 1000,
      "leave_code": "037477sdfsxxxx",
      "leave_name": "Annual leave",
      "leave_view_unit": "day",
      "leave_certificate": {
        "unit": "hour",
        "duration": "1",
        "enable": false,
        "prompt_information": "Leave information"
      },
      "submit_time_rule": {
        "time_value": 18,
        "time_unit": "day",
        "time_type": "before",
        "enable_time_limit": false
      },
      "validity_type": "absolute_time",
      "natural_day_leave": "true",
      "validity_value": "12-31",
      "source": "external"
    }
  ],
  "success": true,
  "request_id": "3k4z2hq8pv2x"
}
```

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