Create folder lock on folder

post
https://api.box.com/2.0
/folder_locks/

Creates a folder lock on a folder, preventing it from being moved and/or deleted.

Request

Bearer [ACCESS_TOKEN]
application/json

Request Body

objectin body

The folder to apply the lock to.

stringin bodyrequired
1234567890

The ID of the folder.

stringin bodyrequired
folder

The content type the lock is being applied to. Only folder is supported.

objectin body

The operations to lock for the folder. If locked_operations is included in the request, both move and delete must also be included and both set to true.

booleanin bodyoptional
true

Whether deleting the folder should be locked.

booleanin bodyoptional
true

Whether moving the folder should be locked.

Response

application/jsonFolder Lock

Returns the instance of the folder lock that was applied to the folder, including the user that applied the lock and the operations set.

application/jsonClient error

Returns an error when the request body is not valid.

  • schema_validation_failed - The request body contains a value for a field that either does not exist, or for which the value or type does not match the expected field type. An example might be an unknown option for an enum or multiSelect field.
application/jsonClient error

Returns an error when the folder could not be found.

  • not_found - The folder could not be found, or the user does not have access to the folder.
application/jsonClient error

An unexpected client error.

post
Create folder lock on folder
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X POST "https://api.box.com/2.0/folder_locks" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "folder": {
         "type": "folder",
         "id": "33552487093"
       },
       "locked_operations": {
         "move": true,
         "delete": true
       }
     }'

Response Example

{
  "id": 12345678,
  "type": "folder_lock",
  "created_at": "2020-09-14T23:12:53Z",
  "created_by": {
    "id": 11446498,
    "type": "user"
  },
  "folder": {
    "id": 12345,
    "type": "folder",
    "etag": 1,
    "name": "Contracts",
    "sequence_id": 3
  },
  "lock_type": "freeze",
  "locked_operations": {
    "delete": true,
    "move": true
  }
}