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

# Batch Delete Locations

> Call this API to batch delete locations from an attendance group by group ID and location keys, up to 100 per call.

Call this API to batch delete positions from a specified attendance group.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/group/positions/remove](https://api.dingtalk.io/topapi/attendance/group/positions/remove) |
| 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 | 4c9ebd2b1534xxxx | 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 | CEDDFxxxx | The attendance group ID.  **Note**  If your attendance group identifier is group\_id, call the [Convert groupId to groupKey](https://help.dingtalk.io/open/development/groupid-to-groupkey.md) API to convert group\_id to group\_key. |
| position\_key\_list | String | Yes | C384Fxxxx | The list of keys of the positions to delete. Obtain the keys by calling the [Batch Query Locations](https://help.dingtalk.io/open/development/batch-query-position-under-attendance-group.md) API. Delete up to 100 locations per call. |

### Request Example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/positions/remove" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=25961xxxx7912f13' \
-d 'group_key=0151E022xxxx72A1A917E876' \
-d 'op_userid=123456' \
-d 'position_key_list=%22123%22%2C%22123%22'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/positions/remove");
OapiAttendanceGroupPositionsRemoveRequest req = new OapiAttendanceGroupPositionsRemoveRequest();
req.setOpUserid("user01");
req.setGroupKey("CEDDFxxxx");
req.setPositionKeyList("C384Fxxxx");
OapiAttendanceGroupPositionsRemoveResponse 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.OapiAttendanceGroupPositionsRemoveRequest("https://api.dingtalk.io/topapi/attendance/group/positions/remove")

req.op_userid="123456"
req.group_key="0151E02xxxx17E876"
req.position_key_list="["123","123"]"
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 OapiAttendanceGroupPositionsRemoveRequest;
$req->setOpUserid("123456");
$req->setGroupKey("0151E02xxxx17E876");
$req->setPositionKeyList("[\"123\",\"123\"]");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/positions/remove");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/positions/remove");
OapiAttendanceGroupPositionsRemoveRequest req = new OapiAttendanceGroupPositionsRemoveRequest();
req.OpUserid = "123456";
req.GroupKey = "0151E0xxxx17E876";
req.PositionKeyList = ""123","123"";
OapiAttendanceGroupPositionsRemoveResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | Result | | The returned result. |
| success\_list | String\[] | \["C384Fxxxx"] | The list of successfully deleted items. |
| error\_info\_list | ErrorInfo\[] | | The list of errors. |
| failure\_list | String\[] | \["C384Fxxxx"] | The list of items that failed to be deleted. |
| msg | String | business fault | The error description. |
| code | String | 1000 | The error code. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Indicates whether the call succeeded.   - **true**: Success - **false**: Failed |
| request\_id | String | 1493be6v5yefm | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg":"ok",
  "result": {
    "error_info_list": [
      {
        "code": "1000",
        "failure_list": [
          "C384Fxxxx"
        ],
        "msg": "business fault"
      }
    ],
    "success_list": [
      "C384Fxxxx"
    ]
  },
  "success": true,
  "request_id": "1493be6v5yefm"
}
```

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