Skip to content
API Now! is currently in closed beta. We are constantly updating these guides as we release updates!

Data Access Rules

API Now! uses an Authorization Engine to evaluate whether an incoming request is allowed to read or write data. Access is governed by Access Rules organized into Access Scenarios that you attach to your API endpoints in the API Modeler.


To prevent redundant configuration, access rules are organized into Access Scenarios that support hierarchical inheritance. An endpoint (action) resolves scenarios from its parent contexts in priority order:

graph TD
    API[1. API Level - Broadest Default Scenarios] -->|Inherited by| Entity[2. Exposed Entity Level Scenarios]
    Entity -->|Inherited by| Action[3. Action Level - Most Specific Scenarios]

When an endpoint receives a request, the authorization engine merges scenarios from all three levels in order of specificity:

Effective Scenarios=Action Scenarios⟶Entity Scenarios⟶API Model Scenarios\text{Effective Scenarios} = \text{Action Scenarios} \longrightarrow \text{Entity Scenarios} \longrightarrow \text{API Model Scenarios}

  • Sequential Fallthrough (“OR ELSE”): Scenarios are evaluated in priority order. The first matching scenario that grants access is executed.
  • Override Parent Scenarios: If an action needs strict security that ignores inherited entity or API-level policies, enable “Override parent scenarios” in the action settings. The engine will evaluate only the scenarios explicitly declared on that action.

Predicate Trees: Combining Rules with AND / OR Logic

Section titled “Predicate Trees: Combining Rules with AND / OR Logic”

Within each Access Scenario, rules are structured as a Recursive Predicate Tree (PredicateGroup) rather than a flat checklist. This allows developers to model arbitrary boolean logic:

  • AND Groups (style: 'and'): All child rules and nested sub-groups must evaluate to true. Used to combine prerequisites (e.g. Allow Authenticated AND Match User Role: admin).
  • OR Groups (style: 'or'): At least one child branch must evaluate to true. Used for alternative access pathways within the same persona (e.g. Match Organization Role OR Match Project Stakeholder).

Automatic SQL Query Generation (FETCH Phase)

Section titled “Automatic SQL Query Generation (FETCH Phase)”

For collection endpoints (List, Search, Restore), the engine translates the scenario’s surviving boolean predicate tree directly into an SQL WHERE clause containing matching AND and OR subqueries. Because filtering is enforced at the database level, SQL pagination totals (meta.total, page, per_page) remain 100% exact.

For a comprehensive guide on predicate trees and the 3-Phase Execution Architecture (PRE_FETCH, FETCH, POST_FETCH), see the Authorization Getting Started Guide.


You can configure several built-in access rules within your scenario predicate trees:

Allows any anonymous client to call the endpoint without logging in.

Allow Public Access Rule Configuration

Allow Authenticated Users (allowAuthenticated)

Section titled “Allow Authenticated Users (allowAuthenticated)”

Restricts access to clients with a valid login session.

Allow Authenticated Users Rule Configuration

Restricts access to users holding specific permission roles (e.g., ['admin'] or ['manager']).

Match User Role Rule Configuration

Restricts access to the specific user who owns the record via a direct relationship tagged with ResourceOwnerIdentifier. For list actions, it automatically injects WHERE owner_id = :userId.

Match Resource Owner Rule Configuration

Match Relational Resource Owner (relationalResourceOwner)

Section titled “Match Relational Resource Owner (relationalResourceOwner)”

Enforces URL-anchored inherited ownership when child records belong to a parent container owned by the user (e.g. /documents/:documentId/attachments/:attachmentId).

Checks user membership and roles within a specific Project container defined by ProjectMembers.

Match Project Stakeholder (matchProjectStakeholder)

Section titled “Match Project Stakeholder (matchProjectStakeholder)”

A compound rule granting access if the caller is the direct owner OR an explicit member of the project. Generates (owner_id = :userId OR EXISTS (SELECT 1 FROM project_members ...)).

Match Organization Role (matchOrganizationRole)

Section titled “Match Organization Role (matchOrganizationRole)”

Restricts access to active members of an organization container, optionally validating member roles (e.g. ['owner', 'admin']).

Restricts access to users whose authenticated email address belongs to specific domains (e.g., ["company.com"]).

Match Email Domain Rule Configuration

Match Resource Attribute (matchResourceAttribute)

Section titled “Match Resource Attribute (matchResourceAttribute)”

Restricts access based on a property value on the resource itself (e.g. status equal 'published'). Supports standard comparison operators: equal, notEqual, in, notIn, greaterThan, etc.

Match Resource Attribute Rule Configuration

A specialized rule for entities utilizing Status Semantics, specifying allowedStatuses or deniedStatuses (e.g. preventing access to "Draft" records).

Lifecycle Status Rule Configuration

Verifies that a route parameter in the URL path matches an attribute from the caller’s authenticated session.


Explore real-world examples and multi-persona patterns in the Authorization Getting Started Guide.