PgBeam Docs
Policies

dryEvalPolicy

Dry-eval a policy against a SQL statement

Evaluates a single SQL statement against a policy — either a draft policy supplied inline or an existing policy referenced by id — and returns the decision the proxy would make: allow, block, mask, or row-filter. The evaluation reuses the data plane's own policy engine (the same parser, allow/block rules, row-filter rewriter, and masking analysis enforced on live agent sessions), so a what-if verdict matches real enforcement. Stateful checks a single-statement preview cannot model — per-region query and egress budgets, human approvals, and rollback/sandbox write routing — are reported as informational notes, not verdicts. This is a pure compute endpoint; it does not connect to the upstream database and persists nothing.

Usage

const result = await api.policies.dryEvalPolicy({
  pathParams: { project_id: "prj_xxx" },
  body: {
    sql: "SELECT email FROM users WHERE id = 1",
  },
});

Parameters

ParameterTypeRequiredDescription
pathParams.project_idstringYesUnique project identifier (prefixed, e.g. prj_xxx).
body.sqlstringYesThe single SQL statement to evaluate.
body.policy_idstringNoID of an existing saved policy profile to evaluate against.
body.policyPolicyProfileInputNo

Response

Promise<DryEvalResult> — the dry-eval decision.

Example

import { PgBeamClient } from "pgbeam";

const client = new PgBeamClient({
  token: "pbk_...",
  baseUrl: "https://api.pgbeam.com",
});

const result = await client.api.policies.dryEvalPolicy({
  pathParams: { project_id: "prj_xxx" },
  body: {
    sql: "SELECT email FROM users WHERE id = 1",
  },
});

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page