> ## 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 an Attendance Group

> Call this API to delete an attendance group by its group\key.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/group/delete](https://api.dingtalk.io/topapi/attendance/group/delete) |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi\_attendance\_group\_manage-Attendance group management permission |

### Query Parameters

| Name | Type | Required | Example | Description |
| - | - | - | - | - |
| access\_token | String | Yes | 4c9ebd2xxxx | The App credential used to call this API. Obtain 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 |
| - | - | - | - | - |
| op\_userid | String | No | user01 | The user ID of the operator. |
| group\_key | String | Yes | 0151E02xxxx | The attendance group ID.  **Note**  If you identify attendance groups by group\_id, call the [Convert groupId to groupKey](https://help.dingtalk.io/open/development/groupid-to-groupkey.md) API to convert the group\_id to a group\_key. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/delete" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=0d5exxxxf31e2da' \
-d 'group_key=0151E02xxxx1A917E876' \
-d 'op_userid=123456'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/delete");
OapiAttendanceGroupDeleteRequest req = new OapiAttendanceGroupDeleteRequest();
req.setOpUserid("user01");
req.setGroupKey("0151E02xxxx");
OapiAttendanceGroupDeleteResponse 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.OapiAttendanceGroupDeleteRequest("https://api.dingtalk.io/topapi/attendance/group/delete")

req.op_userid="123456"
req.group_key="0151Exxxx7E876"
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 OapiAttendanceGroupDeleteRequest;
$req->setOpUserid("123456");
$req->setGroupKey("0151Exxxx17E876");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/delete");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/delete");
OapiAttendanceGroupDeleteRequest req = new OapiAttendanceGroupDeleteRequest();
req.OpUserid = "123456";
req.GroupKey = "0151E0xxxxE876";
OapiAttendanceGroupDeleteResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | String | BE8C35586xxxx | The attendance group ID. |
| success | Boolean | true | Indicates whether the call succeeded.   - **true**: Success - **false**: Failed |
| errmsg | String | ok | The description of the return code. |
| errcode | Number | 0 | The return code. |
| request\_id | String | 3x1mikbgn3ca | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
    "errcode": 0,
    "errmsg":"ok",
    "result": "BE8C35586xxxx",
    "success": true,
    "request_id": "3x1mikbgn3ca"
}
```

### Error Codes

If a call to this API 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.