Sample - Box Platform API
POST/folder_locks

Create folder lock

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.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 body fields
locked_operationsobjectoptional
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`.
folderobjectrequired
The folder to apply the lock to.

4 status codes
200Returns the instance of the folder lock that was applied to the folder, including the user that applied the lock and the operations set.
folderobjectoptional
idstringoptional
The unique identifier for this folder lock.
typestringoptional
The object type, always `folder_lock`.
created_byobjectoptional
created_atstringoptional
When the folder lock object was created.
locked_operationsobjectoptional
The operations that have been locked. Currently the `move` and `delete` operations cannot be locked separately, and both need to be set to `true`.
lock_typestringoptional
The lock type, always `freeze`.
400Returns 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.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
404Returns 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.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
defaultAn unexpected client error.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

A 400 is returned: 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. A 404 is returned: 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. Any other status is an error: An unexpected client error.