curl --request POST \
--url https://{host}/api/policy/v2/policies/rule/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"actions": [
"tools/call:create_issue"
],
"name": "Engineering read access",
"description": "<string>",
"authorized": false,
"active": true,
"roles_groups": [
"*"
],
"condition": {
"match": {
"expr": "P.attr.department == 'Engineering'"
}
}
}
EOFimport requests
url = "https://{host}/api/policy/v2/policies/rule/validate"
payload = {
"actions": ["tools/call:create_issue"],
"name": "Engineering read access",
"description": "<string>",
"authorized": False,
"active": True,
"roles_groups": ["*"],
"condition": { "match": { "expr": "P.attr.department == 'Engineering'" } }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actions: ['tools/call:create_issue'],
name: 'Engineering read access',
description: '<string>',
authorized: false,
active: true,
roles_groups: ['*'],
condition: {match: {expr: 'P.attr.department == \'Engineering\''}}
})
};
fetch('https://{host}/api/policy/v2/policies/rule/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/policy/v2/policies/rule/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'actions' => [
'tools/call:create_issue'
],
'name' => 'Engineering read access',
'description' => '<string>',
'authorized' => false,
'active' => true,
'roles_groups' => [
'*'
],
'condition' => [
'match' => [
'expr' => 'P.attr.department == \'Engineering\''
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/policy/v2/policies/rule/validate"
payload := strings.NewReader("{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/policy/v2/policies/rule/validate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/policy/v2/policies/rule/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Validate Rule
Validate a single policy rule for correctness.
Validates CEL expression syntax, undefined variables, action format, and role/group format. Returns 204 No Content if valid, or 422 with Pydantic validation errors if invalid.
curl --request POST \
--url https://{host}/api/policy/v2/policies/rule/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"actions": [
"tools/call:create_issue"
],
"name": "Engineering read access",
"description": "<string>",
"authorized": false,
"active": true,
"roles_groups": [
"*"
],
"condition": {
"match": {
"expr": "P.attr.department == 'Engineering'"
}
}
}
EOFimport requests
url = "https://{host}/api/policy/v2/policies/rule/validate"
payload = {
"actions": ["tools/call:create_issue"],
"name": "Engineering read access",
"description": "<string>",
"authorized": False,
"active": True,
"roles_groups": ["*"],
"condition": { "match": { "expr": "P.attr.department == 'Engineering'" } }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actions: ['tools/call:create_issue'],
name: 'Engineering read access',
description: '<string>',
authorized: false,
active: true,
roles_groups: ['*'],
condition: {match: {expr: 'P.attr.department == \'Engineering\''}}
})
};
fetch('https://{host}/api/policy/v2/policies/rule/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/policy/v2/policies/rule/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'actions' => [
'tools/call:create_issue'
],
'name' => 'Engineering read access',
'description' => '<string>',
'authorized' => false,
'active' => true,
'roles_groups' => [
'*'
],
'condition' => [
'match' => [
'expr' => 'P.attr.department == \'Engineering\''
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/policy/v2/policies/rule/validate"
payload := strings.NewReader("{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/policy/v2/policies/rule/validate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/policy/v2/policies/rule/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actions\": [\n \"tools/call:create_issue\"\n ],\n \"name\": \"Engineering read access\",\n \"description\": \"<string>\",\n \"authorized\": false,\n \"active\": true,\n \"roles_groups\": [\n \"*\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"P.attr.department == 'Engineering'\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Scopes
Body
A single rule: which principals may take which tool actions, optionally conditioned.
Tool actions this rule matches, in the wire format tools/call:<tool_name> — for example tools/call:create_issue. Use * to match every action on the server. Tool names are specific to the target MCP server: enumerate the server's real tools rather than guessing names. A trailing :approve selects the Needs-Approval variant of a tool (tools/call:create_issue:approve), which requires per-call human confirmation; the plain action is Always Allow. Do not grant both twins of the same tool in one rule.
["tools/call:create_issue"]
["tools/call:delete_page:approve"]
["*"]
Optional display name for the rule. Letters, digits, spaces, hyphens and underscores only — a colon or other punctuation is rejected with a 422, which is easy to hit because rule names tend to read like Security: view agents. Names must also be unique within the policy once punctuation is normalized, so My Rule and My-Rule collide.
"Engineering read access"
Effect of the rule: True grants the listed actions, False denies them. Access is denied by default, so a tool that no rule grants is already blocked — an explicit False rule is only needed to carve an exception out of a broader allow. The effective model is tri-state rather than binary: Always Allow is True on the plain action, Needs Approval is True on the :approve twin (see actions), and Blocked is simply the absence of a grant.
Principals this rule applies to, as PREFIXED entries: role:<role_name> for an IdP/Keycloak role, group:<group_name> for a user group, or the literal * for all users (the default). A bare name with no role:/group: prefix matches NOTHING. Retrieve the organization's real role and group names from GET /api/identity/public/v1/users/roles-groups. A principal set should appear on at most ONE rule in a policy — collect all of its actions there instead of spreading them over several rules.
["*"]
["group:Engineering"]
["role:admin", "group:Platform"]
Response
Successful Response