Experiments
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
POST | |
POST | |
GET | |
GET | |
GET | |
GET |
List all experiments
Required API key scopes
experiment:readPath parameters
- project_idstring
Query parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /experimentsExample response
Status 200
RESPONSE
Create experiments
Required API key scopes
experiment:writePath parameters
- project_idstring
Request parameters
- namestring
- descriptionstring
- start_datestring
- end_datestring
- feature_flag_keystring
- holdout_idinteger
- parameters
- secondary_metrics
- saved_metrics_idsarray
- filters
- archivedboolean
- deletedboolean
- type
- exposure_criteria
- metrics
- metrics_secondary
- stats_config
- _create_in_folderstring
- conclusion
- conclusion_commentstring
- primary_metrics_ordered_uuids
- secondary_metrics_ordered_uuids
Response
Example request
POST /api /projects /:project_id /experimentsExample response
Status 201
RESPONSE
Retrieve experiments
Required API key scopes
experiment:readPath parameters
- idinteger
- project_idstring
Response
Example request
GET /api /projects /:project_id /experiments /:idExample response
Status 200
RESPONSE
Update experiments
Required API key scopes
experiment:writePath parameters
- idinteger
- project_idstring
Request parameters
- namestring
- descriptionstring
- start_datestring
- end_datestring
- feature_flag_keystring
- holdout_idinteger
- parameters
- secondary_metrics
- saved_metrics_idsarray
- filters
- archivedboolean
- deletedboolean
- type
- exposure_criteria
- metrics
- metrics_secondary
- stats_config
- _create_in_folderstring
- conclusion
- conclusion_commentstring
- primary_metrics_ordered_uuids
- secondary_metrics_ordered_uuids
Response
Example request
PATCH /api /projects /:project_id /experiments /:idExample response
Status 200
RESPONSE
Delete experiments
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Required API key scopes
experiment:writePath parameters
- idinteger
- project_idstring
Example request
DELETE /api /projects /:project_id /experiments /:idExample response
Status 405 No response body
Create experiments create exposure cohort for experiment
Required API key scopes
experiment:writePath parameters
- idinteger
- project_idstring
Request parameters
- namestring
- descriptionstring
- start_datestring
- end_datestring
- feature_flag_keystring
- holdout_idinteger
- parameters
- secondary_metrics
- saved_metrics_idsarray
- filters
- archivedboolean
- deletedboolean
- type
- exposure_criteria
- metrics
- metrics_secondary
- stats_config
- _create_in_folderstring
- conclusion
- conclusion_commentstring
- primary_metrics_ordered_uuids
- secondary_metrics_ordered_uuids
Example request
POST /api /projects /:project_id /experiments /:id /create_exposure_cohort_for_experimentExample response
Status 200 No response body
Create experiments duplicate
Required API key scopes
experiment:writePath parameters
- idinteger
- project_idstring
Request parameters
- namestring
- descriptionstring
- start_datestring
- end_datestring
- feature_flag_keystring
- holdout_idinteger
- parameters
- secondary_metrics
- saved_metrics_idsarray
- filters
- archivedboolean
- deletedboolean
- type
- exposure_criteria
- metrics
- metrics_secondary
- stats_config
- _create_in_folderstring
- conclusion
- conclusion_commentstring
- primary_metrics_ordered_uuids
- secondary_metrics_ordered_uuids
Example request
POST /api /projects /:project_id /experiments /:id /duplicateExample response
Status 200 No response body
Create experiments recalculate timeseries
Create a recalculation request for experiment timeseries data.
Request body:
- metric (required): The full metric object to recalculate
- fingerprint (required): The fingerprint of the metric configuration
Required API key scopes
experiment:writePath parameters
- idinteger
- project_idstring
Request parameters
- namestring
- descriptionstring
- start_datestring
- end_datestring
- feature_flag_keystring
- holdout_idinteger
- parameters
- secondary_metrics
- saved_metrics_idsarray
- filters
- archivedboolean
- deletedboolean
- type
- exposure_criteria
- metrics
- metrics_secondary
- stats_config
- _create_in_folderstring
- conclusion
- conclusion_commentstring
- primary_metrics_ordered_uuids
- secondary_metrics_ordered_uuids
Example request
POST /api /projects /:project_id /experiments /:id /recalculate_timeseriesExample response
Status 200 No response body
Retrieve experiments timeseries results
Retrieve timeseries results for a specific experiment-metric combination. Aggregates daily results into a timeseries format for frontend compatibility.
Query parameters:
- metric_uuid (required): The UUID of the metric to retrieve results for
- fingerprint (required): The fingerprint of the metric configuration
Required API key scopes
experiment:readPath parameters
- idinteger
- project_idstring
Example request
GET /api /projects /:project_id /experiments /:id /timeseries_resultsExample response
Status 200 No response body
Retrieve experiments eligible feature flags
Returns a paginated list of feature flags eligible for use in experiments.
Eligible flags must:
- Be multivariate with at least 2 variants
- Have "control" as the first variant key
Query parameters:
- search: Filter by flag key or name (case insensitive)
- limit: Number of results per page (default: 20)
- offset: Pagination offset (default: 0)
- active: Filter by active status ("true" or "false")
- created_by_id: Filter by creator user ID
- order: Sort order field
- evaluation_runtime: Filter by evaluation runtime
- has_evaluation_tags: Filter by presence of evaluation tags ("true" or "false")
Required API key scopes
feature_flag:readPath parameters
- project_idstring
Example request
GET /api /projects /:project_id /experiments /eligible_feature_flagsExample response
Status 200 No response body
Retrieve experiments requires flag implementation
Required API key scopes
experiment:readPath parameters
- project_idstring
Example request
GET /api /projects /:project_id /experiments /requires_flag_implementationExample response
Status 200 No response body
Retrieve experiments stats
Get experimentation velocity statistics.
Required API key scopes
experiment:readPath parameters
- project_idstring
Example request
GET /api /projects /:project_id /experiments /statsExample response
Status 200 No response body
PostHog is an all-in-one developer platform for building successful products. We provide product analytics, web analytics, session replay, error tracking,feature flags, experiments, surveys, LLM analytics, data warehouse, CDP, and anAI product assistant to help debug your code, ship features faster, and keep all your usage and customer data in one stack.