Experiments-2

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

Endpoints

POST
POST
GET
GET
GET
GET

Create experiments duplicate

Required API key scopes

experiment:write

Path parameters

  • id
    integer
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • start_date
    string
  • end_date
    string
  • feature_flag_key
    string
  • holdout_id
    integer
  • parameters
  • secondary_metrics
  • saved_metrics_ids
    array
  • filters
  • archived
    boolean
  • deleted
    boolean
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    string
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids

Example request

POST /api/projects/:project_id/experiments/:id/duplicate
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/duplicate/\
-d name="string",\
-d feature_flag_key="string"

Example response

Status 200 No response body

Create experiments duplicate

Required API key scopes

experiment:write

Path parameters

  • id
    integer
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • start_date
    string
  • end_date
    string
  • feature_flag_key
    string
  • holdout_id
    integer
  • parameters
  • secondary_metrics
  • saved_metrics_ids
    array
  • filters
  • archived
    boolean
  • deleted
    boolean
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    string
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids

Example request

POST /api/projects/:project_id/experiments/:id/duplicate
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/duplicate/\
-d name="string",\
-d feature_flag_key="string"

Example 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:write

Path parameters

  • id
    integer
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • start_date
    string
  • end_date
    string
  • feature_flag_key
    string
  • holdout_id
    integer
  • parameters
  • secondary_metrics
  • saved_metrics_ids
    array
  • filters
  • archived
    boolean
  • deleted
    boolean
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    string
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids

Example request

POST /api/projects/:project_id/experiments/:id/recalculate_timeseries
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/recalculate_timeseries/\
-d name="string",\
-d feature_flag_key="string"

Example 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:write

Path parameters

  • id
    integer
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • start_date
    string
  • end_date
    string
  • feature_flag_key
    string
  • holdout_id
    integer
  • parameters
  • secondary_metrics
  • saved_metrics_ids
    array
  • filters
  • archived
    boolean
  • deleted
    boolean
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    string
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids

Example request

POST /api/projects/:project_id/experiments/:id/recalculate_timeseries
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/recalculate_timeseries/\
-d name="string",\
-d feature_flag_key="string"

Example 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:read

Path parameters

  • id
    integer
  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/:id/timeseries_results
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/timeseries_results/

Example 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:read

Path parameters

  • id
    integer
  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/:id/timeseries_results
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/timeseries_results/

Example 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:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/eligible_feature_flags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/eligible_feature_flags/

Example 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:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/eligible_feature_flags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/eligible_feature_flags/

Example response

Status 200 No response body

Retrieve experiments requires flag implementation

Required API key scopes

experiment:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/requires_flag_implementation
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/requires_flag_implementation/

Example response

Status 200 No response body

Retrieve experiments requires flag implementation

Required API key scopes

experiment:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/requires_flag_implementation
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/requires_flag_implementation/

Example response

Status 200 No response body

Retrieve experiments stats

Get experimentation velocity statistics.

Required API key scopes

experiment:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/stats
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/stats/

Example response

Status 200 No response body

Retrieve experiments stats

Get experimentation velocity statistics.

Required API key scopes

experiment:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/experiments/stats
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/stats/

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.