Skip to main content
POST
Simulate an NQL query against access rules

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
nql
string
required

The statement to check: a SELECT, including WITH and UNION selects, or a MERGE into one of the caller's datasets. INSERT, UPDATE and DELETE cannot read access rules, so they, CREATE MATERIALIZED VIEW and EXPLAIN return 422.

The statement runs as the caller's company, in the role of a buyer. It reads a listed access rule as <placeholder_owner_slug>.<access_rule_name>, or through narrative.rosetta_stone. It reads the caller's own datasets only through company_data: by id, by name, or through company_data.rosetta_stone. The caller's own slug is not a namespace in a simulation.

data_plane_id
string<uuid>
required

The data plane the statement is compiled for. Every listed access rule, stored or inline, must be on this data plane, and the statement reads the caller's datasets only from it.

context
object
required

The access rules the statement runs against. Apart from the caller's own datasets, the statement sees only these access rules.

Response

The statement compiled. denied_access_rules can be empty, which means no listed access rule denied the statement. A listed access rule that is not in denied_access_rules was not denied by its policy: it allowed the query or no table in the query reached it.

The access rules whose query policy denied the statement. A listed access rule that is not in denied_access_rules was not denied: its policy allowed the statement, or the statement did not read it.

denied_access_rules
object[]
required

One entry per access rule and query table it was denied on, in the order of context.access_rules. When the statement reads the same table more than once, such as in a self-join, each read that is denied has its own entry.

An access rule denied on one query table. Set access_rule_id for a stored access rule and access_rule_name for an inline one.