HeadSpin Documentation
Documentation

Data Lifecycle Policy API

Data Lifecycle Overview

Data stored on the HeadSpin platform for your organization may be managed through lifecycle policies. These policies define conditions for automatically deleting data when appropriate. Policies contain a lifetime (a time limit after which data will be removed) and/or a size limit (a maximum size for all data, above which data will be removed). These policies are tied to specific data types so that limits for different data types may be defined independently as needed -- see the section on data types for more details.

Policies are enforced on a schedule, so once a policy is put in place for a given data type, there may be some delay before the relevant data is deleted.

Manageable Data Types

The table below details the data types currently available for lifecycle management.

Each data type is tied to a key that specifies said data type when interacting with the policy API.

Data Type Key Description
Uploaded APKs apk User-uploaded software for Android applications.
Uploaded IPAs ipa User-uploaded software for iOS applications.
Session Data session All captured or computed data associated with HeadSpin sessions (capture video, timeseries data, etc.).

Data Lifecycle Policies

Set data lifecycle policies

Method Route
POST /v0/lifecycles

Request Body Parameters

The body of a single POST request can specify multiple policies. The body should map between data type keys (see the section on data types for more details) and information on the respective policies. Each policy definition consists of the following fields:

  • <code class="dcode">lifetime</code>: A set of values representing the lifetime of the data type, defined by two fields.
  • <code class="dcode">value</code>: The numeric value (integer or float) representing the lifetime.
  • <code class="dcode">units</code>: The units associated with the value field. Currently accepts either <code class="dcode">"hours"</code> or <code class="dcode">"days"</code>.
  • <code class="dcode">size_limit</code>: A set of values representing the size limit of the data type, defined by two fields.
  • <code class="dcode">value</code>: The numeric value (integer or float) representing the size limit.
  • <code class="dcode">units</code>: The units associated with the value field. Currently accepts either <code class="dcode">"GiB"</code> (gibibytes) or <code class="dcode">"GB"</code> (gigabytes).
  • <code class="dcode">notes</code> (optional): Plaintext notes to be associated with the uploaded policy.

Note: either <code class="dcode">lifetime</code> or <code class="dcode">size_limit</code> must be provided. If both are provided, both will be enforced -- that is, data will be deleted until all remaining data is younger than the lifetime, and the total size is below the size limit.

Example: Set policies to manage APK and IPA data


curl -X POST -H "Authorization: Bearer <your_api_token>" https://api-dev.headspin.io/v0/lifecycles -d '{"apk": {"lifetime": {"value": 30, "units": "days"}, "notes": "Example APK policy"}, {"ipa": {"size_limit": {"value": 5, "units": "GiB"}, "notes": "Example IPA policy"}}}' 

Response

  • <code class="dcode">HTTP 200 OK</code> if the policies are successfully uploaded.
  • <code class="dcode">HTTP 400</code> for an invalid input value (data type, parameters). See the response message for more details.

Loads information on the organization's policies, and optionally filters for only the provided data types.

Method Route
GET /v0/lifecycles

Optional Parameters

  • <code class="dcode">include</code>: All data types to return information on. If no values are provided to <code class="dcode">include</code>, the endpoint defaults to returning all policies for the organization.

Example: Get the lifecycle policies for APK and IPA data


curl -X GET -H "Authorization: Bearer <your_api_token>" https://api-dev.headspin.io/v0/lifecycles?include=apk&include=ipa 

Response

  • <code class="dcode">HTTP 200 OK</code> if the request is successful, and a body similar to the following:

{
    "apk": {
        "org_id": "ee536332-0ce8-487c-991d-dde9e2b6eb2d",
        "lifetime": {
            "value": 720,
            "units": "hours"
        },
        "ts_created": 1637353754577,
        "notes": "Example APK policy",
        "author_email": "example@headspin.io"
    },
    "ipa": {
        "org_id": "ee536332-0ce8-487c-991d-dde9e2b6eb2d",
        "size_limit": {
            "value": 5,
            "units": "GiB"
        },
        "ts_created": 1637353754577,
        "notes": "Example IPA policy",
        "author_email": "example@headspin.io"
    }
}
  • <code class="dcode">HTTP 404</code> if no policy exists for any of the given data types.
  • <code class="dcode">HTTP 400</code> for an invalid data type.

Delete a lifecycle policy

Method Route
DELETE /v0/lifecycles/{data_type}

Example: Delete the policy for APK data


curl -X DELETE -H "Authorization: Bearer <your_api_token>" https://api-dev.headspin.io/v0/lifecycles/apk 

Response

  • <code class="dcode">HTTP 200 OK</code> if the policy is successfully deleted.
  • <code class="dcode">HTTP 400</code> for an invalid data type.