Create Policy

Creates a new security, license, or operational risk policy. A policy contains rules that define criteria for matching issues and actions to take when issues are found (e.g., block downloads, fail builds, send notifications). Once created, assign the policy to one or more watches using the Assign Policy to Watches endpoint.

Requires the "Manage Policies" role to be set on the User or Group level. For Xray version 3.21.2 and above with Projects, a Project Admin with Manage Security Assets privilege can create policies in the scope of a project by using the additional query parameter projectKey.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string

When provided, the policy is created in the scope of the specified project. Requires Xray 3.21.2+ with Projects enabled.

Body Params

Request body for creating or updating a policy. A policy defines rules that determine how Xray identifies and acts on issues found during scanning. Each policy has a type (security, license, or operational_risk) and contains one or more rules. Each rule has criteria (what to match) and actions (what to do when matched).

string
required

Name of the policy. Must be unique across the system (or within a project when using projectKey).

string

Optional free-text description of the policy.

string
enum
required

The policy type. Determines which criteria fields are available in the rules.

Allowed:
rules
array of objects
required

One or more rules that define the policy behavior. Each rule specifies criteria to match and actions to take when matched.

rules*
Responses

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json