openapi: 3.0.3
info:
title: PostHog actions feature_flags API
version: 1.0.0
description: ''
tags:
- name: feature_flags
paths:
/api/projects/{project_id}/feature_flags/:
get:
operationId: feature_flags_list
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: query
name: active
schema:
type: string
enum:
- STALE
- 'false'
- 'true'
- in: query
name: created_by_id
schema:
type: string
description: The User ID which initially created the feature flag.
- in: query
name: evaluation_runtime
schema:
type: string
enum:
- both
- client
- server
description: Filter feature flags by their evaluation runtime.
- in: query
name: excluded_properties
schema:
type: string
description: JSON-encoded list of feature flag keys to exclude from the results.
- in: query
name: has_evaluation_contexts
schema:
type: string
enum:
- 'false'
- 'true'
description: Filter feature flags by presence of evaluation contexts. 'true' returns only flags with at least one evaluation context, 'false' returns only flags without.
- name: limit
required: false
in: query
description: Number of results to return per page.
schema:
type: integer
- name: offset
required: false
in: query
description: The initial index from which to return the results.
schema:
type: integer
- $ref: '#/components/parameters/ProjectIdPath'
- in: query
name: search
schema:
type: string
description: Search by feature flag key or name. Case insensitive.
- in: query
name: tags
schema:
type: string
description: JSON-encoded list of tag names to filter feature flags by.
- in: query
name: type
schema:
type: string
enum:
- boolean
- experiment
- multivariant
- remote_config
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedFeatureFlagList'
description: ''
x-explicit-tags:
- feature_flags
post:
operationId: feature_flags_create
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlagCreateRequestSchema'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlagCreateRequestSchema'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlagCreateRequestSchema'
security:
- PersonalAPIKeyAuth:
- feature_flag:write
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/:
get:
operationId: feature_flags_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
description: ''
x-explicit-tags:
- feature_flags
put:
operationId: feature_flags_update
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
security:
- PersonalAPIKeyAuth:
- feature_flag:write
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
description: ''
x-explicit-tags:
- feature_flags
patch:
operationId: feature_flags_partial_update
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PatchedFeatureFlagPartialUpdateRequestSchema'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/PatchedFeatureFlagPartialUpdateRequestSchema'
multipart/form-data:
schema:
$ref: '#/components/schemas/PatchedFeatureFlagPartialUpdateRequestSchema'
security:
- PersonalAPIKeyAuth:
- feature_flag:write
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
description: ''
x-explicit-tags:
- feature_flags
delete:
operationId: feature_flags_destroy
description: Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:write
responses:
'405':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/activity/:
get:
operationId: feature_flags_activity_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- in: query
name: limit
schema:
type: integer
minimum: 1
default: 10
description: Number of items per page
- in: query
name: page
schema:
type: integer
minimum: 1
default: 1
description: Page number
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- activity_log:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityLogPaginatedResponse'
description: ''
'404':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/create_static_cohort_for_flag/:
post:
operationId: feature_flags_create_static_cohort_for_flag_create
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/dashboard/:
post:
operationId: feature_flags_dashboard_create
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/dependent_flags/:
get:
operationId: feature_flags_dependent_flags_list
description: Get other active flags that depend on this flag.
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DependentFlag'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/enrich_usage_dashboard/:
post:
operationId: feature_flags_enrich_usage_dashboard_create
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/remote_config/:
get:
operationId: feature_flags_remote_config_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/status/:
get:
operationId: feature_flags_status_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlagStatusResponse'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/{id}/versions/{version_number}/:
get:
operationId: feature_flags_versions_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this feature flag.
required: true
- $ref: '#/components/parameters/ProjectIdPath'
- in: path
name: version_number
schema:
type: integer
description: The version number to reconstruct.
required: true
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlagVersionResponse'
description: ''
'400':
description: Version history is not available for remote configuration flags.
'404':
description: Version not found.
'422':
description: Activity log incomplete; cannot reconstruct this version.
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/activity/:
get:
operationId: feature_flags_all_activity_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: query
name: limit
schema:
type: integer
minimum: 1
default: 10
description: Number of items per page
- in: query
name: page
schema:
type: integer
minimum: 1
default: 1
description: Page number
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- activity_log:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ActivityLogPaginatedResponse'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/bulk_delete/:
post:
operationId: feature_flags_bulk_delete_create
description: 'Bulk delete feature flags by filter criteria or explicit IDs.
Accepts either:
- {"filters": {...}} - Same filter params as list endpoint (search, active, type, etc.)
- {"ids": [...]} - Explicit list of flag IDs (no limit)
Returns same format as bulk_delete for UI compatibility.
Uses bulk operations for efficiency: database updates are batched and cache
invalidation happens once at the end rather than per-flag.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
security:
- PersonalAPIKeyAuth:
- feature_flag:write
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/bulk_keys/:
post:
operationId: feature_flags_bulk_keys_create
description: 'Get feature flag keys by IDs.
Accepts a list of feature flag IDs and returns a mapping of ID to key.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureFlag'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FeatureFlag'
multipart/form-data:
schema:
$ref: '#/components/schemas/FeatureFlag'
required: true
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/bulk_update_tags/:
post:
operationId: feature_flags_bulk_update_tags_create
description: 'Bulk update tags on multiple objects.
Accepts:
- {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}
Actions:
- "add": Add tags to existing tags on each object
- "remove": Remove specific tags from each object
- "set": Replace all tags on each object with the provided list'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BulkUpdateTagsRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/BulkUpdateTagsRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/BulkUpdateTagsRequest'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BulkUpdateTagsResponse'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/evaluation_reasons/:
get:
operationId: feature_flags_evaluation_reasons_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: query
name: distinct_id
schema:
type: string
minLength: 1
description: User distinct ID
required: true
- in: query
name: groups
schema:
type: string
default: '{}'
description: Groups for feature flag evaluation (JSON object string)
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/local_evaluation/:
get:
operationId: feature_flags_local_evaluation_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
- in: query
name: send_cohorts
schema:
type: boolean
nullable: true
default: false
description: Include cohorts in response
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LocalEvaluationResponse'
description: ''
'402':
description: Payment required
'500':
description: Internal server error
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/matching_ids/:
get:
operationId: feature_flags_matching_ids_retrieve
description: 'Get IDs of all feature flags matching the current filters.
Uses the same filtering logic as the list endpoint.
Returns only IDs that the user has permission to edit.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
description: No response body
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/my_flags/:
get:
operationId: feature_flags_my_flags_retrieve
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- in: query
name: groups
schema:
type: string
default: '{}'
description: Groups for feature flag evaluation (JSON object string)
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MyFlagsResponse'
description: ''
x-explicit-tags:
- feature_flags
/api/projects/{project_id}/feature_flags/user_blast_radius/:
post:
operationId: feature_flags_user_blast_radius_create
description: 'Create, read, update and delete feature flags. [See docs](https://posthog.com/docs/feature-flags) 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.'
parameters:
- $ref: '#/components/parameters/ProjectIdPath'
tags:
- feature_flags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserBlastRadiusRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UserBlastRadiusRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/UserBlastRadiusRequest'
required: true
security:
- PersonalAPIKeyAuth:
- feature_flag:read
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserBlastRadiusResponse'
description: ''
x-explicit-tags:
- feature_flags
components:
schemas:
BulkUpdateTagsResponse:
type: object
properties:
updated:
type: array
items:
$ref: '#/components/schemas/BulkUpdateTagsItem'
skipped:
type: array
items:
$ref: '#/components/schemas/BulkUpdateTagsError'
required:
- skipped
- updated
FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum:
enum:
- icontains_multi
- not_icontains_multi
type: string
description: '* `icontains_multi` - icontains_multi
* `not_icontains_multi` - not_icontains_multi'
FeatureFlagFilterPropertySemverSchema:
type: object
properties:
key:
type: string
description: Property key used in this feature flag condition.
type:
allOf:
- $ref: '#/components/schemas/PropertyGroupTypeEnum'
description: 'Property filter type. Common values are ''person'' and ''cohort''.
* `cohort` - cohort
* `person` - person
* `group` - group'
cohort_name:
type: string
nullable: true
description: Resolved cohort name for cohort-type filters.
group_type_index:
type: integer
nullable: true
description: Group type index when using group-based filters.
operator:
allOf:
- $ref: '#/components/schemas/FeatureFlagFilterPropertySemverSchemaOperatorEnum'
description: 'Semantic version comparison operator.
* `semver_gt` - semver_gt
* `semver_gte` - semver_gte
* `semver_lt` - semver_lt
* `semver_lte` - semver_lte
* `semver_eq` - semver_eq
* `semver_neq` - semver_neq
* `semver_tilde` - semver_tilde
* `semver_caret` - semver_caret
* `semver_wildcard` - semver_wildcard'
value:
type: string
description: Semantic version string.
required:
- key
- operator
- value
FeatureFlagFilterPropertyCohortInSchemaOperatorEnum:
enum:
- in
- not_in
type: string
description: '* `in` - in
* `not_in` - not_in'
RoleAtOrganizationEnum:
enum:
- engineering
- data
- product
- founder
- leadership
- marketing
- sales
- other
type: string
description: '* `engineering` - Engineering
* `data` - Data
* `product` - Product Management
* `founder` - Founder
* `leadership` - Leadership
* `marketing` - Marketing
* `sales` - Sales / Success
* `other` - Other'
FeatureFlagCreateRequestSchema:
type: object
properties:
key:
type: string
description: Feature flag key.
name:
type: string
description: Feature flag description (stored in the `name` field for backwards compatibility).
filters:
allOf:
- $ref: '#/components/schemas/FeatureFlagFiltersSchema'
description: Feature flag targeting configuration.
active:
type: boolean
description: Whether the feature flag is active.
tags:
type: array
items:
type: string
description: Organizational tags for this feature flag.
evaluation_contexts:
type: array
items:
type: string
description: Evaluation contexts that control where this flag evaluates at runtime.
Change:
type: object
properties:
type:
type: string
readOnly: true
action:
type: string
readOnly: true
field:
type: string
readOnly: true
before:
readOnly: true
after:
readOnly: true
required:
- action
- after
- before
- field
- type
NullEnum:
enum:
- null
FeatureFlagFilterPropertyExistsSchema:
type: object
properties:
key:
type: string
description: Property key used in this feature flag condition.
type:
allOf:
- $ref: '#/components/schemas/PropertyGroupTypeEnum'
description: 'Property filter type. Common values are ''person'' and ''cohort''.
* `cohort` - cohort
# --- truncated at 32 KB (65 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/posthog/refs/heads/main/openapi/posthog-feature-flags-api-openapi.yml