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

# Delete Leave Rules

> Call this API to delete a specified leave rule by its unique identifier leave_code. Provide the user ID of an admin with OA Approval permissions.

Call this API to delete a specified leave rule.

## Request

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

### Request Body

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| leave\_code | String | Yes | 03747xxxx | The unique identifier of the leave rule. Call [Query the List of Leave Rules](https://help.dingtalk.io/open/development/holiday-type-query.md) to obtain the leave\_code value. |
| op\_userid | String | Yes | user01 | The user ID of an admin in your organization who has **OA Approval** app permissions. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/vacation/type/delete" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=3acaxxxxa30a2' \
-d 'leave_code=037477axxxxae5e7973' \
-d 'op_userid=03085665764167'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/delete");
OapiAttendanceVacationTypeDeleteRequest req = new OapiAttendanceVacationTypeDeleteRequest();
req.setLeaveCode("03747xxxx");
req.setOpUserid("user01");
OapiAttendanceVacationTypeDeleteResponse 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.OapiAttendanceVacationTypeDeleteRequest("https://api.dingtalk.io/topapi/attendance/vacation/type/delete")

req.leave_code="03747xxxx7973"
req.op_userid="03085665764167"
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 OapiAttendanceVacationTypeDeleteRequest;
$req->setLeaveCode("03747xxxx7973");
$req->setOpUserid("03085665764167");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/vacation/type/delete");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/delete");
OapiAttendanceVacationTypeDeleteRequest req = new OapiAttendanceVacationTypeDeleteRequest();
req.LeaveCode = "0374xxxx7973";
req.OpUserid = "03085665764167";
OapiAttendanceVacationTypeDeleteResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | LeaveTypeVo | | The returned result. |
| leave\_code | String | 03747xxxx | The unique identifier of the leave rule. |
| leave\_name | String | Annual leave | The name of the leave. |
| leave\_view\_unit | String | day | The unit of the leave request.   - **day**: Day - **halfDay**: Half day - **hour**: Hour |
| biz\_type | String | general\_leave | The leave type.   - **general\_leave**: Regular leave - **lieu\_leave**: Overtime converted to compensatory leave |
| natural\_day\_leave | Boolean | true | Whether to calculate the leave duration by calendar day.   - **true**: Calculate the leave duration by calendar day. - **false**: Do not calculate the leave duration by calendar day.  **Note**  If 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. |
| hours\_in\_per\_day | Number | 1000 | The working hours per day, in units of 1/100 hour.  For example, 1 day = 10 hours = 1000. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Whether the call succeeded.   - **true**: Yes - **false**: No |
| request\_id | String | xss3trk3zypq | The request ID. |

### 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": "03747xxxx",
    "leave_name": "Annual leave",
    "leave_view_unit": "day",
    "natural_day_leave": true
  },
  "success": true,
  "request_id": "xss3trk3zypq"
}
```

### Error Codes

If the call returns an error, find the 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.