PgBeam Docs
Policies

createPolicyProfile

Create a policy profile

Creates a policy profile that can be attached to agent credentials.

Usage

const result = await api.policies.createPolicyProfile({
  pathParams: { project_id: "prj_xxx" },
  body: {
    name: "...",
  },
});

Parameters

ParameterTypeRequiredDescription
pathParams.project_idstringYesUnique project identifier (prefixed, e.g. prj_xxx).
body.namestringYesHuman-readable name for the policy profile.
body.access_mode"read_only" | "read_write"Noread_only blocks all data and schema mutations.
body.statement_rulesStatementRulesNo
body.table_allowliststring[]NoIf non-empty, only these relations are reachable.
body.table_denyliststring[]NoRelations explicitly blocked.
body.masking_rulesMaskingRule[]NoColumn masking rules applied to query results.
body.budget_queries_per_hournumberNoMax queries per rolling hour window. 0 means unlimited.
body.budget_queries_per_daynumberNoMax queries per day window. 0 means unlimited.
body.max_rowsnumberNoMax rows returned per query. 0 means unlimited.
body.statement_timeout_msnumberNoUpstream statement timeout for agent sessions. 0 uses the project default.
body.row_filtersRowFilter[]NoPer-relation row filters ANDed into agent reads.
body.write_mode"normal" | "rollback" | "sandbox"NoHow writes are handled. normal commits, rollback auto-rolls back, sandbox routes to an ephemeral branch.
body.approval_mode"off" | "writes" | "ddl" | "all"NoWhich statement classes require human approval before execution.
body.approval_auto_max_rowsnumberNoStatements touching at most this many rows are auto-approved. 0 means none.
body.approval_timeout_secondsnumberNoHow long a held statement waits for a decision before expiring.
body.migration_safety"off" | "warn" | "block"NoMigration safety mode. warn surfaces findings, block refuses unsafe DDL.
body.egress_bytes_per_daynumberNoPer-day egress budget in bytes. 0 means unlimited.

Response

Promise<PolicyProfile> — policy profile created.

Example

import { PgBeamClient } from "pgbeam";

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

const result = await client.api.policies.createPolicyProfile({
  pathParams: { project_id: "prj_xxx" },
  body: {
    name: "...",
  },
});

Errors

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

On this page