Sample - Box Platform API
PUT/files/{file_id}/metadata/enterprise/securityClassification-6VMVochwUWo

Update classification on a file

Replaces the classification value on an existing classification metadata instance for a file. Send one JSON Patch operation with op, path, and value; the file must already have a classification, and value must be defined in the enterprise. The response returns the updated classification metadata instance.

1 parameter · 3 body fields
file_idstringrequired
The unique identifier of the file whose classification metadata instance you want to update.

A JSON Patch array containing one operation to replace the file's classification value.

opstringrequired
The value will always be `replace`.
Allowed:replace
pathstringrequired
Defines classifications available in the enterprise.
Allowed:/Box__Security__Classification__Key
valuestringrequired
The name of the classification to apply to this file. To list the available classifications in an enterprise, use the classification API to retrieve the [classification template](https://developer.box.com/reference/get-metadata-templates-enterprise-securityClassification-6VMVochwUWo-schema) which lists all available classification keys.

4 status codes
200Returns the updated classification metadata instance, including its classification value, parent item, template and scope identifiers, version information, and editability.
Box__Security__Classification__Keystringoptional
The name of the classification applied to the item.
$parentstringoptional
The identifier of the item that this metadata instance has been attached to. This combines the `type` and the `id` of the parent in the form `{type}_{id}`.
$templatestringoptional
The value will always be `securityClassification-6VMVochwUWo`.
Allowed:securityClassification-6VMVochwUWo
$scopestringoptional
The scope of the enterprise that this classification has been applied for. This will be in the format `enterprise_{enterprise_id}`.
$versionintegeroptional
The version of the metadata instance. This version starts at 0 and increases every time a classification is updated.
$typestringoptional
The unique ID of this classification instance. This will be include the name of the classification template and a unique ID.
$typeVersionnumberoptional
The version of the metadata template. This version starts at 0 and increases every time the template is updated. This is mostly for internal use.
$canEditbooleanoptional
Whether an end user can change the classification.
400Returned when the request body is not a valid array of JSON Patch operations.
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.
500Returned in edge cases when the request body is not a valid array of JSON Patch items.
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 when the request body is not a valid JSON Patch array or operation. A 500 can occur when the body is not a valid array of JSON Patch items. Use op set to replace and path set to /Box__Security__Classification__Key, and provide an enterprise-defined value.