> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Manage your API governance rulesets and functions

The *Ruleset Library* is where you manage the reusable building blocks of your team's governance strategy:

* [**Rulesets**](#add-a-custom-ruleset) — Sets of governance rules that validate your OpenAPI specifications against your custom standards. Rulesets can be applied to your team's workspaces to enforce those standards.
* [**Functions**](#add-a-custom-function) — Custom validation logic written in JSON or YAML and linted by [Spectral](/docs/api-governance/configurable-rules/spectral/). Use functions to enforce checks that aren't covered by the standard rule types or that are custom to your team's needs. Functions can be used in any ruleset.

Use the search field to find a specific ruleset or function, and click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/action-add-stroke.svg#icon" width="16px" /> **Create new** to create a ruleset or function. The right pane provides quick access to **Create a ruleset** and **Create a function**. Each ruleset and function includes a rendered documentation view, making reviews easier without reading raw JSON or YAML. Users with the [API Governance Manager or the API Catalog Manager role](/docs/administration/roles-and-permissions#team-roles) can manage rulesets and functions in the Ruleset Library.

![The API Catalog's ruleset and functions interface](https://assets.postman.com/postman-docs/v12/api-catalog-governance-groups-v12-02.png)

When editing your custom rulesets and functions, you can use the following options:

* Use the JSON or YAML dropdown list to switch between the two formats for rulesets. Postman converts your ruleset between the two formats automatically.
* <img alt="Console icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-console-stroke.svg#icon" width="20px" /> **View Command Palette** — Opens the command palette, which provides quick access to frequently used commands.
* <img alt="Pretty icon" src="https://assets.postman.com/postman-docs/aether-icons/action-pretty-stroke.svg#icon" width="16px" /> **Beautify** — Formats your ruleset or function to make it easier to read.
* <img alt="Wrap icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-wrap-stroke.svg#icon" width="20px" /> **Wrap text** — Wraps long lines of text in the editor.
* <img alt="Copy icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-copy-stroke.svg#icon" width="20px" /> **Copy** — Copies the entire ruleset or function to your clipboard.
* <img alt="Search icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-search-stroke.svg#icon" width="20px" /> **Find** — Search for specific strings.

<img src="https://assets.postman.com/postman-docs/v12/api-catalog-ruleset-library-functions-v12-01.png" alt="The Ruleset Library editor menu options" width="450px" />

## Add a custom ruleset

Add a custom OpenAPI ruleset to create a reusable set of rules you define. You can create a ruleset from scratch or use the boilerplate ruleset to help you get started.

To add a custom ruleset, do the following:

1. Click <img alt="Home icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-home-stroke-small.svg#icon" width="16px" /> **Home** in the upper-left corner of the Postman app, then select **API Catalog**.
2. Click **Governance Groups** in the sidebar.
3. Click **Create a ruleset**. Or, select the **Ruleset Library** tab, then click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon" width="20px" /> **Create new** and select **OpenAPI Ruleset**.
4. (Optional) Click the ruleset's filename to rename it. By default, Postman creates a ruleset with a generic name (for example, "new-openapi-ruleset-1").
5. Select the **Definition** tab to edit the ruleset. You can write your ruleset from scratch or use the boilerplate ruleset to help you get started. As you write your ruleset, the editor provides autocompletion and syntax validation.
6. Click **Save** to save your changes.

After you finish creating your ruleset, you can view your rules in the **Documentation** tab. You can then apply your ruleset to any workspace in your team by adding it to a [governance group](/docs/api-catalog/governance-groups/governance-groups/).

## Add a custom function

You can add custom governance functions to use in your rulesets. Postman provides a boilerplate function to help you start writing your custom governance function. You can write your functions using JavaScript and Node.js. The editor provides autocompletion, syntax validation, and save gating to help you write your functions.

To add a custom function, do the following:

1. Click <img alt="Home icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-home-stroke-small.svg#icon" width="16px" /> **Home** in the upper-left corner of the Postman app, then select **API Catalog**.
2. Click **Governance Groups** in the sidebar.
3. Click **Create a function**. Or, select the **Ruleset Library** tab, then click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon" width="20px" /> **Create new** and select **Custom Function**.
4. (Optional) Click the function's filename to rename it. By default, Postman creates a function with a generic name (for example, "new\_custom\_function\_1").
5. Write your function in the editor, following the [custom functions guidelines](/docs/api-governance/configurable-rules/spectral/#spectral-custom-functions).
6. Click **Save** to save changes to your function.

## Delete a function or ruleset

To delete a function or ruleset, do the following:

1. Click <img alt="Options icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-options-stroke.svg#icon" width="20px" /> **More actions** and select **Delete** next to the ruleset or function's name.
2. In the confirmation dialog, click **Delete** to confirm that you want to remove it.

Deleting rulesets and functions removes them permanently and they can't be recovered. Any governance groups that reference removed rulesets or functions will fail to evaluate until the reference is updated.

## Custom governance rule and function guidelines

Postman supports [Spectral](/docs/api-governance/configurable-rules/spectral/) for custom governance rules and functions.

* Learn how to [write custom governance rules using Spectral](/docs/api-governance/configurable-rules/spectral/#how-spectral-works) and configure [Spectral rule properties](/docs/api-governance/configurable-rules/spectral/#spectral-rule-properties).

* Learn how to [write custom governance functions using Spectral](/docs/api-governance/configurable-rules/spectral/#spectral-custom-functions) and use them in your custom governance rules.