Box Developer Documentation
 
    Latest version

    Add classification to file

    post
    https://api.box.com/2.0
    /files/:file_id/metadata/enterprise/securityClassification-6VMVochwUWo

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

    Adds a classification to a file 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 /files/:id//enterprise_12345/securityClassification-6VMVochwUWo.

    Request

    bearer [ACCESS_TOKEN]
    application/json

    Path Parameters

    stringin pathrequired
    12345

    The unique identifier that represents a file.

    The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123.

    Request Body

    "Sensitive"

    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 which lists all available classification keys.

    Response

    application/jsonClassification

    Returns the classification template instance that was applied to the file.

    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 file or metadata template was not found.

    • not_found - The file could not be found, or the user does not have access to the file.
    • instance_tuple_not_found - The metadata template was not found.
    application/jsonClient error

    Returns an error when an instance of this metadata template is already present on the file.

    • tuple_already_exists - An instance of them metadata template already exists on the file.
    application/jsonClient error

    An unexpected client error.

    post
    Add classification to file
    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/files/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
         -H "authorization: Bearer <ACCESS_TOKEN>" \
         -H "content-type: application/json" \
         -d '{
           "Box__Security__Classification__Key": "Sensitive"
    
         }'

    Response Example

    {
      "$canEdit": true,
      "$parent": "folder_59449484661,",
      "$scope": "enterprise_27335",
      "$template": "securityClassification-6VMVochwUWo",
      "$type": "securityClassification-6VMVochwUWo-fd31537a-0f95-4d86-9f2b-5974a29978f8",
      "$typeVersion": 5,
      "$version": 1,
      "Box__Security__Classification__Key": "Sensitive"
    }