Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Const

Anonymized branch

Creates a Neon branch containing statically masked data through PostgreSQL Anonymizer. Optional masking rules and automatic anonymization can be supplied in the same request.

How it works

This API operation creates a branch whose copied data is anonymized with PostgreSQL Anonymizer static masking. You can provide initial masking rules and request that anonymization start immediately; the response contains the created branch and restricted actions for anonymized branches.

Syntax

POST /projects/{project_id}/branch_anonymized

Parameters

NameTypeDescription
project_idpath stringThe Neon project containing the new branch.
branchbody objectBranch creation settings, including the branch name and optional parent branch.
masking_rulesbody array, optionalInitial masking rules for the new anonymized branch.
start_anonymizationbody boolean, optionalWhether to start anonymization automatically after creation.

Returns

The created branch object, including restricted_actions that identify operations unavailable for anonymized branches.

Key points

  • The operation copies branch data and applies PostgreSQL Anonymizer static masking to produce an anonymized branch.
  • The resulting branch supports development workflows that need realistic production-derived data without exposing its sensitive values.
  • A creation request may include initial column-masking rules instead of configuring them in a separate request.
  • Set start_anonymization to begin the masking process automatically once the branch is created.
  • The response returns the created branch together with metadata describing operations that are restricted on it.

Example: Create and start an anonymized branch

curl -X POST "https://api.neon.tech/v2/projects/$NEON_PROJECT_ID/branch_anonymized" \
  -H "Authorization: Bearer $NEON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"branch":{"name":"dev-anonymized","parent_id":"br-prod"},"start_anonymization":true}'

Creates an anonymized branch from a production branch and starts masking automatically.

When to use it

Safe development copy

A team needs production-shaped records for local development without exposing sensitive values.

Masked CI environment

A CI pipeline provisions temporary environments from production-derived data.

One-step masked branch setup

A request must define masking behavior and launch anonymization as one operation.

Interview questions

QWhat does the create-anonymized-branch operation do?

The endpoint is POST /projects/{project_id}/branch_anonymized. It creates a branch with anonymized data using PostgreSQL Anonymizer for static masking, optionally accepting masking_rules and start_anonymization.

Follow-up: What happens if fresh production data is required? Create a new anonymized branch from the parent; rerunning masking processes already anonymized data rather than recopying the parent.

QHow can creation be combined with initial masking?

masking_rules lets the request define initial masking rules for the new branch. start_anonymization can then automatically begin anonymization after branch creation.

Follow-up: Which masking mechanism underlies this operation? PostgreSQL Anonymizer applies static masking to the copied branch data.

QWhat operational restrictions should clients handle?

An anonymized branch is intended for development work with masked production-shaped data. The returned branch object includes restricted_actions that identify operations not permitted for anonymized branches, including restore and read-write endpoint deletion.

Follow-up: How should a workflow obtain a new masked snapshot later? Create another anonymized branch from the desired parent instead of trying to reset the existing one.

  • Get anonymization status
  • Get masking rules
  • Update masking rules
  • Start anonymization
  • PostgreSQL Anonymizer
  • restricted_actions

Source: Create anonymized branch - Neon Docs. Checked 2026-10-16.