Manage Applications

    List retentions on files

    get
    https://api.box.com/2.0
    /file_version_retentions

    Retrieves all file version retentions for the given enterprise.

    Request

    application/json

    Query Parameters

    stringin queryoptional
    permanently_delete

    Filters results by the retention policy with this disposition action.

    Value is one of "permanently_delete", "remove_retention"

    stringin queryoptional
    2012-12-19T10:34:23-08:00

    Filters results by files that will have their disposition come into effect after this date.

    stringin queryoptional
    2012-12-12T10:53:43-08:00

    Filters results by files that will have their disposition come into effect before this date.

    stringin queryoptional
    43123123

    Filters results by files with this ID.

    stringin queryoptional
    1

    Filters results by file versions with this ID.

    integer / int64in queryoptional
    10001000-1000

    The maximum number of items to return per page.

    stringin queryoptional
    JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii

    The position marker at which to begin the response.

    This requires usemarker to be set to true.

    stringin queryoptional
    982312

    Filters results by the retention policy with this ID.

    Response

    application/jsonRetentions

    Returns a list of all file version retentions for the enterprise.

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

    Request Example

    cURL
    curl -X GET https://api.box.com/2.0/file_version_retentions \
         -H "Authorization: Bearer <ACCESS_TOKEN>"
    .NET
    BoxCollectionMarkerBased<BoxFileVersionRetention> retentions = await client.RetentionPoliciesManager
        .GetFileVersionRetentionsAsync();
    Java
    BoxFileVersionRetention.QueryFilter filter = new BoxFileVersionRetention.QueryFilter()
                    .addFileID("0")
                    .addFileVersionID("1")
                    .addPolicyID("2")
                    .addDispositionAction(BoxRetentionPolicy.ACTION_PERMANENTLY_DELETE)
                    .addDispositionBefore(BoxDateFormat.parse("2016-09-15T13:15:35+0000"))
                    .addDispositionAfter(BoxDateFormat.parse("2014-09-15T13:15:35+0000"));
    Iterable<BoxFileVersionRetention.Info> retentions
                    = BoxFileVersionRetention.getRetentions(api, filter, "file", "applied_at");
    for (BoxFileVersionRetention.Info retentionInfo : retentions) {
    	// Do something with the file version retention.
    }
    Python
    retentions = client.get_file_version_retentions()
    for retention in retentions:
        print('The file version retention ID is {0} and the data time applied at is {1}'.format(retention.id, retention.applied_at))
    Node
    // Get only the retention records set to delete items before a certain date
    var options = {
    	disposition_action: client.retentionPolicies.dispositionActions.PERMANENTLY_DELETE,
    	disposition_before: '2038-01-01T12:34:56-08:00'
    };
    client.retentionPolicies.getAllFileVersionRetentions(options)
    	.then(retentions => {
    		/* retentions -> {
    			entries: 
    			[ { type: 'file_version_retention', id: '112725' },
    				{ type: 'file_version_retention', id: '112729' },
    				{ type: 'file_version_retention', id: '112733' } ],
    			limit: 100,
    			order: [ { by: 'file_version_id', direction: 'ASC' } ] }
    		*/
    	});

    Response Example

    {
      "limit": 1000,
      "next_marker": 3000,
      "prev_marker": 1000,
      "entries": [
        {
          "id": 11446498,
          "type": "file_version_retention",
          "file_version": {
            "id": 11446498,
            "type": "file_version",
            "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
          },
          "file": {
            "id": 12345,
            "etag": 1,
            "type": "file",
            "sequence_id": 3,
            "name": "Contract.pdf"
          },
          "applied_at": "2012-12-12T10:53:43-08:00",
          "disposition_at": "2012-12-12T10:53:43-08:00",
          "winning_retention_policy": {
            "id": 11446498,
            "type": "retention_policy",
            "policy_name": "Some Policy Name"
          }
        }
      ]
    }