Skip to main content
Version: Early Access

About the Policies API

The Policies API allows you to programmatically configure policies and apply them to apps without using the Admin Portal user interface. All the basic concepts of working with policies still apply. For more information about policies in general, see About Policies.

Resources

The following resources are available in the Policies API. Click a path to view a complete reference for that resource.

FunctionResource
List All PoliciesGET /v2/policies/
List Data for a PolicyGET /v2/policies/(policy_id)/
List Policies Applied to an AppGET /v2/applications/(app_id)/policies/
Apply Policies to an AppPOST /v2/applications/(app_id)/policies/
Remove Policies from an AppDELETE /v2/applications/(app_id)/policies/
Create a Preset Policy ConfigurationPOST /v2/policies/(policy_id)/configurations/
List Data for a Preset Policy ConfigurationGET /v2/policies/configurations/(configuration_id)/
Update a Preset Policy ConfigurationPUT /v2/policies/configurations/(configuration_id)/
Delete a Preset Policy ConfigurationDELETE /v2/policies/configurations/(configuration_id)/

How Policies Work

When you first apply policies to an app, Digital.ai App Management modifies the app to apply a "policy layer" that defines the app's policies. Though we modify the app to apply the policy layer, there is no new version of the app (i.e. no new binary or incremented version number). This occurs whenever you apply policies to an app, whether via the UI or the API.

Also just like when applying policies in the UI, after the new app version with policies is created, you need to re-sign it. Once the app is re-signed, it is then ready to deploy to your users.

Policy Status

You can view the status of policies on the app when managing policies via the API. The possible status codes are:

CodeStatusDescription
-1ERRORAn error has occurred while applying the policy layer.
0NO POLICIESNo policies are applied to the app.
1POLICIES AND SIGNEDPolicies are applied to the app and it is signed. The app is ready to be deployed to users.
2APPLYING POLICIESA policy layer with the defined policies is currently being applied to the app.
3POLICIES NOT SIGNEDPolicies have been applied to the app and it needs to be signed before deploying to users.
4POLICIES PREVIOUSLY APPLIEDA previous version of this app had policies applied, but the app has since been updated to a new version which has not yet been configured with policies.
tip

Check an App's Policy Status

The GET request to /applications/(app_id)/policies/ is asynchronous, which means you can make a request to view the policy status for an app at any time, including immediately after you send the POST request.

Policy Configurations

Some policies include one or more options that should be configured in order for the policy to work as expected. For example, you can define a date range and message for the App Expiration policy. Policies can also be enabled by default so they are automatically selected on an app's Policies tab.

The term we use to describe this set of options is: configuration

In the Admin Portal, you can define these options on a specific app's Policies tab (or on the Policies page). When you use the API to apply policies to an app, you can manually define the configuration options individually, or retrieve a set of preconfigured options.

The term we use to describe these preconfigured options is: preset (or preset configuration)

info

When you define a policy's options on the Policies page in the Admin Portal, you are creating a preset. For information about working with presets in the Admin Portal, see Define Policy Presets.

The Policies API allows you to create and manage multiple preset configurations for each policy (the Admin Portal only allows you to configure one preset on the Policies page). This lets you refer to the stored configurations and retrieve a specific configuration when you're applying a policy to an app.

info

You can define the configuration for a policy when applying the policy to a specific app. It is not necessary to create or use preset configurations. They are optional, just as it's optional for administrators to define presets on the Policies page in the Admin Portal.

Back to Top