---
schema_version: "1"
id: 32816c3995ea0fbb3fc084a5b1678f9f2a10229468e5264f361e082de537a673
title: Creating Custom Rulesets by Modifying Published Rulesets
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/api-governance/custom-rulesets-modify.md
canonical_url: https://docs.mulesoft.com/api-governance/custom-rulesets-modify
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4fddfad994eb5c0441cdd1c16e65d4dae1a19dd7286924c090db8868a54d166b
description: MuleSoft Documentation Site
latest: true
---
---
product: API Governance
---

# Creating Custom Rulesets by Modifying Published Rulesets

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

If a published ruleset meets most of your needs, consider using it as an example to base your custom
ruleset on.

To create a custom ruleset by modifying a published ruleset:

1.  Download the published ruleset ("before" ruleset) from Exchange using the Anypoint Platform UI.

2.  Optionally [list the rules](#list-rules) in the "before" ruleset using Anypoint CLI.

3.  Clone the ruleset and modify the rules [using Anypoint CLI](#use-clone-cli) or manually ("after"
    ruleset).

4.  Optionally [list the rules](#list-rules) in the "after" ruleset using Anypoint CLI.

5.  Validate, generate the documentation for, and publish the custom ruleset using Anypoint CLI. See
    [Validating and Publishing Custom Rulesets](https://docs.mulesoft.com/api-governance/custom-rulesets-validate-and-publish).

## Change Rule Severity or Enable or Disable Rules Using Anypoint CLI

Watch this video to see how to clone and customize an example ruleset using Anypoint CLI. Use this
video along with the documentation to get started downloading an example ruleset, modifying rules
using Anypoint CLI, and publishing your customized ruleset.

![](https://play.vidyard.com/mFNbKRLD4Gsm8LK434oXYG.jpg)

## Clone and Modify a Ruleset Using Anypoint CLI

To create a custom ruleset using Anypoint CLI, use the `governance:ruleset:clone` command.

### governance:ruleset:clone

`> governance:ruleset:clone [flags] <ruleset> <new_title> <new_description>`

Clones a governance ruleset to create a new custom ruleset and applies specified updates to rules
based on the flags. The new ruleset is written to standard output.

The `new-title` parameter gives the title for the new ruleset.

The `new description` parameter gives the description for the new ruleset.

> [!TIP] Run the `governance:ruleset:info` command before running this command to get the rule ID
> information to use in this command.

In addition to the [default flags](https://docs.mulesoft.com/api-governance/#default-options), this command accepts the following flags:

<table><colgroup><col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>--remote</code></p></div></div></td><td><div><div><p>Indicates that the ruleset to clone is published in Exchange and that the <code>ruleset</code> parameter is the asset identifier for the ruleset. An asset identifier is the group ID, asset ID, and version (GAV) that uniquely identifies each asset in Exchange. For example: <code>&lt;group_id&gt;/&lt;asset_id&gt;/&lt;version&gt;</code></p></div><div><p>See <a href="#exchange-asset-identifiers">Get Exchange Asset Identifiers</a>.</p></div></div></td></tr><tr><td><div><div><p><code>--error=&lt;list_rules_to_move_to_error&gt;</code></p></div></div></td><td><div><div><p>The <code>error</code> flag is followed by the rule IDs for the rules to move to the error severity level section of the ruleset YAML.</p></div></div></td></tr><tr><td><div><div><p><code>--warning=&lt;list_rules_to_move_to_warning&gt;</code></p></div></div></td><td><div><div><p>The <code>warning</code> flag is followed by the rule IDs for the rules to move to the warning severity level section of the ruleset YAML.</p></div></div></td></tr><tr><td><div><div><p><code>--info=&lt;list_rules_to_move_to_info&gt;</code></p></div></div></td><td><div><div><p>The <code>info</code> flag is followed by the rule IDs for the rules to move to the info severity level section of the ruleset YAML.</p></div></div></td></tr><tr><td><div><div><p><code>--remove=&lt;list_rules_to_disable&gt;</code></p></div></div></td><td><div><div><p>The <code>remove</code> flag is followed by the rule IDs for the rules to comment out, and therefore effectively disable, in the ruleset YAML.</p></div></div></td></tr></tbody></table>

**Example commands:**

```copy
anypoint-cli-v4 governance:ruleset:clone ~/Downloads/ruleset.yaml 'New Ruleset from Clone' 'Cloned from ruleset.yaml' --warning=operation-default-response,operation-operationId > mynewruleset.yaml

anypoint-cli-v4 governance:ruleset:clone 68ef9520-24e9-4cf2-b2f5-620025690913/anypoint-best-practices/1.0.2 'Custom Anypoint Best Practices' 'Cloned from MuleSoft Anypoint Best Practices' --remote --remove=openapi-tags,operation-tags > my-anypoint-best-practices.yaml
```

## List Ruleset Rules Using Anypoint CLI

Optionally use Anypoint CLI to list the rules:

- Before you modify the ruleset to help determine what you want to change (the "before" list)

- After you change the ruleset (the "after" list) to compare to the "before" list and ensure you
  changed what you meant to change

> [!TIP] Use the redirection operator (`>` to overwrite or `>>` to append) to write the output of
> the `info` command to a file for easier comparison.

To list the rules in a ruleset, use the `governance:ruleset:info` command.

### governance:ruleset:info

`> governance:ruleset:info <governance-ruleset> [flags]`

Lists the ruleset rules in the ruleset definition passed in the `governance-ruleset` parameter.

> [!NOTE] This command has multi-option flags. When using multi-option flags in a command, either
> put the parameter before the flags or use "-- " (two dashes followed by a space) before the
> parameter.

In addition to the [default flags](https://docs.mulesoft.com/api-governance/#default-options), this command accepts the following flags:

<table><colgroup><col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>--remote</code></p></div></div></td><td><div><div><p>Indicates that the ruleset for which to get information is published in Exchange and that the <code>ruleset</code> parameter is the asset identifier for the ruleset. An asset identifier is the group ID, asset ID, and version (GAV) that uniquely identifies an asset in Exchange. For example: <code>&lt;group_id&gt;/&lt;asset_id&gt;/&lt;version&gt;</code>, where <code>&lt;version&gt;</code> is a specific version or <code>latest</code>. If you use <code>latest</code> as the version, the profile automatically uses the latest version of the ruleset when versions are published after you create the profile.</p></div><div><p>See <a href="#exchange-asset-identifiers">Get Exchange Asset Identifiers</a>.</p></div></div></td></tr></tbody></table>

**Example commands:**

```copy
anypoint-cli-v4 governance:ruleset:info myrulesetfolder/myruleset.yaml

anypoint-cli-v4 governance:ruleset:info 68ef9520-24e9-4cf2-b2f5-620025690913/anypoint-best-practices/1.0.2 --remote

anypoint-cli-v4  governance:ruleset:info 68ef9520-24e9-4cf2-b2f5-620025690913/anypoint-best-practices/latest --remote
```

**Example output:**

Ruleset myrulesetfolder/myruleset.yaml Ruleset conforms with Dialect
╔═══════════╤═══════════════════════════════════╗ ║ Violation │ security-fields-operation-empty ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ access-tokens-oauth2-cleartext ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ insecure-oauth2-grants ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ api-keys-in-cookie ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ api-keys-in-query ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ api-keys-in-header ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ api-negotiates-authentication ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ insecure-basic-auth ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ bearer-token-cleartext ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ http-token-cleartext ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ oauth2-redirections-non-encrypted ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ unknown-security-scheme ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ valid-server-urltemplate ║
╟───────────┼───────────────────────────────────╢ ║ Violation │ valid-oauth2-redirection-urls ║
╟───────────┼───────────────────────────────────╢ ║ Warning │ unknown-security-scheme ║
╟───────────┼───────────────────────────────────╢ ║ Warning │ oauth1-deprecated ║
╚═══════════╧═══════════════════════════════════╝

## Get Exchange Asset Identifiers

To get the full asset identifier (group ID/asset ID/version) for Exchange assets:

- If you are using Anypoint CLI, run the `exchange:asset:list` command.

- If you are using the Anypoint Platform web UI, select the asset in Exchange and copy the group ID
  and asset ID from the URL. Then, add the version node for the version you are viewing. For
  example, the asset identifier for the OpenAPI Best Practices ruleset in Exchange is
  `68ef9520-24e9-4cf2-b2f5-620025690913/open-api-best-practices/1.0.1`.

## Example Command Sequence to Modify a Ruleset

Use the following example sequence to get started modifying a ruleset. Replace the details, such as
the folder name, ruleset file name, and ruleset documentation ZIP file name, with your own.

```console
anypoint-cli-v4 governance ruleset info 68ef9520-24e9-4cf2-b2f5-620025690913/anypoint-best-practices/1.0.2 --remote > before-rules-list (1)

anypoint-cli-v4 governance ruleset clone ~/MyRulesetFolder/myruleset.yaml 'New Ruleset from Clone' 'Cloned from myruleset.yaml' --warning=operation-default-response,operation-operationId > mynewruleset.yaml (2)

anypoint-cli-v4 governance ruleset info ~/MyRulesetFolder/mynewruleset.yaml > after-rules-list (3)
```

<table><tbody><tr><td><i data-value="1"></i><b>1</b></td><td>Lists the rules in the published version of a published ruleset that you want to modify to create a custom version.</td></tr><tr><td><i data-value="2"></i><b>2</b></td><td>Clones the downloaded ruleset, <code>myruleset.yaml</code>, to create a new custom ruleset, <code>mynewruleset.</code> Puts the <code>operation-default-response</code> and <code>operation-operationId</code> rules in the warning section in <code>mynewruleset</code>.</td></tr><tr><td><i data-value="3"></i><b>3</b></td><td>Lists the rules in the modified version of the ruleset, <code>mynewruleset.yaml</code>, to verify that the rules are the way you want them.</td></tr></tbody></table>

## Next Steps

After you modify the ruleset, see
[Validating and Publishing Custom Rulesets](https://docs.mulesoft.com/api-governance/custom-rulesets-validate-and-publish).

## See Also

- [Troubleshooting Anypoint CLI](https://docs.mulesoft.com/api-governance/cli-commands-troubleshoot)

- [Downloading an Asset](https://docs.mulesoft.com/exchange/to-download-an-asset)

- [CLI for Exchange Assets](https://docs.mulesoft.com/anypoint-cli/latest/exchange-assets)
