Assign legal hold policy

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

Assign a legal hold to a file, file version, folder, or user.

Request

application/json

Request Body

objectin body

The item to assign the policy to

stringin bodyrequired
6564564

The ID of item to assign the policy to

stringin bodyrequired
folder

The type of item to assign the policy to

Value is one of "file", "file_version", "folder", "user"

stringin bodyrequired
123244

The ID of the policy to assign.

Response

Returns a new legal hold policy assignment.

You can now try out some of our APIs live, right here in the documentation.
Log In

Request Example

cURL
curl -X POST https://api.box.com/2.0/legal_hold_policy_assignments \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "policy_id": "123244",
       "assign_to": {
         "type": "folder",
         "id": "6564564"
       }
     }'
.NET
var requestParams = new BoxLegalHoldPolicyAssignmentRequest()
{
    PolicyId = "11111",
    AssignTo = new BoxRequestEntity()
    {
        Type = "folder",
        Id = "12345"
    }
};
BoxLegalHoldPolicyAssignment assignment = await client.LegalHoldPoliciesManager
    .CreateAssignmentAsync(requestParams);
Java
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, policyID);
BoxFolder folder = new BoxFolder(api, folderID);
policy.assignTo(folder);
Python
folder_to_assign = client.folder(folder_id='22222')
assignment = client.legal_hold_policy(policy_id'12345').assign(folder_to_assign)
print('Applied policy "{0}" to {1} {2}'.format(
    assignment.legal_hold_policy.policy_name,
    assignment.assigned_to.type,
    assignment.assigned_to.id,
))
Node
client.legalHoldPolicies.assign('11111', 'folder', '12345')
	.then(assignment => {
		/* assignment -> {
			type: 'legal_hold_policy_assignment',
			id: '22222',
			legal_hold_policy: 
			{ type: 'legal_hold_policy',
				id: '11111',
				policy_name: 'IRS Audit' },
			assigned_to: { type: 'folder', id: '12345' },
			assigned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			assigned_at: '2016-05-18T17:38:03-07:00',
			deleted_at: null }
		*/
	});

Response Example

{
  "id": 11446498,
  "type": "legal_hold_policy_assignment",
  "legal_hold_policy": {
    "id": 11446498,
    "type": "legal_hold_policy"
  },
  "assigned_to": {
    "id": 11446498,
    "type": "file",
    "sequence_id": 3,
    "etag": 1,
    "name": "Pictures"
  },
  "assigned_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "assigned_at": "2012-12-12T10:53:43-08:00",
  "deleted_at": "2012-12-12T10:53:43-08:00"
}