Experiments

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET
POST
POST
POST
POST
POST
GET
GET
POST
POST
POST
GET
GET
POST

List all experiments

List experiments for the current project. Supports filtering by status and archival state.

Required API key scopes

experiment:read

Query parameters

  • archived
    boolean
  • created_by_id
    string
  • event
    string
  • feature_flag_id
    integer
  • limit
    integer
  • offset
    integer
  • order
    string
  • prompt_name
    string
  • search
    string
  • status
    string
    One of: "all""complete""draft""exposure_frozen""paused""running""stopped"

Response


Example request

GET /api/projects/:project_id/experiments
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/

Example response

Status 200
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",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",
"feature_flag_key": "string",
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"holdout": {
"id": 0,
"name": "string",
"description": "string",
"filters": [
{
"properties": [
{
"key": "string",
"type": "cohort",
"cohort_name": "string",
"group_type_index": 0,
"value": null,
"operator": "exact"
}
],
"rollout_percentage": 0.1,
"variant": "string",
"aggregation_group_type_index": 0
}
],
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
},
"exposure_cohort": 0,
"parameters": {
"minimum_detectable_effect": null,
"variant_notes": null
},
"running_time_calculation": {
"exposure_estimate_config": null,
"minimum_detectable_effect": null,
"recommended_running_time": null,
"recommended_sample_size": null
},
"excluded_variants": [
"string"
],
"archived": false,
"deleted": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"type": "web",
"conclusion": "won",
"conclusion_comment": "string",
"status": "draft",
"is_legacy": true,
"user_access_level": "string"
}
]
}

Create experiments

Also available via the PostHog MCP server:

  • experiment-createCreate experiment

Create a new experiment in draft status with optional metrics.

Required API key scopes

experiment:write

Request parameters

  • name
    string
  • description
    stringnull
  • start_date
    stringnull
  • end_date
    stringnull
  • feature_flag_key
    string
  • feature_flag
  • holdout_id
    integernull
  • parameters
  • running_time_calculation
  • excluded_variants
    arraynull
  • secondary_metrics
  • saved_metrics_ids
    arraynull
  • filters
  • archived
    boolean
    Default: false
  • deleted
    booleannull
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • allow_unknown_events
    boolean
    Default: false
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    stringnull
  • repository
    stringnull
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids
  • only_count_matured_users
    boolean
  • update_feature_flag_params
    boolean
    Default: false
  • version
    integernull
  • original_experiment
    objectnull

Response


Example request

POST /api/projects/:project_id/experiments
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/\
-d name="string",\
-d feature_flag_key="string"

Example response

Status 201
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",
"feature_flag_key": "string",
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"holdout": {
"id": 0,
"name": "string",
"description": "string",
"filters": [
{
"properties": [
{
"key": "string",
"type": "cohort",
"cohort_name": "string",
"group_type_index": 0,
"value": null,
"operator": "exact"
}
],
"rollout_percentage": 0.1,
"variant": "string",
"aggregation_group_type_index": 0
}
],
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
},
"holdout_id": 0,
"exposure_cohort": 0,
"parameters": {
"minimum_detectable_effect": null,
"variant_notes": null
},
"running_time_calculation": {
"exposure_estimate_config": null,
"minimum_detectable_effect": null,
"recommended_running_time": null,
"recommended_sample_size": null
},
"excluded_variants": [
"string"
],
"secondary_metrics": null,
"saved_metrics": [
{
"id": 0,
"experiment": 0,
"saved_metric": 0,
"metadata": null,
"created_at": "2019-08-24T14:15:22Z",
"query": null,
"name": "string"
}
],
"saved_metrics_ids": [
null
],
"filters": null,
"archived": false,
"deleted": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"type": "web",
"exposure_criteria": {
"activation_config": null,
"exposure_config": null,
"filterTestAccounts": null,
"multiple_variant_handling": null
},
"metrics": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"metrics_secondary": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"stats_config": null,
"scheduling_config": null,
"allow_unknown_events": false,
"_create_in_folder": "string",
"conclusion": "won",
"conclusion_comment": "string",
"flag_cleanup_task_id": "72bdc9e1-c8bb-44f1-8473-a75871329c84",
"repository": "string",
"primary_metrics_ordered_uuids": null,
"secondary_metrics_ordered_uuids": null,
"only_count_matured_users": true,
"update_feature_flag_params": false,
"version": 0,
"original_experiment": {},
"status": "draft",
"is_legacy": true,
"can_freeze_exposure": true,
"resolved_exposure_event": "string",
"user_access_level": "string"
}

Retrieve experiments

Also available via the PostHog MCP server:

  • experiment-getGet experiment details

Retrieve a single experiment by ID, including its current status, metrics, feature flag, and results metadata.

Required API key scopes

experiment:read

Path parameters

  • id
    integer

Response


Example request

