Box Developer Documentation
Latest version

Get retention policy

get
https://api.box.com/2.0
/retention_policies/:retention_policy_id

Retrieves a retention policy.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
982312

The ID of the retention policy.

Query Parameters

string arrayin queryoptional
id,type,name

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Response

application/jsonRetention policy

Returns the retention policy object.

application/jsonClient error

An unexpected client error.

get
Get retention policy
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X GET "https://api.box.com/2.0/retention_policies/982312" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.retentionPolicies.getRetentionPolicyById(retentionPolicy.id);
Python Gen
client.retention_policies.get_retention_policy_by_id(retention_policy.id)
.NET Gen
await client.RetentionPolicies.GetRetentionPolicyByIdAsync(retentionPolicyId: retentionPolicy.Id);
Swift Gen (Beta)
try await client.retentionPolicies.getRetentionPolicyById(retentionPolicyId: retentionPolicy.id)
Java
// Get the policy name and status for a given retention policy
BoxRetentionPolicy policy = new BoxRetentionPolicy(api, id);
policy.getInfo("policy_name", "status");
Python
retention_policy = client.retention_policy(retention_id='12345').get()
print(f'Retention Policy ID is {retention_policy.id} and the name is {retention_policy.policy_name}')
.NET
BoxRetentionPolicy policy = await client.RetentionPoliciesManager.GetRetentionPolicyAsync("11111");
Node
client.retentionPolicies.get('123456789').then((policy) => {
	/* policy -> {
			type: 'retention_policy',
			id: '123456789',
			policy_name: 'Tax Documents',
			policy_type: 'indefinite',
			retention_length: 'indefinite',
			retention_type: 'modifiable',
			description: 'Policy to retain all reports',
			disposition_action: 'remove_retention',
			can_owner_extend_retention: false,
			status: 'active',
			are_owners_notified: true,
			custom_notification_recipients: []
			assignment_counts: { enterprise: 0, folder: 1, metadata_template: 0 },
			created_by:
			{ type: 'user',
				id: '11111',
				name: 'Example User',
				login: 'user@example.com' },
			created_at: '2015-05-01T11:12:54-07:00',
			modified_at: '2015-06-08T11:11:50-07:00' }
		*/
});
iOS
client.retentionPolicy.get(policyId: "1234") { result  in
    guard case let .success(retentionPolicy) = result else {
        print("Error getting retention policy")
        return
    }

    print("Retention policy: \(retentionPolicy.id)")
}

Response Example

{
  "id": "12345",
  "type": "retention_policy",
  "are_owners_notified": false,
  "assignment_counts": {
    "enterprise": 1,
    "folder": 1,
    "metadata_template": 1
  },
  "can_owner_extend_retention": false,
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "custom_notification_recipients": [
    {
      "id": "11446498",
      "type": "user",
      "login": "ceo@example.com",
      "name": "Aaron Levie"
    }
  ],
  "description": "Policy to retain all reports for at least one month",
  "disposition_action": "permanently_delete",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "policy_name": "Some Policy Name",
  "policy_type": "finite",
  "retention_length": "365",
  "retention_type": "non_modifiable",
  "status": "active"
}