PlatformXeDocs
Get API Key

Resource Policies

Standalone ABAC policies with condition operators and logic combinators.

Resource policies provide attribute-based access control (ABAC) independent of roles. Each policy defines conditions that are evaluated against the resource and request context at check time.

Policy structure

A resource policy consists of:

FieldDescription
nameHuman-readable label
resourceThe resource path this policy applies to
actionThe action this policy governs
effectALLOW or DENY
priorityInteger — lower numbers evaluated first
conditionsJSON condition tree using operators and combinators

Policies are evaluated in priority order. Deny always wins — if any matching policy denies, the result is deny regardless of other policies.

Condition operators

OperatorExample
equalsresource.status equals "published"
notEqualsresource.type notEquals "draft"
inactor.department in ["finance", "accounting"]
notInactor.role notIn ["intern"]
gt / gteresource.amount gt 1000
lt / ltecontext.hour lt 18
containsresource.tags contains "urgent"
startsWithresource.path startsWith "/public"
endsWithresource.name endsWith ".pdf"
existsresource.approvedBy exists true

Logic combinators

Combine conditions with all (AND), any (OR), and not:

{
  "all": [
    { "field": "resource.ownerId", "operator": "equals", "value": "actor.id" },
    { "any": [
      { "field": "resource.status", "operator": "equals", "value": "draft" },
      { "field": "resource.status", "operator": "equals", "value": "review" }
    ]},
    { "not": {
      "field": "actor.suspended", "operator": "equals", "value": true
    }}
  ]
}

This reads: allow if the actor owns the resource AND the status is draft or review AND the actor is not suspended.

Creating a policy

curl -X POST https://api.platformxe.com/api/v1/permissions/policies \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "name": "Owners can update own resources",
    "resource": "documents",
    "action": "update",
    "effect": "ALLOW",
    "priority": 10,
    "conditions": {
      "all": [
        { "field": "resource.ownerId", "operator": "equals", "value": "actor.id" }
      ]
    }
  }'

Resource policies are evaluated after overrides and role capabilities in the permission check pipeline. See the Condition Language reference for the full operator specification.