copying-flags-across-projects

Copies a PostHog feature flag from one project to multiple target projects in the same organization.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill copying-flags-across-projects
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: copying-flags-across-projects
Source: https://github.com/PostHog/posthog-foss/tree/main/products/feature_flags/skills/copying-flags-across-projects
Command: npx skills add https://github.com/PostHog/posthog-foss --skill copying-flags-across-projects

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teams using PostHog projects as environments need a safe way to duplicate a feature flag from one project (e.g. staging) into one or more other projects (e.g. production) without manually recreating filters, variants, and cohort references.

Core Features & Use Cases

  • Cross-project flag copy: Duplicates a single feature flag into up to 50 target projects in the same organization, with per-target success and failure reporting.
  • Safe defaults: Copies land disabled in the target and exclude scheduled changes unless the user explicitly opts in.
  • Automatic cohort remapping: Cohort references in flag filters are recreated or reused in each target project and rewritten automatically.
  • Use Case: Promote the new-checkout flag from a staging project to production, previewing its rollout percentage and filters first, then enabling it in the target on confirmation.

Quick Start

Copy the new-checkout feature flag from project 12345 to project 67890, keeping it disabled in the target until I confirm.

Frequently Asked Questions about copying-flags-across-projects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I copy a feature flag to another PostHog project?

Use the posthog:feature-flags-copy-flags-create endpoint with the flag key, source project id, and a list of target project ids. By default the copied flag lands disabled in the target and scheduled changes are not copied unless you opt in.

How do I promote a feature flag from staging to production in PostHog?

Copy the flag from the staging project to the production project, then set disable_copied_flag to false if you want it enabled immediately. Preview the source flag's filters and rollout percentage first to confirm what will be replicated.

Can I copy a feature flag across different PostHog organizations?

No, cross-organization copy is not supported. The endpoint requires the source and all target projects to belong to the same organization, and targets outside your visibility are silently dropped.

What happens to cohorts when copying a feature flag between projects?

Cohorts referenced in the flag's filters are remapped automatically. The endpoint creates or reuses an equivalent cohort in each target project and rewrites the flag's filters to point at the new target-project cohort id.

Why does the feature flag copy fail with a permission error?

The API key must include an explicit feature_flag:write or feature_flag:* scope; a wildcard-only key is rejected. You also need editor-level access on the source team, and targets lacking edit rights appear in the failed array.

Does copying a feature flag overwrite an existing flag in the target project?

Yes, copying creates a new flag in the target or overwrites an existing flag with the same key, and there is no undo. Always confirm with the user before copying, especially into production projects.