PgBeam Docs
Databases

Scan a database for likely-PII columns

POST
/v1/projects/{project_id}/databases/{database_id}/scan-pii

Connects to the upstream database read-only, inspects information_schema and samples column values against PII heuristics, and returns ranked masking suggestions. Suggestions are advisory — the operator reviews them and applies the ones they want into a policy profile's masking rules. Nothing is auto-applied.

Authorization

AuthorizationBearer <token>

JWT issued by Better Auth. Verified via JWKS.

In: header

Path Parameters

project_id*string

Unique project identifier (prefixed, e.g. prj_xxx).

database_id*string

Unique database identifier (prefixed, e.g. db_xxx).

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/databases/string/scan-pii"
{  "scanned_tables": 0,  "scanned_columns": 0,  "suggestions": [    {      "schema": "public",      "table": "users",      "column": "email",      "data_type": "text",      "pii_type": "email",      "mask_kind": "redact",      "confidence": 0.95,      "reasons": [        "column name matches 'email'",        "8/10 sampled values look like emails"      ],      "sample_match_count": 0,      "sample_size": 0    }  ],  "truncated": true,  "error": "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"  }}