GET /api/projects/:project_id/experiments/:id
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/

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",
"feature_flag_key": "string",
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"holdout": {
"id": 0,
"name": "string",
"description": "string",
"filters": [
{
"properties": [
{
"key": "string",
"type": "cohort",
"cohort_name": "string",
"group_type_index": 0,
"value": null,
"operator": "exact"
}
],
"rollout_percentage": 0.1,
"variant": "string",
"aggregation_group_type_index": 0
}
],
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
},
"holdout_id": 0,
"exposure_cohort": 0,
"parameters": {
"minimum_detectable_effect": null,
"variant_notes": null
},
"running_time_calculation": {
"exposure_estimate_config": null,
"minimum_detectable_effect": null,
"recommended_running_time": null,
"recommended_sample_size": null
},
"excluded_variants": [
"string"
],
"secondary_metrics": null,
"saved_metrics": [
{
"id": 0,
"experiment": 0,
"saved_metric": 0,
"metadata": null,
"created_at": "2019-08-24T14:15:22Z",
"query": null,
"name": "string"
}
],
"saved_metrics_ids": [
null
],
"filters": null,
"archived": false,
"deleted": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"type": "web",
"exposure_criteria": {
"activation_config": null,
"exposure_config": null,
"filterTestAccounts": null,
"multiple_variant_handling": null
},
"metrics": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"metrics_secondary": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"stats_config": null,
"scheduling_config": null,
"allow_unknown_events": false,
"_create_in_folder": "string",
"conclusion": "won",
"conclusion_comment": "string",
"flag_cleanup_task_id": "72bdc9e1-c8bb-44f1-8473-a75871329c84",
"repository": "string",
"primary_metrics_ordered_uuids": null,
"secondary_metrics_ordered_uuids": null,
"only_count_matured_users": true,
"update_feature_flag_params": false,
"version": 0,
"original_experiment": {},
"status": "draft",
"is_legacy": true,
"can_freeze_exposure": true,
"resolved_exposure_event": "string",
"user_access_level": "string"
}

Update experiments

Also available via the PostHog MCP server:

  • experiment-updateUpdate experiment

Update an experiment. Use this to modify experiment properties such as name, description, metrics, variants, and configuration. Metrics can be added, changed and removed at any time. Feature-flag config (variants, rollout, payloads) is sent via the feature_flag object.

Required API key scopes

experiment:write

Path parameters

  • id
    integer

Request parameters

  • name
    string
  • description
    stringnull
  • start_date
    stringnull
  • end_date
    stringnull
  • feature_flag_key
    string
  • feature_flag
  • holdout_id
    integernull
  • parameters
  • running_time_calculation
  • excluded_variants
    arraynull
  • secondary_metrics
  • saved_metrics_ids
    arraynull
  • filters
  • archived
    boolean
    Default: false
  • deleted
    booleannull
  • type
  • exposure_criteria
  • metrics
  • metrics_secondary
  • stats_config
  • scheduling_config
  • allow_unknown_events
    boolean
    Default: false
  • _create_in_folder
    string
  • conclusion
  • conclusion_comment
    stringnull
  • repository
    stringnull
  • primary_metrics_ordered_uuids
  • secondary_metrics_ordered_uuids
  • only_count_matured_users
    boolean
  • update_feature_flag_params
    boolean
    Default: false
  • version
    integernull
  • original_experiment
    objectnull

Response


Example request

PATCH /api/projects/:project_id/experiments/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/experiments/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",
"feature_flag_key": "string",
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"holdout": {
"id": 0,
"name": "string",
"description": "string",
"filters": [
{
"properties": [
{
"key": "string",
"type": "cohort",
"cohort_name": "string",
"group_type_index": 0,
"value": null,
"operator": "exact"
}
],
"rollout_percentage": 0.1,
"variant": "string",
"aggregation_group_type_index": 0
}
],
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
},
"holdout_id": 0,
"exposure_cohort": 0,
"parameters": {
"minimum_detectable_effect": null,
"variant_notes": null
},
"running_time_calculation": {
"exposure_estimate_config": null,
"minimum_detectable_effect": null,
"recommended_running_time": null,
"recommended_sample_size": null
},
"excluded_variants": [
"string"
],
"secondary_metrics": null,
"saved_metrics": [
{
"id": 0,
"experiment": 0,
"saved_metric": 0,
"metadata": null,
"created_at": "2019-08-24T14:15:22Z",
"query": null,
"name": "string"
}
],
"saved_metrics_ids": [
null
],
"filters": null,
"archived": false,
"deleted": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"type": "web",
"exposure_criteria": {
"activation_config": null,
"exposure_config": null,
"filterTestAccounts": null,
"multiple_variant_handling": null
},
"metrics": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"metrics_secondary": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"stats_config": null,
"scheduling_config": null,
"allow_unknown_events": false,
"_create_in_folder": "string",
"conclusion": "won",
"conclusion_comment": "string",
"flag_cleanup_task_id": "72bdc9e1-c8bb-44f1-8473-a75871329c84",
"repository": "string",
"primary_metrics_ordered_uuids": null,
"secondary_metrics_ordered_uuids": null,
"only_count_matured_users": true,
"update_feature_flag_params": false,
"version": 0,
"original_experiment": {},
"status": "draft",
"is_legacy": true,
"can_freeze_exposure": true,
"resolved_exposure_event": "string",
"user_access_level": "string"
}

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

