• Product
  • Pricing
  • Docs
  • Using PostHog
  • Community
  • Company
  • Login
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • EU Hosting Companies
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Debug hanging / freezing process
          • Horizontal scaling (Sharding & replication)
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Support for self-hosting (open-source and enterprise)
    • Managing hosting costs
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Library comparison
    • Badge
    • Browser Extensions
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Node.js
      • Go
      • Python
      • Rust
      • Java
      • PHP
      • Ruby
      • Elixir
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • To PostHog Cloud EU
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • Developer reference
    • Using the PostHog API
    • Jobs
    • Testing
    • TypeScript types
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Glossary
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • EU Hosting Companies
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Debug hanging / freezing process
          • Horizontal scaling (Sharding & replication)
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Support for self-hosting (open-source and enterprise)
    • Managing hosting costs
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Library comparison
    • Badge
    • Browser Extensions
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Node.js
      • Go
      • Python
      • Rust
      • Java
      • PHP
      • Ruby
      • Elixir
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • To PostHog Cloud EU
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • Developer reference
    • Using the PostHog API
    • Jobs
    • Testing
    • TypeScript types
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Glossary
  • Docs
  • API
  • Feature flags

Feature

For instructions on how to authenticate to use this endpoint, see API overview.

Create, read, update and delete feature flags. See docs for more information on feature flags.

If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.

Endpoints

    GET/api/projects/:project_id/feature_flags/
    POST/api/projects/:project_id/feature_flags/
    GET/api/projects/:project_id/feature_flags/:id/
    PATCH/api/projects/:project_id/feature_flags/:id/
    DELETE/api/projects/:project_id/feature_flags/:id/
    GET/api/projects/:project_id/feature_flags/:id/activity/
    GET/api/projects/:project_id/feature_flags/activity/
    GET/api/projects/:project_id/feature_flags/evaluation_reasons/
    GET/api/projects/:project_id/feature_flags/local_evaluation/
    GET/api/projects/:project_id/feature_flags/my_flags/

    List all feature flags

    Path Parameters

    • project_id
      string

    Query Parameters

    • limit
      integer
    • offset
      integer

    Response


    Request

    GET /api/projects/:project_id/feature_flags
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/

    Response

    RESPONSE
    {
    "count": 123,
    "next": "http://api.example.org/accounts/?offset=400&limit=100",
    "previous": "http://api.example.org/accounts/?offset=200&limit=100",
    "results": [
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }
    ]
    }

    Create feature flags

    Path Parameters

    • project_id
      string

    Request Parameters

    • name
      string

      contains the description for the flag (field name name is kept for backwards-compatibility)

    • key
      string
    • filters
      object
    • deleted
      boolean
    • active
      boolean
    • created_at
      string
    • ensure_experience_continuity
      boolean
    • rollback_conditions
      object
    • performed_rollback
      boolean

    Response


    Request

    POST /api/projects/:project_id/feature_flags
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl
    -H 'Content-Type: application/json'\
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/\
    -d key="string"

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Retrieve feature flags

    Path Parameters

    • id
      integer
    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/:id
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/:id/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Update feature flags

    Path Parameters

    • id
      integer
    • project_id
      string

    Request Parameters

    • name
      string

      contains the description for the flag (field name name is kept for backwards-compatibility)

    • key
      string
    • filters
      object
    • deleted
      boolean
    • active
      boolean
    • created_at
      string
    • ensure_experience_continuity
      boolean
    • rollback_conditions
      object
    • performed_rollback
      boolean

    Response


    Request

    PATCH /api/projects/:project_id/feature_flags/:id
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl -X PATCH \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/:id/\
    -d name="string"

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Delete feature flags

    Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

    Path Parameters

    • id
      integer
    • project_id
      string

    Request

    DELETE /api/projects/:project_id/feature_flags/:id
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl -X DELETE \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/:id/

    Response

    No response

    Retrieve feature flags activity retrieve

    Path Parameters

    • id
      integer
    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/:id/activity
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/:id/activity/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Retrieve feature flags activity

    Path Parameters

    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/activity
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/activity/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Retrieve feature flags evaluation reasons

    Path Parameters

    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/evaluation_reasons
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/evaluation_reasons/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Retrieve feature flags local evaluation

    Path Parameters

    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/local_evaluation
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/local_evaluation/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Retrieve feature flags my flags

    Path Parameters

    • project_id
      string

    Response


    Request

    GET /api/projects/:project_id/feature_flags/my_flags
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    https://app.posthog.com/api/projects/:project_id/feature_flags/my_flags/

    Response

    RESPONSE
    {
    "id": 0,
    "name": "string",
    "key": "string",
    "filters": {
    "property1": null,
    "property2": null
    },
    "deleted": true,
    "active": true,
    "created_by": {
    "id": 0,
    "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
    "distinct_id": "string",
    "first_name": "string",
    "email": "user@example.com"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "is_simple_flag": true,
    "rollout_percentage": 0,
    "ensure_experience_continuity": true,
    "experiment_set": [
    0
    ],
    "rollback_conditions": {
    "property1": null,
    "property2": null
    },
    "performed_rollback": true
    }

    Questions?

    Was this page useful?

    • Product

    • Overview
    • Pricing
    • Product analytics
    • Session recording
    • A/B testing
    • Feature flags
    • Apps
    • Customer stories
    • PostHog vs...
    • Docs

    • Quickstart guide
    • Self-hosting
    • Installing PostHog
    • Building an app
    • API
    • Webhooks
    • How PostHog works
    • Data privacy
    • Using PostHog

    • Product manual
    • Apps manuals
    • Tutorials
    • Community

    • Questions?
    • Product roadmap
    • Contributors
    • Partners
    • Newsletter
    • Merch
    • PostHog FM
    • PostHog on GitHub
    • Handbook

    • Getting started
    • Company
    • Strategy
    • How we work
    • Small teams
    • People & Ops
    • Engineering
    • Product
    • Design
    • Marketing
    • Customer success
    • Company

    • About
    • Team
    • Investors
    • Press
    • Blog
    • FAQ
    • Support
    • Careers
    © 2022 PostHog, Inc.
    • Code of conduct
    • Privacy policy
    • Terms