Sample - Box Platform API
POST/folders/{folder_id}/metadata/enterprise/securityClassification-6VMVochwUWo

Add classification to folder

Adds a classification to a folder by specifying the label of the classification to add.

This API can also be called by including the enterprise ID in the URL explicitly, for example /folders/:id/enterprise_12345/securityClassification-6VMVochwUWo.

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

1 parameter · 1 body field
folder_idstringrequired
The unique identifier that represent a folder. The ID for any folder can be determined by visiting this folder in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/folder/123` the `folder_id` is `123`. The root folder of a Box account is always represented by the ID `0`.
Box__Security__Classification__Keystringoptional
The name of the classification to apply to this folder. 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.

5 status codes
201Returns the classification template instance that was applied to the folder.
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.
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 or metadata template was not found. * `not_found` - The folder could not be found, or the user does not have access to the folder. * `instance_tuple_not_found` - The metadata template was not found.
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.
409Returns an error when an instance of this metadata template is already present on the folder. * `tuple_already_exists` - An instance of them metadata template already exists on the 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 or metadata template was not found.

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

  • instance_tuple_not_found - The metadata template was not found. A 409 is returned: Returns an error when an instance of this metadata template is already present on the folder.

  • tuple_already_exists - An instance of them metadata template already exists on the folder. Any other status is an error: An unexpected client error.