Path parameters

  • id
    integer

Example request

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

Example response

Status 405 No response body

Retrieve experiments activity

Change history for this experiment.

Returns a paginated audit trail of changes to the experiment and its holdouts and shared metrics: who made each change, what changed (field-level before/after values), and when. Ordered newest first.

Required API key scopes

activity_log:read

Path parameters

  • id
    integer

Query parameters

  • limit
    integer
    Default: 10
  • page
    integer
    Default: 1

Response


Example request

GET /api/projects/:project_id/experiments/:id/activity
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/activity/

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"user": {},
"activity": "string",
"scope": "string",
"item_id": "string",
"detail": {
"id": "string",
"changes": [
{
"type": "string",
"action": "string",
"field": "string",
"before": null,
"after": null
}
],
"merge": {
"type": "string",
"source": null,
"target": null
},
"trigger": {
"job_type": "string",
"job_id": "string",
"payload": null
},
"name": "string",
"short_id": "string",
"type": "string"
},
"created_at": "2019-08-24T14:15:22Z",
"is_system": true,
"was_impersonated": true,
"client": "string"
}
],
"next": "http://example.com",
"previous": "http://example.com",
"total_count": 0
}
Status 404 No response body

Create experiments archive

Archive an ended experiment.

Hides the experiment from the default list view. The experiment can be restored at any time by updating archived=false. When the linked feature flag is still enabled, pass disable_feature_flag=true to also disable and archive it. Returns 400 if the experiment is already archived or has not ended yet.

Required API key scopes

experiment:write

Path parameters

  • id
    integer

Request parameters

  • disable_feature_flag
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/experiments/:id/archive
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/archive/\
-d disable_feature_flag="boolean"

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",
"feature_flag_key": "string",
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"holdout": {
"id": 0,
"name": "string",
"description": "string",
"filters": [
{
"properties": [
{
"key": "string",
"type": "cohort",
"cohort_name": "string",
"group_type_index": 0,
"value": null,
"operator": "exact"
}
],
"rollout_percentage": 0.1,
"variant": "string",
"aggregation_group_type_index": 0
}
],
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
},
"holdout_id": 0,
"exposure_cohort": 0,
"parameters": {
"minimum_detectable_effect": null,
"variant_notes": null
},
"running_time_calculation": {
"exposure_estimate_config": null,
"minimum_detectable_effect": null,
"recommended_running_time": null,
"recommended_sample_size": null
},
"excluded_variants": [
"string"
],
"secondary_metrics": null,
"saved_metrics": [
{
"id": 0,
"experiment": 0,
"saved_metric": 0,
"metadata": null,
"created_at": "2019-08-24T14:15:22Z",
"query": null,
"name": "string"
}
],
"saved_metrics_ids": [
null
],
"filters": null,
"archived": false,
"deleted": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"type": "web",
"exposure_criteria": {
"activation_config": null,
"exposure_config": null,
"filterTestAccounts": null,
"multiple_variant_handling": null
},
"metrics": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"metrics_secondary": [
{
"completion_event": null,
"conversion_window": null,
"denominator": null,
"denominator_outlier_handling": null,
"goal": null,
"ignore_zeros": null,
"kind": "ExperimentMetric",
"lower_bound_percentile": null,
"metric_type": "funnel",
"name": null,
"numerator": null,
"numerator_outlier_handling": null,
"retention_window_end": null,
"retention_window_start": null,
"retention_window_unit": null,
"series": null,
"source": null,
"start_event": null,
"start_handling": null,
"threshold": null,
"upper_bound_percentile": null,
"uuid": null
}
],
"stats_config": null,
"scheduling_config": null,
"allow_unknown_events": false,
"_create_in_folder": "string",
"conclusion": "won",
"conclusion_comment": "string",
"flag_cleanup_task_id": "72bdc9e1-c8bb-44f1-8473-a75871329c84",
"repository": "string",
"primary_metrics_ordered_uuids": null,
"secondary_metrics_ordered_uuids": null,
"only_count_matured_users": true,
"update_feature_flag_params": false,
"version": 0,
"original_experiment": {},
"status": "draft",
"is_legacy": true,
"can_freeze_exposure": true,
"resolved_exposure_event": "string",
"user_access_level": "string"
}

Create experiments copy to project

Copy an experiment into another project in the same organization as a new draft.

Required API key scopes

experiment:write

Path parameters

  • id
    integer

Request parameters

  • target_team_id
    integer
  • feature_flag_key
    string
  • name
    string

Response


Example request

POST /api/projects/:project_id/experiments/:id/copy_to_project
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/copy_to_project/\
-d target_team_id="integer"

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"end_date": "2019-08-24T14:15:22Z",