Replay recorded agent traffic against a policy
Replays the project's recorded agent audit traffic against a candidate policy (either a draft supplied inline or an existing policy referenced by id) and reports what would change: which queries that ran would now be blocked, which blocked queries would now be permitted, and which results would be masked or row-filtered. Traffic is deduplicated by normalized query shape, newest first, and every statement is evaluated through the data plane's own policy engine, so the verdicts match real enforcement. Stateful checks (budgets, approvals, write-mode routing) are reported as informational notes on each result, not verdicts. This endpoint reads only the audit log; it never connects to the upstream database and persists nothing.
JWT issued by Better Auth. Verified via JWKS.
In: header
Path Parameters
Unique project identifier (prefixed, e.g. prj_xxx).
^[a-zA-Z0-9_.-]+$Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A window of recorded agent traffic to replay plus the candidate policy to replay it against. Supply exactly one of policy_id (an existing saved policy) or policy (an unsaved draft, e.g. the in-progress editor form).
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/projects/string/policy-replays" \ -H "Content-Type: application/json" \ -d '{}'{ "summary": { "entries_scanned": 0, "distinct_queries": 0, "evaluated": 0, "would_allow": 0, "would_block": 0, "would_mask": 0, "would_row_filter": 0, "newly_blocked": 0, "newly_allowed": 0, "skipped_unparseable": 0, "truncated": true }, "items": [ { "query_hash": "string", "sql": "string", "statement_kind": "string", "occurrences": 0, "first_seen": "2019-08-24T14:15:22Z", "last_seen": "2019-08-24T14:15:22Z", "recorded_event": "string", "recorded_rule": "string", "change": "newly_blocked", "result": { "verdict": "allow", "rule": "ok", "reason": "string", "hint": "string", "masked_columns": [ { "column": "email", "kind": "redact" } ], "row_filter_predicate": "tenant_id = current_setting('pgbeam.tenant')", "rewritten_sql": "string", "notes": [ "string" ] } } ]}{ "error": { "code": "string", "message": "string" }}{ "error": { "code": "string", "message": "string" }}{ "error": { "code": "string", "message": "string" }}{ "error": { "code": "string", "message": "string" }}{ "error": { "code": "string", "message": "string" }}