Box Developer Documentation
 
    Latest version

    Create folder lock

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

    This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

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

    You must be authenticated as the owner or co-owner of the folder to use this endpoint.

    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 was not found.

    • not_found - The folder could not be found, the user does not have access to the folder, or the user making call is not an owner or co-owner of folder.
    application/jsonClient error

    An unexpected client error.

    post
    Create folder lock
    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
      }
    }