Policies Api Reorder Rules

Policies Api Reorder Rules
Reorder a Policy's Rules

The sequence is evaluation-significant. The list must be exactly the Policy's current attached Rule set (RULE_SET_MISMATCH otherwise). Requires the ADMIN or SECURITY_OPERATOR role.

Request
URI
PATCH
https://{api_host}/api/v1/policies/{id}/rules/reorder
COPY
Path Parameters
integer
id
Required  

Policy id

id example
3

Request Body

The ids of the attached Rules in the new order. The list must name exactly the Rules that are attached.

ReorderRulesRequest of type(s) application/json
Required  

Show optional properties

{
    "ruleIdsInOrder": [
        {}
    ]
}
{
    "ruleIdsInOrder": [
        31,
        12,
        7
    ]
}
array of integer
ruleIdsInOrder
Required  

Exactly the Policy's currently attached rule ids in the new order, each once; sequence becomes 1, 2, 3 and so on in this order. Any other set or a repeated id is RULE_SET_MISMATCH; null is RULE_IDS_REQUIRED

Authentication
This operation uses the following authentication methods.
Responses
200

200 OK successful response envelope. The Rules in the new order

[
    {
        "policyId": 3,
        "ruleId": 31,
        "ruleName": "Require MFA for SSH",
        "ruleType": "MFA",
        "action": "MFA_REQUIRED",
        "ruleRank": "CUSTOM_LOCAL",
        "isBuiltIn": false,
        "isEnabled": true,
        "description": "Asks the Production Operators for a second factor",
        "matchData": "{\"user_group_ids\":[1]}",
        "revision": 1,
        "updatedAt": "2026-01-12T08:00:00Z",
        "sequence": 1
    },
    {
        "policyId": 3,
        "ruleId": 12,
        "ruleName": "Block Unapproved Scripts",
        "ruleType": "PATH_FILE_CMD",
        "action": "BLOCK",
        "ruleRank": "CUSTOM_LOCAL",
        "isBuiltIn": false,
        "isEnabled": true,
        "description": "Blocks scripts executed from the temporary directory",
        "matchData": "{\"target_path\":\"/tmp/\",\"match_mode\":\"PREFIX\",\"allowed_ops\":[\"EXECUTE\"],\"is_directory_recursive\":true}",
        "revision": 1,
        "updatedAt": "2026-01-15T09:30:00Z",
        "sequence": 2
    },
    {
        "policyId": 3,
        "ruleId": 7,
        "ruleName": "Audit Shell Spawn",
        "ruleType": "PATH_FILE_CMD",
        "action": "AUDIT",
        "ruleRank": "CUSTOM_LOCAL",
        "isBuiltIn": false,
        "isEnabled": true,
        "description": "Records every shell started by a service account",
        "matchData": "{\"process_path\":\"/bin/sh\",\"match_mode\":\"EXACT\",\"allowed_ops\":[\"EXECUTE\"]}",
        "revision": 1,
        "updatedAt": "2026-01-10T08:00:00Z",
        "sequence": 3
    }
]
array of object
Optional

A Rule attached to a Policy, in evaluation order.


400

400 Bad Request: RULE_IDS_REQUIRED, RULE_SET_MISMATCH or MALFORMED_REQUEST

Returns ApiErrorResponse of type(s) application/json
{
    "errorCode": "string",
    "message": "string",
    "path": "string",
    "timestamp": "string",
    "reason": "string"
}
errorCode
Required  

Stable machine-readable error code. The known values are listed in ApiErrorCode; the set is not closed, so a client must tolerate an unlisted value.

string
message
Required  

Human-readable error description

string
path
Required  

Request URI path that produced the error

string As date-time As date-time
timestamp
Required  

Timestamp when the error occurred as an ISO 8601 date-time with offset

string
reason
Optional

A finer code, present only where an endpoint documents it. The Rule Pack endpoints' PACK_ENTRY_INVALID carries the import core's code here.


401

401 Unauthorized: UNAUTHENTICATED when the VTP_SESSION cookie is missing, unknown, expired or revoked

Returns Unauthenticated of type(s) application/json
{
    "errorCode": "string",
    "message": "string",
    "path": "string",
    "timestamp": "string",
    "reason": "string"
}
errorCode
Required  

Stable machine-readable error code. The known values are listed in ApiErrorCode; the set is not closed, so a client must tolerate an unlisted value.

string
message
Required  

Human-readable error description

string
path
Required  

Request URI path that produced the error

string As date-time As date-time
timestamp
Required  

Timestamp when the error occurred as an ISO 8601 date-time with offset

string
reason
Optional

A finer code, present only where an endpoint documents it. The Rule Pack endpoints' PACK_ENTRY_INVALID carries the import core's code here.


403

403 Forbidden: FORBIDDEN or CSRF_ERROR. CSRF_ERROR when the X-XSRF-TOKEN header is missing or wrong on a POST, PUT, PATCH or DELETE (only POST /api/v1/auth/login is exempt, and a request without a valid session gets 401 UNAUTHENTICATED instead); PASSWORD_CHANGE_REQUIRED when the account must change its password first (only GET /api/v1/auth/session, POST /api/v1/auth/logout and POST /api/v1/auth/change-password are exempt); LICENSE_REQUIRED or LICENSE_EXPIRED while the license pool is restricted (no license, or expired past grace) (exempt: every route under /api/v1/auth, GET /api/v1/user/preferences, GET /api/v1/licensing/summary and POST /api/v1/licensing/licenses)

Returns ApiErrorResponse of type(s) application/json
{
    "errorCode": "string",
    "message": "string",
    "path": "string",
    "timestamp": "string",
    "reason": "string"
}
errorCode
Required  

Stable machine-readable error code. The known values are listed in ApiErrorCode; the set is not closed, so a client must tolerate an unlisted value.

string
message
Required  

Human-readable error description

string
path
Required  

Request URI path that produced the error

string As date-time As date-time
timestamp
Required  

Timestamp when the error occurred as an ISO 8601 date-time with offset

string
reason
Optional

A finer code, present only where an endpoint documents it. The Rule Pack endpoints' PACK_ENTRY_INVALID carries the import core's code here.


404

404 Not Found: POLICY_NOT_FOUND

Returns ApiErrorResponse of type(s) application/json
"ApiErrorResponse Object"
errorCode
Required  

Stable machine-readable error code. The known values are listed in ApiErrorCode; the set is not closed, so a client must tolerate an unlisted value.

string
message
Required  

Human-readable error description

string
path
Required  

Request URI path that produced the error

string As date-time As date-time
timestamp
Required  

Timestamp when the error occurred as an ISO 8601 date-time with offset

string
reason
Optional

A finer code, present only where an endpoint documents it. The Rule Pack endpoints' PACK_ENTRY_INVALID carries the import core's code here.


Code Samples
COPY
                    curl -X PATCH -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"ruleIdsInOrder":["integer"]}'