For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Postman
PricingEnterprise
Contact SalesSign InSign Up for Free
HomeDocs
HomeDocs
      • Overview
      • Onboarding checklist
      • Roles and permissions
      • System service accounts
      • Free and Solo experience
      • Team migration
        • Overview
        • Enterprise plans
        • Enterprise onboarding
        • Enterprise deployment
        • Account discovery and control
        • Organizations
        • Migrate to organizations
        • Postman EU Data Residency
          • Overview
            • Overview
            • API Governance rules
            • Custom governance functions
            • Spectral
      • Admin FAQs
Postman API Platform

Product

  • Postman Overview
  • Enterprise
  • Spec Hub
  • Flows
  • Agent Mode
  • API Catalog
  • Fern
  • Postman CLI
  • Integrations
  • Workspaces
  • Plans and pricing

API Network

  • App Security
  • Artificial Intelligence
  • Communication
  • Data Analytics
  • Database
  • Developer Productivity
  • DevOps
  • Ecommerce
  • eSignature
  • Financial Services
  • Payments
  • Travel

Resources

  • Postman Docs
  • Academy
  • Community
  • Templates
  • Intergalactic
  • Videos
  • MCP Servers

Legal and Security

  • Legal Terms Hub
  • Terms of Service
  • Postman Product Terms
  • Security
  • Website Terms of Use

Company

  • About
  • Careers and culture
  • Contact us
  • Partner program
  • Customer stories
  • Student programs
  • Press and media
Twitter iconLinkedIn iconGithub iconYouTube iconInstagram iconDiscord icon
Download Postman
Privacy Policy

© 2026 Postman, Inc.

On this page
  • Add a custom function
  • Add a custom function to a custom rule
  • View custom rules that use a custom function
  • Edit a custom function
  • Remove a custom function
Administer PostmanPostman EnterpriseAPI GovernanceConfigurable rules

Create custom governance functions in Postman

||View as Markdown|
Was this page helpful?
Previous

Configure API Governance rules in Postman

Next

Define custom governance rules using Spectral

Built with

API Governance custom functions are available with Postman Enterprise plans. If you don’t have an Enterprise account, you’ll be able to see the API Governance page, but you won’t be able to configure custom functions.

You can create custom governance functions and use them in your custom API Governance rules that Postman applies to API specifications in Spec Hub.

Super Admins and API Governance Managers can manage custom governance functions for their team.

Create custom API Governance function

Add a custom function

You can add custom governance functions to use in your custom API Governance rules. Postman provides you with a boilerplate function to help you start writing your custom governance function. You must write custom functions in JavaScript using ES6 syntax or CommonJS syntax.

To access the configurable API Governance rules, do the following:

  1. Click Home icon Home in the upper-left corner of the Postman app, then select API icon API Catalog.

  2. Click Docs icon Governance Groups.

  3. Select the Rule Library tab, then select the Functions tab.

  4. Click Create Function.

  5. Name the function’s file, then write the function in the editor. It must adhere to custom functions guidelines.

    Postman prompts you with suggestions as you enter text. Select one to autocomplete your code.

  6. Click Create.

    New custom API Governance function

Add a custom function to a custom rule

To add a custom function to a custom API Governance rule, add a custom function, then begin the steps to add a custom rule.

Add the then.function property to the rule, and add the custom function’s filename as its value to use it in your rule (for example, function: custom_function_name). If your custom function accepts options, add the then.functionOptions property. Learn more about Spectral rule properties and Spectral custom functions.

Then click Create to create a custom rule that uses a custom function.

View custom rules that use a custom function

You can view the custom rules a custom function is used in.

  1. Select the Rule Library tab, then select the Functions tab.
  2. Click a custom function in the Name column. To view only the number of custom rules each custom function is used in, you can review the values in the Used In column.
  3. Click Rules affected by this function to expand the custom rules your custom function is used in. You can click an affected rule’s name to view it in a new tab.

Edit a custom function

  1. Select the Rule Library tab, then select the Functions tab.
  2. Click a custom function in the Name column.
  3. Edit the function, then click Save.

Remove a custom function

To remove a custom API Governance function, you must remove the API Governance rules that use the custom function. Then click Delete icon Delete next to the custom function’s filename.

Delete a custom API Governance function