Box Developer Documentation

List All Retention Policies

Guides Retention Policies List All Retention Policies
Edit this page

List All Retention Policies

To list all Retention Policies that have been created in an enterprise, call the GET /retention_policies API endpoint.

cURL
curl -i -X GET "https://api.box.com/2.0/retention_policies" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.retentionPolicies.getRetentionPolicies();
Python Gen
client.retention_policies.get_retention_policies()
.NET Gen
await client.RetentionPolicies.GetRetentionPoliciesAsync();
Java
Iterable<BoxRetentionPolicy.Info> policies = BoxRetentionPolicy.getAll(api);
for (BoxRetentionPolicy.Info policyInfo : policies) {
	// Do something with the retention policy.
}
Python
retention_policies = client.get_retention_policies()
for policy in retention_policies:
    print(f'The policy ID is {policy.id} and the name is {policy.policy_name}')
.NET
BoxCollectionMarkerBased<BoxRetentionPolicy> policies = await client.RetentionPoliciesManager
    .GetRetentionPoliciesAsync();
Node
client.retentionPolicies.getAll({ policy_name: 'Tax' }).then((policies) => {
	/* policies -> {
			entries:
			[ { type: 'retention_policy',
				id: '123456789',
				name: 'Tax Documents' } ],
			limit: 100,
			next_marker: 'someMarkerString' }
		*/
});
iOS
let iterator = client.retentionPolicy.list(type: .indefinite)
iterator.next { results in
    switch results {
    case let .success(page):
        for policy in page.entries {
            print("Retention policy \(policy.id)")
        }
        
    case let .failure(error):
        print(error)
    }
}

Required Scopes

Before using any of the Retention Policy APIs, an application must have the right scopes enabled. See Required Scopes for more details.