---
schema_version: "1"
id: 094ad9b2d93a19ccf91b25d76b6ba9f18d32f8ec576b38a443de9fbf3aad178f
title: Applying Automated Policies
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-gateway/policies-automated-applying.md
canonical_url: https://docs.mulesoft.com/mule-gateway/policies-automated-applying
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8f8fb2945990f27836956dcdf775cd3d28abe5f3ac7fb4d3bf5c26e755e467ed
description: MuleSoft Documentation Site
latest: true
---
---
product: Mule Gateway
---

# Applying Automated Policies

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Users with **Organization Admin**, **Environment Admin**, or with a role to **Manage Policies** in
the environment can create, edit and delete Automated Policies.

## Task Prerequisites

Before you apply an automated policy, ensure that:

- Mule runtime engine (Mule) is installed with
  [Mule Gateway capabilities](https://docs.mulesoft.com/mule-gateway/mule-gateway-capabilities-mule4) enabled.

- An [API](https://docs.mulesoft.com/api-manager/latest/api-instance-landing-page) configured with a basic endpoint or a
  proxy endpoint exists in API Manager.

- A Mule application is deployed with a
  [HTTP(s) based flow](https://docs.mulesoft.com/http-connector/1.10/http-listener-ref), which is linked to the API through
  Autodiscovery.

  When Autodiscovery is correctly configured in your Mule application, your application’s API is
  said to be tracked by or paired to API Manager.

Autogenerated proxies handle these prerequisites in most cases. Mule Gateway reconciles the
automated policies applied to an API in API Manager during runtime.

## Apply Automated Policy

To apply an automated policy:

1.  In **API Manager**, select **Automated Policies** from the left navigation menu.

2.  Click **Apply new automated policy**.

3.  Select the provided policy that you want to configure as a provided policy.  
    You can configure any provided policies for Mule 4 as an automated policy.  
    See the [list of available Provided Policies](https://docs.mulesoft.com/gateway-home/) to learn how to configure each
    one of them.

    When configuring an automated policy, at the end of the policy configuration page, there is a
    **Rule of Applications** sub-section. This section dictates the set of runtimes that the policy
    affects. Configure the following parameters:

    - **Version Range**  
      You can configure a range of Mule runtime versions to inherit the automated policy.  
      For example, if the input **From Version** is 4.1.2 and the **To** is 4.1.4, the automated
      policy is applied to all deployed APIs inside this range. An API deployed on 4.1.5 is not be
      affected by the policy.

      You can include values such as `4.1.x`. For example, adding a range from 4.1.1 to 4.1.x covers
      all runtime patch releases. An API Proxy based on 4.1.0 is not included in this range, because
      it’s lower than the 4.1.1.

      If you are configuring a type of policy that also exists as a provided policy in an API proxy
      affected by your rule of application, you must solve the conflict before continuing. Refer to
      the [Conflict Management](#conflict-management) section below for more information on how to
      solve them.

    - **Java versions**  
      Select to apply the policy to **All Java versions** or **Choose specific Java versions**. If
      you choose to apply the policies to specific Java versions, chose either **Java 8**, **Java
      17**, or both.

4.  Click **Apply**.

> [!TIP] It’s recommended to apply an automated policy in a lower environment before applying in a
> production environment and ensure to review that an automated policy doesn’t affect the existing
> API contracts.

## Conflict Management

Since automated policies have priority over API level policies, when adding an automated policy that
it is already applied as an API Level policies, on API deployed using the selected runtime range, a
conflict will be detected that needs to be solved before proceeding.

When a conflict is detected, a popup with the list of conflicting APIs will be displayed. A message
will be shown with the first 10 APIs with conflicts and the total amount. You can use this endpoint
to access the list of all APIs:

```CURL
curl -X GET \
https://anypoint.mulesoft.com/xapi/v1/automated-policies/{groupId}/{assetId}/conflicting-apis \
-H 'Authorization: Bearer {token}'
```

To solve conflicts, you can either select the APIs from the list of already configured APIs and
manually disable or remove the conflicting policy or choose to override all conflicting policies for
the already configured APIs. If this last option is chosen the conflicting policies in the APIs will
be disabled. If Automated Policy is removed, the API policy will be re-enabled automatically.

## Deploying New APIs

When managing new APIs, you can see information regarding the status of the automated policies
applied to your environment in the **Policies** tab. No automated policies are shown until the
application is in Active status.  
After the application is deployed, a list of applied automated policies will be listed in the
**Policies** tab of the API.

Users with **View Policies** role for the environment will able to see the list of automated
policies applied.  
If an application is deployed to an environment which has an automated policy that doesn’t cover the
deployed runtime, for example with an automated policy affecting a runtime range from 4.1.2 to
4.1.4, and a user deploys to a 4.1.5 runtime, a notification will be sent to the organization, and
environment administrators, to let them know of this activity.

### Viewing Coverage Status

View the **Coverage status** of an API instance to see if an automated policy covers your API
instance or why it doesn’t. Typically, instances are not covered due to their runtime type or
runtime version.

To view what API instances are covered by an automated policy:

1.  Navigate to **Anypoint Platform** > **API Manager**.

2.  In API Administration, click **Automated Policies**.

3.  Click the more options button
    (![Three circles displayed horizontally, representing the More Options menu](/mulesoft/current/en-us/mule-gateway/_images/more-options-menu.png))
    of the policy whose coverage you want to view, and then click **See covered APIs**.

4.  View the API instance’s coverage status in the **Coverage status** column.

> [!NOTE] To filter by coverage status, click the coverage status dropdown and select a coverage
> status option.

## Auditing Applied Policies

It is possible to audit and get a list of all affected APIs by an automated policy. Reports can be
filtered by runtime version, and by an operation.

To get the list of all automated policies in an environment

```curl
curl -X GET \
https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{organizationId}/automated-policies?environmentId={envId} \
  -H 'Authorization: Bearer {token}'
```

To get the list of APIs included in the range of automated policy or APIs where the automated policy
is not applied.

```curl
curl -X GET \
https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{organizationId}/automated-policies/{automatedPolicyId}/apis \
-H 'Authorization: Bearer {token}'
```

## See Also

- [Included Policies](https://docs.mulesoft.com/mule-gateway/policies-included-directory)
