# Modify protected range

Use this API to modify a protected range based on the protected range ID. Each operation can modify up to 10 IDs.
## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/protected_range_batch_update
HTTP Method | POST
Supported app types | Custom App、Store App
Required scopes<br>**The scopes required to call this API. You can call the API with any of the scopes.**<br>Enable any scope from the list | View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `user_access_token`  or  `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[Learn more about how to obtain and use access_token](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Path parameters
| Parameter              | Type   | Required | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                           | 
| ----------------- | ------ | ---- | ------------------------------------------------------------ | ----------- |
| spreadsheetToken  | string | Yes   | token of the  sheet , to obtain the token, see [Sheets Developer's Guide](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)| 
### Request body
| Parameter              | Type   | Required | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                           | 
| ----------------- | ------ | ---- | ------------------------------------------------------------ | ----------- |
|requests||Yes|Request
| &emsp;protectId         | string | Yes   | Protected range ID, obtained through the [Obtain sheet metadata](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN) API                                          |
| &emsp;∟dimension         |        | No   | Row and column protection information                                                 |
| &emsp;&emsp;∟sheetId          | string | Yes   | sheetId                                                      |
| &emsp;&emsp;∟startIndex       | int    | Yes   | Protected row and column start index, starts from 1.|
| &emsp;&emsp;∟endIndex         | int    | Yes   | Protected row and column end index, starts from 1.|
| &emsp;&emsp;∟majorDimension   | string | Yes   | Protected range dimensions for the protected range ID; COLUMNS indicates protected columns and ROWS indicates protected row.| Request body   |
| &emsp;∟editors           |        | No   | Users who can edit the protected range                                         |
| &emsp;&emsp;∟addEditors       |        | No   | The list of users to add, users must have doc editing permissions.|
| &emsp;&emsp;&emsp;∟memberType | string | Yes   | User type, supports userId, openId, and unionId.|
| &emsp;&emsp;&emsp;∟memberId   | string | Yes   | User ID of the selected user type                                         |
| &emsp;&emsp;∟delEditors       |        | No   | List of users to delete                                         |
| &emsp;&emsp;&emsp;∟memberType | string | Yes   | User type, supports userId, openId, and unionId.|
| &emsp;&emsp;&emsp;∟memberId   | string | Yes   | User ID of the selected user type                                         |
| &emsp;∟lockInfo          | string | No   | Protection description                                                     |

### Request body example
```json
{
    "requests": [
        {
            "protectId": "***",
            "dimension": {
                "majorDimension": "***",
                "sheetId": "***",
                "startIndex": 0,
                "endIndex": 0
            },
            "editors": {
                "addEditors": [
                    {
                        "memberType": "userId",
                        "memberId": "****"
                    }
                ],
                "delEditors": [
                    {
                        "memberType": "userId",
                        "memberId": "****"
                    }
                ]
            },
            "lockInfo": "****"
        }
    ]
}
```
### cURL Request example
```
curl --location --request POST 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcngNygNfuqhxTBf588jwgWbJ/protected_range_batch_update' \
--header 'Authorization: Bearer t-e346617a4acfc3a11d4ed24dca0d0c0fc8e0067e' \
--header 'Content-Type: application/json' \
--data-raw '{
    "requests": [
        {
            "protectId": "6947942538267541505",
            "dimension": {
                "majorDimension": "ROWS",
                "sheetId": "Q7PlXT",
                "startIndex": 2,
                "endIndex": 4
            },
            "editors": {
                "addEditors": [
                    {
                        "memberType": "userId",
                        "memberId": "667338922291111404"
                    }
                },
                "delEditors": [
                    {
                        "memberType": "userId",
                        "memberId": "667338922291122404"
                    }
                ]
            },
            "lockInfo": "1234"
        }
    ]
}'
```
## Response
### Response body
| Parameter              |Type| Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
| ----------------- |-----| ---------------------------------- |
|replies|array<interface>|Response|
| &emsp;∟sheetId           |string| sheet ID                          |
| &emsp;∟dimension         || Successfully modified protected row and column information             |
| &emsp;&emsp;∟sheetId          |string| sheetId                            |
| &emsp;&emsp;∟startIndex       |int| Protected row and column start index, starts from 1      .|
| &emsp;&emsp;∟endIndex         |int| Protected row and column end index, starts from 1      .|
| &emsp;&emsp;∟majorDimension   |string| Protected range dimensions                     |
| &emsp;∟editors           | Users who can edit the protected range               |
| &emsp;&emsp;∟addEditors       |array<interface>| List of successfully added users               |
| &emsp;&emsp;&emsp;∟memberType |string| User type                           |
| &emsp;&emsp;&emsp;∟memberId   |string| User ID of the selected user type               |
| &emsp;&emsp;∟delEditors       |array<interface>| List of successfully deleted users               |
| &emsp;&emsp;&emsp;∟memberType |string| User type                           |
| &emsp;&emsp;&emsp;∟memberId   |string| User ID                of the selected user type|
| &emsp;∟lockInfo          |string| Successfully modified protection description                 |
###  Response body example
```json
{
    "code": 0,
    "msg": "Success",
    "data": {
        "replies": [
            {
                "protectId": "***",
                "dimension": {
                    "sheetId": "***",
                    "startIndex": 0,
                    "endIndex": 0,
                    "majorDimension": "ROWS"
                },
                "editors": {
                    "addEditors": [
                        {
                            "memberType": "userId",
                            "memberId": "*"
                        }
                    },
                    "delEditors": []
                },
                "lockInfo": "Info11",
                "sheetId": "abb54d"
            }
        ]
    }
}
```

### Error code

For details, refer to [Server-side error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

