Contact Free trial Login

Applying Offline Custom Policies

An offline policy is applied directly to the runtime, not applied through API Manager. This procedure describes how to apply an offline policy to an API. You create a file in the offline-policies directory. Mule detects the presence of the file and starts applying the policy. Mule generates JSON and XML policy files in a new directory in %MULE_HOME%/policies.

Note: The information in this topic applies only to use with Mule 4.

  1. If you have a policy template published in Exchange, you can skip this step; otherwise, if a policy template is not published to Exchange, or you don’t want to connect to Anypoint Platform to retrieve it from Exchange, place the template JAR in the following directory before you apply the offline policy to the API.


  2. Create a JSON file in %MULE_HOME%/policies/offline-policies directory that defines the policy configuration.

  3. Name the JSON file after the policy id.

  4. In the file, include the following configuration specifications:

    • Policy template information

      Specify the Exchange groupId, assetId, and version of the template used to deploy the offline policy definition.

    • Ids of the APIs that the policy will be applied to

    • A list of resources that the policy will be applied to

    • Order of the policy

    • Parameters if the defined template is using handlebars variables

      The following example shows a typical offline policy definition:

       "template" : {
         "groupId" : "com.mulesoft.anypoint",
         "assetId" : "policyTemplate",
         "version" : "0.1.0"
       "api": [
           "id": "1"
           "id": "2"
       "order": 1,
       "configuration" : {
         "payload" : "Payload"

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.