> ## 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 Add Locations

> Call this API to add clock-in locations in batches to a specified attendance group by group ID and a location list, up to 100 per request.

Call this API to add locations to a specified attendance group in batches.

## Request

| **Basic Information** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/group/positions/add](https://api.dingtalk.io/topapi/attendance/group/positions/add) |
| 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 | 03B1Exxxx | 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\_list | Object\[] | Yes | | The list of positions. Add up to 100 locations per request. |
| address | String | Yes | Alibaba Group Xixi Beiyuan | The address description. |
| foreign\_id | String | Yes | 0151E23B1 | The positionId defined by the business party. |
| longitude | String | Yes | 120.123 | The longitude (up to 6 decimal places). |
| latitude | String | Yes | 30.123 | The latitude (up to 6 decimal places). |
| offset | Number | No | 100 | The allowed offset for the clock-in location, in meters. |

### Request Example

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

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/positions/add");
OapiAttendanceGroupPositionsAddRequest req = new OapiAttendanceGroupPositionsAddRequest();
req.setOpUserid("user01");
req.setGroupKey("03B1Exxxx");
List<Position> list = new ArrayList<Position>();
Position position = new Position();
list.add(position);
position.setAddress("Alibaba Group Xixi Beiyuan");
position.setForeignId("0151E23B1");
position.setLongitude("120.123");
position.setLatitude("30.123");
position.setOffset(100);
req.setPositionList(list);
OapiAttendanceGroupPositionsAddResponse 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.OapiAttendanceGroupPositionsAddRequest("https://api.dingtalk.io/topapi/attendance/group/positions/add")

req.op_userid="123456"
req.group_key="0151E02xxxx1A917E876"
req.position_list=""
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 OapiAttendanceGroupPositionsAddRequest;
$req->setOpUserid("123456");
$req->setGroupKey("0151E02xxxx7E876");
$position_list = new Position;
$position_list->address="Alibaba Group Xixi Beiyuan";
$position_list->foreign_id="0151E022xxxx917E876";
$position_list->longitude="120.123";
$position_list->latitude="30.123";
$position_list->offset="100";
$req->setPositionList(array($position_list));
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/positions/add");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/positions/add");
OapiAttendanceGroupPositionsAddRequest req = new OapiAttendanceGroupPositionsAddRequest();
req.OpUserid = "123456";
req.GroupKey = "0151E02xxxx17E876";
List<OapiAttendanceGroupPositionsAddRequest.PositionDomain> list2 = new List<OapiAttendanceGroupPositionsAddRequest.PositionDomain>();
OapiAttendanceGroupPositionsAddRequest.PositionDomain obj3 = new OapiAttendanceGroupPositionsAddRequest.PositionDomain();
list2.Add(obj3);
obj3.Address = "Alibaba Group Xixi Beiyuan";
obj3.ForeignId = "0151E0xxxx917E876";
obj3.Longitude = "120.123";
obj3.Latitude = "30.123";
obj3.Offset = 100L;
req.PositionList_ = list2;
OapiAttendanceGroupPositionsAddResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response Body

| Name | Type | Example | Description |
| - | - | - | - |
| result | DingOpenResult | | The returned result. |
| result | Result | | The query result. |
| error\_info\_list | ErrorInfo\[] | | The list of errors. |
| failure\_list | Position\[] | | The list of failed items. |
| foreign\_id | String | 0151E23B1xxxx | The positionId defined by the business party. |
| address | String | Alibaba Group Xixi Beiyuan | The address description. |
| latitude | String | 120.123 | The longitude (up to 6 decimal places). |
| longitude | String | 30.123 | The latitude (up to 6 decimal places). |
| position\_key | String | | The location key. Empty if the operation fails. |
| msg | String | business fault | The error message. |
| code | String | 1000 | The error code. |
| success\_list | Position\[] | | The list of successful items. |
| foreign\_id | String | 0151E23B1 | The positionId defined by the business party. |
| address | String | Alibaba Group Xixi Beiyuan | The address description. |
| latitude | String | 120.123 | The longitude (up to 6 decimal places). |
| longitude | String | 30.123 | The latitude (up to 6 decimal places). |
| position\_key | String | 9E459D1xxxx | The unique identifier of the position. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Indicates whether the request succeeded.   - **true**: Success - **false**: Failed |
| request\_id | String | rndx5wfzebph | The request ID. |

### Response Body Example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "result": {
    "errcode": 0,
    "errmsg" "ok",
    "result": {
      "success_list": [
        {
          "address": "Alibaba Group Xixi Beiyuan",
          "foreign_id": "0151E23B1",
          "latitude": "30.123",
          "longitude": "120.123",
          "position_key": "9E459D1xxxx"
        }
      ]
    },
    "success": true
  },
  "request_id": "rndx5wfzebph"
}
```

### Error Codes

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