Rules

Create custom rule

Create a natural language security rule. Only name and rule are required — all other fields are optional. Rules apply org-wide by default. Pass repositoryIds to restrict the rule to specific repos, or pass tagIds without repositoryIds to scope the rule to repositories carrying those tags. Use allRepositories: true when you want org-wide scope while also associating tags.

post/api/v2/rules/create

Request

  • Base URL
    https://zeropath.com
  • Auth
    API key in header X-ZeroPath-API-Token-Id and API key in header X-ZeroPath-API-Token-Secret

Request body

organizationIdstring
namestring required

Name for the custom rule

rulestring required

Natural language description of the security rule

globPatternstring

Glob pattern for files this rule applies to

sourceTypesstring[]

Source types this rule applies to

repositoryIdsstring[]

Optional. Repository IDs to restrict this rule to. When omitted, the rule applies to ALL repositories in the organization. You do not need to look up repositories first.

allRepositoriestrue

Set to true to make the rule apply to all repositories, including when tagIds are also supplied.

scope'allRepositories' | 'repositories' | 'tags'

Optional explicit scope. Use tags with tagIds to apply the rule only to repositories carrying those tags.

tagIdsstring[]

Optional. Tag IDs to scope or associate with this rule. On create, tagIds without repositoryIds/allRepositories create a tag-scoped rule.

Response

Rule created successfully

idstring required
namestring required
rulestring required

Natural language description of the security rule

globPatternstring required
sourceTypesstring[] required
source'USER' | 'SECURITY_COMPASS'
repositoryIdsstring[] required
scope'allRepositories' | 'repositories' | 'tags' required
createdAtstring date-time required
updatedAtstring date-time required

Changes

No recorded changes to this operation across all 1 revision of this API.