Skip to main content
POST
Create a Rule

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

ruleset
string
required

Policy Ruleset ID

Body

application/json

CreatePolicyRuleRequestData

policy_role_id
string
required

The Vendor role that users matching this rule should be assigned to.

The role can only be changed if the rule is in a staged state. After a rule is activated, you will need to create a new rule or duplicate this rule to change the role assignment while it is in a staged state

Pattern: ^porol_[0-9a-hjkmnp-tv-z]{26}$
Example:

"porol_01hq8xyzabc123def456ghi789"

description
string | null

A short sentence or two that explains the purpose of this rule (ex. audit justification).

If not set, a description is automatically calculated based on conditions.

You can add additional business data to any key name that you'd like in the metadata array

Maximum string length: 255
Example:

"These users provide administration and support for this backoffice system."

expires_after_days
integer | null

Number of days that users are still a manifest user after being deprecated for a graceful transition.

If not set, the ruleset value is used that may be inherited from the workspace default

Required range: 0 <= x <= 1095
Example:

30

priority
integer | null
default:42

Priority order for evaluating this rule among other rules in the same ruleset.

Lower numbers are evaluated first. Rules with the same priority are evaluated based on the greatest number of users matched (highest to lowest).

Rules for a specific user are always evaluated first (regardless of priority) before other rules to ensure that user-specific elevated roles take precedence.

If not set, the default priority is 42 (obviously...)

Required range: 1 <= x <= 99
Example:

42

metadata
string[]

An array of business and context metadata about this rule.

This is cosemetic only for system administrator reference and provides structured data in API responses

Minimum array length: 1
Example:

"['managed_by' => 'IT Team', 'access_request_id' => '123456', 'compliance_review_months' => 6]"

Response

PolicyRuleDetailedResponseData

id
string
required
Example:

"porul_01hq8xyzabc123def456ghi789"

state
enum<string>
required
Available options:
staged,
active,
expiring,
expired,
deactivated
Example:

"active"

role_name
string
required

The name of the vendor role that users matching this rule are assigned to

Example:

"Group Member"

role_handle
string
required

The shorthand handle of the vendor role that users matching this rule are assigned to

Example:

"member"

is_imported
boolean
required

Whether this rule was automatically created when importing a Directory Attribute from a Workspace Integration. You can filter by false values to see rules that were created by an administrator

description
string | null
required

The description of the rule to provide business justification context. If not set by the user, the condition descriptions are aggregated into the description (if conditions are not a draft)

metadata
string[] | null
required

The rule's custom key/value metadata added by someone or automation in your organization. This is used for business justification, reference IDs, or links to internal issue/tickets for access reviews

expires_after_days
integer | null
required

Users will be automatically deprecated if they no longer qualify for at least one rule in the ruleset.

The expires_after_days value determines how many days after they no longer qualify that they still have access for a graceful transition period when users change job roles.

The value is inherited from the Workspace > Dimension (for Directory Attributes) > Ruleset and can be overridden at any level to provide shorter revoke time controls when needed.

If the value is 0, this skips the grace period and revokes access immediately after expires_at.

By default, users have perpetual access (as Policy Users) as long as their attributes continue to match the conditions for this rule. If this rule is designed for just-in-time or short term access, you can set the expires_at date for all conditional users to be deprecated at that time.

You can use expires_at and expires_after_days=0 together to revoke access immediately

expires_after_days_inherited
boolean
required

Whether this rule expiration was inherited from the ruleset resource or overridden for this rule

priority
integer | null
required

Priority order between 1 and 99 for evaluating this rule among other rules in the same ruleset.

Lower numbers are evaluated first. Rules with the same priority are evaluated based on the greatest number of users matched (highest to lowest).

Rules for a specific user are always evaluated first (regardless of priority) before other rules to ensure that user-specific elevated roles take precedence.

If not set, the default priority is 42 (obviously...)

Example:

42

timestamp
TimestampStateData · object
required

The timestamps for the policy rule record

count
object
required

Count of related resources

included
object
required

Included related resources

API hyperlinks related to the policy rule record