API ReferencePolicy
Simulate & Evaluate
Dry-run a policy against a synthetic context, or live-evaluate the active policy stack.
RPCs
| Method | Path |
|---|---|
| SimulatePolicy | POST /v1/policies/{id}:simulate |
| EvaluatePolicy | POST /v1/policies:evaluate |
Base URL: https://<Domain id="api"/>
Authentication: Bearer token with policy:read.
Simulate -- test one policy
Returns whether a given policy would fire for a synthetic context. Use in policy authoring to avoid deploying a rule that silently matches every login.
const res = await fetch(
`https://api-id.avnology.net/v1/policies/${policyId}:simulate`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AVNOLOGY_API_KEY}`
body := strings.NewReader(`{
"context":{"identity_id":"usr_4f18acec","ip":"198.51.100.42","groups":["admins"]}
}`)
req, _ := http.NewRequest("POST",
"https://api-id.avnology.net/v1/policies/"+import httpx, os
httpx.post(
f"https://api-id.avnology.net/v1/policies/{policy_id}:simulate",
json={
"context": {
"identity_id": "usr_4f18acec",
curl -X POST "https://api-id.avnology.net/v1/policies/pol_01H7X:simulate" \
-H "Authorization: Bearer $AVNOLOGY_API_KEY" \
const res = await fetch(
`https://api-id.avnology.net/v1/policies/${policyId}:simulate`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AVNOLOGY_API_KEY}`
body := strings.NewReader(`{
"context":{"identity_id":"usr_4f18acec","ip":"198.51.100.42","groups":["admins"]}
}`)
req, _ := http.NewRequest("POST",
"https://api-id.avnology.net/v1/policies/"+import httpx, os
httpx.post(
f"https://api-id.avnology.net/v1/policies/{policy_id}:simulate",
json={
"context": {
"identity_id": "usr_4f18acec",
curl -X POST "https://api-id.avnology.net/v1/policies/pol_01H7X:simulate" \
-H "Authorization: Bearer $AVNOLOGY_API_KEY" \
const res = await fetch(
`https://api-id.avnology.net/v1/policies/${policyId}:simulate`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AVNOLOGY_API_KEY}`
body := strings.NewReader(`{
"context":{"identity_id":"usr_4f18acec","ip":"198.51.100.42","groups":["admins"]}
}`)
req, _ := http.NewRequest("POST",
"https://api-id.avnology.net/v1/policies/"+import httpx, os
httpx.post(
f"https://api-id.avnology.net/v1/policies/{policy_id}:simulate",
json={
"context": {
"identity_id": "usr_4f18acec",
curl -X POST "https://api-id.avnology.net/v1/policies/pol_01H7X:simulate" \
-H "Authorization: Bearer $AVNOLOGY_API_KEY" \
const res = await fetch(
`https://api-id.avnology.net/v1/policies/${policyId}:simulate`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AVNOLOGY_API_KEY}`
body := strings.NewReader(`{
"context":{"identity_id":"usr_4f18acec","ip":"198.51.100.42","groups":["admins"]}
}`)
req, _ := http.NewRequest("POST",
"https://api-id.avnology.net/v1/policies/"+import httpx, os
httpx.post(
f"https://api-id.avnology.net/v1/policies/{policy_id}:simulate",
json={
"context": {
"identity_id": "usr_4f18acec",
Evaluate -- run the full stack
POST /v1/policies:evaluate runs every active policy against a live context and returns the first matching effect, or ALLOW if none match. Use in a webhook or your own middleware when you need policy decisions outside the built-in auth flow.
Response:
{
"matched_policy_id": "pol_01H7X3K9Q1",
"effect": "REQUIRE_MFA",
"reasons": [
"condition user_group matched: admins",
"condition network matched: not in 10.0.0.0/8"
]
}