@utdk/posthog 1.0.0-20260712.5-dev.e2949a6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +172 -0
  3. package/docs/account_relationship_definitions.md +194 -0
  4. package/docs/accounts.md +380 -0
  5. package/docs/actions.md +274 -0
  6. package/docs/activity_logs.md +144 -0
  7. package/docs/advanced_activity_logs.md +101 -0
  8. package/docs/agent_platform.md +2525 -0
  9. package/docs/ai-observability.md +514 -0
  10. package/docs/alerts.md +444 -0
  11. package/docs/annotations.md +200 -0
  12. package/docs/batch_exports.md +2118 -0
  13. package/docs/business_knowledge.md +468 -0
  14. package/docs/code-invites.md +72 -0
  15. package/docs/cohorts.md +412 -0
  16. package/docs/comments.md +321 -0
  17. package/docs/conversations.md +695 -0
  18. package/docs/custom_property_definitions.md +442 -0
  19. package/docs/custom_property_sources.md +194 -0
  20. package/docs/customer_analytics.md +442 -0
  21. package/docs/customer_journeys.md +380 -0
  22. package/docs/customer_profile_configs.md +380 -0
  23. package/docs/dashboard_templates.md +258 -0
  24. package/docs/dashboards.md +1896 -0
  25. package/docs/data_color_themes.md +380 -0
  26. package/docs/data_modeling_jobs.md +264 -0
  27. package/docs/data_warehouse.md +928 -0
  28. package/docs/dataset_items.md +382 -0
  29. package/docs/datasets.md +382 -0
  30. package/docs/desktop_file_system.md +753 -0
  31. package/docs/desktop_file_system_shortcut.md +244 -0
  32. package/docs/docs.md +72 -0
  33. package/docs/early_access_feature.md +194 -0
  34. package/docs/elements.md +510 -0
  35. package/docs/endpoints.md +1030 -0
  36. package/docs/engineering_analytics.md +712 -0
  37. package/docs/environments.md +881 -0
  38. package/docs/error_tracking.md +5108 -0
  39. package/docs/evaluation_runs.md +78 -0
  40. package/docs/evaluations.md +446 -0
  41. package/docs/event_definitions.md +425 -0
  42. package/docs/event_filter.md +280 -0
  43. package/docs/event_schemas.md +163 -0
  44. package/docs/events.md +208 -0
  45. package/docs/experiment_holdouts.md +194 -0
  46. package/docs/experiment_saved_metrics.md +194 -0
  47. package/docs/experiments.md +1088 -0
  48. package/docs/exports.md +256 -0
  49. package/docs/external_data_schemas.md +752 -0
  50. package/docs/external_data_sources.md +2296 -0
  51. package/docs/feature_flags.md +808 -0
  52. package/docs/field_notes.md +206 -0
  53. package/docs/file_system.md +880 -0
  54. package/docs/file_system_shortcut.md +444 -0
  55. package/docs/flag_value.md +46 -0
  56. package/docs/groups.md +514 -0
  57. package/docs/groups_types.md +349 -0
  58. package/docs/health_issues.md +386 -0
  59. package/docs/heatmap_screenshots.md +72 -0
  60. package/docs/heatmaps.md +136 -0
  61. package/docs/hog_flows.md +1576 -0
  62. package/docs/hog_function_templates.md +101 -0
  63. package/docs/hog_functions.md +974 -0
  64. package/docs/ingestion_warnings_v2.md +40 -0
  65. package/docs/insight_variables.md +380 -0
  66. package/docs/insights.md +1722 -0
  67. package/docs/integrations.md +1954 -0
  68. package/docs/js-snippet.md +104 -0
  69. package/docs/live_debugger_breakpoints.md +264 -0
  70. package/docs/llm_analytics.md +3373 -0
  71. package/docs/llm_prompts.md +442 -0
  72. package/docs/llm_skills.md +952 -0
  73. package/docs/logs.md +2446 -0
  74. package/docs/managed_viewsets.md +140 -0
  75. package/docs/marketing_analytics.md +518 -0
  76. package/docs/max.md +772 -0
  77. package/docs/max_tools.md +70 -0
  78. package/docs/mcp_analytics.md +712 -0
  79. package/docs/mcp_server_installations.md +970 -0
  80. package/docs/mcp_servers.md +78 -0
  81. package/docs/mcp_tools.md +82 -0
  82. package/docs/messaging_templates.md +444 -0
  83. package/docs/metrics.md +462 -0
  84. package/docs/notebooks.md +838 -0
  85. package/docs/object_media_previews.md +228 -0
  86. package/docs/organizations.md +2958 -0
  87. package/docs/persons.md +1514 -0
  88. package/docs/platform_features.md +700 -0
  89. package/docs/plugin_configs.md +70 -0
  90. package/docs/product_enablement.md +39 -0
  91. package/docs/product_tours.md +357 -0
  92. package/docs/project_secret_api_keys.md +444 -0
  93. package/docs/property_access_controls.md +200 -0
  94. package/docs/property_definitions.md +244 -0
  95. package/docs/query.md +560 -0
  96. package/docs/quota_limits.md +40 -0
  97. package/docs/reminders.md +194 -0
  98. package/docs/replay.md +1020 -0
  99. package/docs/reverse_proxy.md +200 -0
  100. package/docs/sandbox-custom-images.md +209 -0
  101. package/docs/sandbox-environments.md +168 -0
  102. package/docs/saved.md +392 -0
  103. package/docs/saved_query_column_annotations.md +224 -0
  104. package/docs/scheduled_changes.md +200 -0
  105. package/docs/schema_property_groups.md +194 -0
  106. package/docs/sdk_health.md +40 -0
  107. package/docs/session_group_summaries.md +200 -0
  108. package/docs/session_recordings.md +260 -0
  109. package/docs/session_summaries.md +200 -0
  110. package/docs/sessions.md +132 -0
  111. package/docs/signals.md +1428 -0
  112. package/docs/single_session_summaries.md +72 -0
  113. package/docs/streamlit_apps.md +456 -0
  114. package/docs/subscriptions.md +634 -0
  115. package/docs/surveys.md +731 -0
  116. package/docs/taggers.md +446 -0
  117. package/docs/task-automations.md +200 -0
  118. package/docs/task-runs.md +654 -0
  119. package/docs/task_channels.md +136 -0
  120. package/docs/task_mentions.md +40 -0
  121. package/docs/tasks.md +776 -0
  122. package/docs/tracing.md +1186 -0
  123. package/docs/uploaded_media.md +44 -0
  124. package/docs/user_home_settings.md +72 -0
  125. package/docs/user_interview_topics.md +1288 -0
  126. package/docs/user_interviews.md +444 -0
  127. package/docs/users.md +1267 -0
  128. package/docs/vision.md +2022 -0
  129. package/docs/visual_review.md +816 -0
  130. package/docs/warehouse_column_annotations.md +224 -0
  131. package/docs/warehouse_column_statistics.md +80 -0
  132. package/docs/warehouse_dag.md +40 -0
  133. package/docs/warehouse_model_paths.md +70 -0
  134. package/docs/warehouse_saved_queries.md +1056 -0
  135. package/docs/warehouse_saved_query_folders.md +318 -0
  136. package/docs/warehouse_tables.md +584 -0
  137. package/docs/warehouse_view_link.md +456 -0
  138. package/docs/warehouse_view_links.md +456 -0
  139. package/docs/web_analytics.md +136 -0
  140. package/docs/web_analytics_achievements.md +200 -0
  141. package/docs/web_experiments.md +194 -0
  142. package/docs/web_vitals.md +74 -0
  143. package/docs/wizard.md +170 -0
  144. package/index.ts +22 -0
  145. package/metadata.ts +41419 -0
  146. package/openapi.json +297382 -0
  147. package/overlay.yaml +23 -0
  148. package/package.json +34 -0
  149. package/provenance.json +24 -0
  150. package/research.json +80 -0
  151. package/types/index.ts +17547 -0
@@ -0,0 +1,1088 @@
1
+ # Experiments
2
+
3
+ ## Operations
4
+
5
+ ### `posthog.experimentsList`
6
+
7
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/`
8
+ - **What it does**: List experiments for the current project. Supports filtering by status and archival state.
9
+ - **OpenAPI operationId**: `experiments_list`
10
+ - **Path params**: None
11
+ - **Query params**: `archived`, `created_by_id`, `event`, `feature_flag_id`, `limit`, `offset`, `order`, `prompt_name`, `search`, `status`
12
+ - **Response codes**: `200`
13
+ - **Transport options**: None
14
+ - **TypeScript**: [Client interface](../types.ts)
15
+
16
+ **Inputs**
17
+
18
+ - Client input type: `{ [key: string]: unknown }`
19
+ - Client transport options: None
20
+
21
+ **Outputs**
22
+
23
+ - Client return type: `{ count: number; next?: string | null; previous?: string | null; results: ({ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature...`
24
+ - OpenAPI response codes: `200`
25
+
26
+ ```ts
27
+ import posthog from "@utdk/posthog";
28
+
29
+ type ExperimentsListInput = Parameters<typeof posthog.experimentsList> extends [infer T, ...unknown[]] ? T : undefined;
30
+ type ExperimentsListOutput = Awaited<ReturnType<typeof posthog.experimentsList>>;
31
+
32
+ const result: ExperimentsListOutput = await posthog.experimentsList();
33
+
34
+ // Result shape (from schema): { count: number; next?: string | null; previous?: string | null; results: ({ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature...
35
+ ```
36
+
37
+ ### `posthog.experimentsCreate`
38
+
39
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/`
40
+ - **What it does**: Create a new experiment in draft status with optional metrics.
41
+ - **OpenAPI operationId**: `experiments_create`
42
+ - **Path params**: None
43
+ - **Query params**: None
44
+ - **Response codes**: `201`
45
+ - **Transport options**: None
46
+ - **TypeScript**: [Client interface](../types.ts)
47
+
48
+ **Inputs**
49
+
50
+ - Client input type: `{ [key: string]: unknown }`
51
+ - Client transport options: None
52
+
53
+ **Outputs**
54
+
55
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
56
+ - OpenAPI response codes: `201`
57
+
58
+ ```ts
59
+ import posthog from "@utdk/posthog";
60
+
61
+ type ExperimentsCreateInput = Parameters<typeof posthog.experimentsCreate> extends [infer T, ...unknown[]] ? T : undefined;
62
+ type ExperimentsCreateOutput = Awaited<ReturnType<typeof posthog.experimentsCreate>>;
63
+
64
+ const result: ExperimentsCreateOutput = await posthog.experimentsCreate();
65
+
66
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
67
+ ```
68
+
69
+ ### `posthog.experimentsDestroy`
70
+
71
+ - **HTTP**: `DELETE /api/projects/{project_id}/experiments/{id}/`
72
+ - **What it does**: Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
73
+ - **OpenAPI operationId**: `experiments_destroy`
74
+ - **Path params**: `id`
75
+ - **Query params**: None
76
+ - **Response codes**: `405`
77
+ - **Transport options**: None
78
+ - **TypeScript**: [Client interface](../types.ts)
79
+
80
+ **Inputs**
81
+
82
+ - Client input type: `{ [key: string]: unknown }`
83
+ - Client transport options: None
84
+
85
+ **Outputs**
86
+
87
+ - Client return type: `unknown`
88
+ - OpenAPI response codes: `405`
89
+
90
+ ```ts
91
+ import posthog from "@utdk/posthog";
92
+
93
+ type ExperimentsDestroyInput = Parameters<typeof posthog.experimentsDestroy> extends [infer T, ...unknown[]] ? T : undefined;
94
+ type ExperimentsDestroyOutput = Awaited<ReturnType<typeof posthog.experimentsDestroy>>;
95
+
96
+ const result: ExperimentsDestroyOutput = await posthog.experimentsDestroy();
97
+
98
+ // Result shape (from schema): unknown
99
+ ```
100
+
101
+ ### `posthog.experimentsRetrieve`
102
+
103
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/{id}/`
104
+ - **What it does**: Retrieve a single experiment by ID, including its current status, metrics, feature flag, and results metadata.
105
+ - **OpenAPI operationId**: `experiments_retrieve`
106
+ - **Path params**: `id`
107
+ - **Query params**: None
108
+ - **Response codes**: `200`
109
+ - **Transport options**: None
110
+ - **TypeScript**: [Client interface](../types.ts)
111
+
112
+ **Inputs**
113
+
114
+ - Client input type: `{ [key: string]: unknown }`
115
+ - Client transport options: None
116
+
117
+ **Outputs**
118
+
119
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
120
+ - OpenAPI response codes: `200`
121
+
122
+ ```ts
123
+ import posthog from "@utdk/posthog";
124
+
125
+ type ExperimentsRetrieveInput = Parameters<typeof posthog.experimentsRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
126
+ type ExperimentsRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsRetrieve>>;
127
+
128
+ const result: ExperimentsRetrieveOutput = await posthog.experimentsRetrieve();
129
+
130
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
131
+ ```
132
+
133
+ ### `posthog.experimentsPartialUpdate`
134
+
135
+ - **HTTP**: `PATCH /api/projects/{project_id}/experiments/{id}/`
136
+ - **What it does**: 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.
137
+ - **OpenAPI operationId**: `experiments_partial_update`
138
+ - **Path params**: `id`
139
+ - **Query params**: None
140
+ - **Response codes**: `200`
141
+ - **Transport options**: None
142
+ - **TypeScript**: [Client interface](../types.ts)
143
+
144
+ **Inputs**
145
+
146
+ - Client input type: `{ [key: string]: unknown }`
147
+ - Client transport options: None
148
+
149
+ **Outputs**
150
+
151
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
152
+ - OpenAPI response codes: `200`
153
+
154
+ ```ts
155
+ import posthog from "@utdk/posthog";
156
+
157
+ type ExperimentsPartialUpdateInput = Parameters<typeof posthog.experimentsPartialUpdate> extends [infer T, ...unknown[]] ? T : undefined;
158
+ type ExperimentsPartialUpdateOutput = Awaited<ReturnType<typeof posthog.experimentsPartialUpdate>>;
159
+
160
+ const result: ExperimentsPartialUpdateOutput = await posthog.experimentsPartialUpdate();
161
+
162
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
163
+ ```
164
+
165
+ ### `posthog.experimentsUpdate`
166
+
167
+ - **HTTP**: `PUT /api/projects/{project_id}/experiments/{id}/`
168
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
169
+
170
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
171
+ decorator on serializer methods and converts them into the same responses the viewset path
172
+ produces (see decorators._result_to_response), so both paths share one contract.
173
+ - **OpenAPI operationId**: `experiments_update`
174
+ - **Path params**: `id`
175
+ - **Query params**: None
176
+ - **Response codes**: `200`
177
+ - **Transport options**: None
178
+ - **TypeScript**: [Client interface](../types.ts)
179
+
180
+ **Inputs**
181
+
182
+ - Client input type: `{ [key: string]: unknown }`
183
+ - Client transport options: None
184
+
185
+ **Outputs**
186
+
187
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
188
+ - OpenAPI response codes: `200`
189
+
190
+ ```ts
191
+ import posthog from "@utdk/posthog";
192
+
193
+ type ExperimentsUpdateInput = Parameters<typeof posthog.experimentsUpdate> extends [infer T, ...unknown[]] ? T : undefined;
194
+ type ExperimentsUpdateOutput = Awaited<ReturnType<typeof posthog.experimentsUpdate>>;
195
+
196
+ const result: ExperimentsUpdateOutput = await posthog.experimentsUpdate();
197
+
198
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
199
+ ```
200
+
201
+ ### `posthog.experimentsArchiveCreate`
202
+
203
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/archive/`
204
+ - **What it does**: Archive an ended experiment.
205
+
206
+ Hides the experiment from the default list view. The experiment can be
207
+ restored at any time by updating archived=false. When the linked feature
208
+ flag is still enabled, pass disable_feature_flag=true to also disable and
209
+ archive it. Returns 400 if the experiment is already archived or has not
210
+ ended yet.
211
+ - **OpenAPI operationId**: `experiments_archive_create`
212
+ - **Path params**: `id`
213
+ - **Query params**: None
214
+ - **Response codes**: `200`
215
+ - **Transport options**: None
216
+ - **TypeScript**: [Client interface](../types.ts)
217
+
218
+ **Inputs**
219
+
220
+ - Client input type: `{ [key: string]: unknown }`
221
+ - Client transport options: None
222
+
223
+ **Outputs**
224
+
225
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
226
+ - OpenAPI response codes: `200`
227
+
228
+ ```ts
229
+ import posthog from "@utdk/posthog";
230
+
231
+ type ExperimentsArchiveCreateInput = Parameters<typeof posthog.experimentsArchiveCreate> extends [infer T, ...unknown[]] ? T : undefined;
232
+ type ExperimentsArchiveCreateOutput = Awaited<ReturnType<typeof posthog.experimentsArchiveCreate>>;
233
+
234
+ const result: ExperimentsArchiveCreateOutput = await posthog.experimentsArchiveCreate();
235
+
236
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
237
+ ```
238
+
239
+ ### `posthog.experimentsCopyToProjectCreate`
240
+
241
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/copy_to_project/`
242
+ - **What it does**: Copy an experiment into another project in the same organization as a new draft.
243
+ - **OpenAPI operationId**: `experiments_copy_to_project_create`
244
+ - **Path params**: `id`
245
+ - **Query params**: None
246
+ - **Response codes**: `200`
247
+ - **Transport options**: None
248
+ - **TypeScript**: [Client interface](../types.ts)
249
+
250
+ **Inputs**
251
+
252
+ - Client input type: `{ [key: string]: unknown }`
253
+ - Client transport options: None
254
+
255
+ **Outputs**
256
+
257
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
258
+ - OpenAPI response codes: `200`
259
+
260
+ ```ts
261
+ import posthog from "@utdk/posthog";
262
+
263
+ type ExperimentsCopyToProjectCreateInput = Parameters<typeof posthog.experimentsCopyToProjectCreate> extends [infer T, ...unknown[]] ? T : undefined;
264
+ type ExperimentsCopyToProjectCreateOutput = Awaited<ReturnType<typeof posthog.experimentsCopyToProjectCreate>>;
265
+
266
+ const result: ExperimentsCopyToProjectCreateOutput = await posthog.experimentsCopyToProjectCreate();
267
+
268
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
269
+ ```
270
+
271
+ ### `posthog.experimentsCreateExposureCohortForExperimentCreate`
272
+
273
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/create_exposure_cohort_for_experiment/`
274
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
275
+
276
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
277
+ decorator on serializer methods and converts them into the same responses the viewset path
278
+ produces (see decorators._result_to_response), so both paths share one contract.
279
+ - **OpenAPI operationId**: `experiments_create_exposure_cohort_for_experiment_create`
280
+ - **Path params**: `id`
281
+ - **Query params**: None
282
+ - **Response codes**: `200`
283
+ - **Transport options**: None
284
+ - **TypeScript**: [Client interface](../types.ts)
285
+
286
+ **Inputs**
287
+
288
+ - Client input type: `{ [key: string]: unknown }`
289
+ - Client transport options: None
290
+
291
+ **Outputs**
292
+
293
+ - Client return type: `unknown`
294
+ - OpenAPI response codes: `200`
295
+
296
+ ```ts
297
+ import posthog from "@utdk/posthog";
298
+
299
+ type ExperimentsCreateExposureCohortForExperimentCreateInput = Parameters<typeof posthog.experimentsCreateExposureCohortForExperimentCreate> extends [infer T, ...unknown[]] ? T : undefined;
300
+ type ExperimentsCreateExposureCohortForExperimentCreateOutput = Awaited<ReturnType<typeof posthog.experimentsCreateExposureCohortForExperimentCreate>>;
301
+
302
+ const result: ExperimentsCreateExposureCohortForExperimentCreateOutput = await posthog.experimentsCreateExposureCohortForExperimentCreate();
303
+
304
+ // Result shape (from schema): unknown
305
+ ```
306
+
307
+ ### `posthog.experimentsDuplicateCreate`
308
+
309
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/duplicate/`
310
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
311
+
312
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
313
+ decorator on serializer methods and converts them into the same responses the viewset path
314
+ produces (see decorators._result_to_response), so both paths share one contract.
315
+ - **OpenAPI operationId**: `experiments_duplicate_create`
316
+ - **Path params**: `id`
317
+ - **Query params**: None
318
+ - **Response codes**: `200`
319
+ - **Transport options**: None
320
+ - **TypeScript**: [Client interface](../types.ts)
321
+
322
+ **Inputs**
323
+
324
+ - Client input type: `{ [key: string]: unknown }`
325
+ - Client transport options: None
326
+
327
+ **Outputs**
328
+
329
+ - Client return type: `unknown`
330
+ - OpenAPI response codes: `200`
331
+
332
+ ```ts
333
+ import posthog from "@utdk/posthog";
334
+
335
+ type ExperimentsDuplicateCreateInput = Parameters<typeof posthog.experimentsDuplicateCreate> extends [infer T, ...unknown[]] ? T : undefined;
336
+ type ExperimentsDuplicateCreateOutput = Awaited<ReturnType<typeof posthog.experimentsDuplicateCreate>>;
337
+
338
+ const result: ExperimentsDuplicateCreateOutput = await posthog.experimentsDuplicateCreate();
339
+
340
+ // Result shape (from schema): unknown
341
+ ```
342
+
343
+ ### `posthog.experimentsEndCreate`
344
+
345
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/end/`
346
+ - **What it does**: End a running experiment without shipping a variant.
347
+
348
+ Sets end_date to now and marks the experiment as stopped. The feature
349
+ flag is NOT modified — users continue to see their assigned variants
350
+ and exposure events ($feature_flag_called) continue to be recorded.
351
+ However, only data up to end_date is included in experiment results.
352
+
353
+ Use this when:
354
+
355
+ - You want to freeze the results window without changing which variant
356
+ users see.
357
+ - A variant was already shipped manually via the feature flag UI and
358
+ the experiment just needs to be marked complete.
359
+
360
+ The end_date can be adjusted after ending via PATCH if it needs to be
361
+ backdated (e.g. to match when the flag was actually paused).
362
+
363
+ Other options:
364
+ - Use ship_variant to end the experiment AND roll out a single variant to 100%% of users.
365
+ - Use pause to deactivate the flag without ending the experiment (stops variant assignment but does not freeze results).
366
+
367
+ Returns 400 if the experiment is not running.
368
+ - **OpenAPI operationId**: `experiments_end_create`
369
+ - **Path params**: `id`
370
+ - **Query params**: None
371
+ - **Response codes**: `200`
372
+ - **Transport options**: None
373
+ - **TypeScript**: [Client interface](../types.ts)
374
+
375
+ **Inputs**
376
+
377
+ - Client input type: `{ [key: string]: unknown }`
378
+ - Client transport options: None
379
+
380
+ **Outputs**
381
+
382
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
383
+ - OpenAPI response codes: `200`
384
+
385
+ ```ts
386
+ import posthog from "@utdk/posthog";
387
+
388
+ type ExperimentsEndCreateInput = Parameters<typeof posthog.experimentsEndCreate> extends [infer T, ...unknown[]] ? T : undefined;
389
+ type ExperimentsEndCreateOutput = Awaited<ReturnType<typeof posthog.experimentsEndCreate>>;
390
+
391
+ const result: ExperimentsEndCreateOutput = await posthog.experimentsEndCreate();
392
+
393
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
394
+ ```
395
+
396
+ ### `posthog.experimentsFreezeExposureCreate`
397
+
398
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/freeze_exposure/`
399
+ - **What it does**: Freeze exposure on a running experiment while metrics keep flowing.
400
+
401
+ Snapshots the already-exposed users into a static cohort and narrows the
402
+ linked feature flag so only those users keep matching — new users can no
403
+ longer enter the experiment. ``end_date`` is left null so long-term metrics
404
+ (revenue/LTV/renewals/retention) keep accumulating. Enrolled users keep
405
+ their assigned variant. The serialized status becomes 'exposure_frozen'.
406
+
407
+ Returns 400 if the experiment is not running, exposure is already frozen,
408
+ the experiment is group-aggregated (group flags cannot be frozen with a
409
+ person cohort), or the exposed set is too large to snapshot synchronously.
410
+ - **OpenAPI operationId**: `experiments_freeze_exposure_create`
411
+ - **Path params**: `id`
412
+ - **Query params**: None
413
+ - **Response codes**: `200`
414
+ - **Transport options**: None
415
+ - **TypeScript**: [Client interface](../types.ts)
416
+
417
+ **Inputs**
418
+
419
+ - Client input type: `{ [key: string]: unknown }`
420
+ - Client transport options: None
421
+
422
+ **Outputs**
423
+
424
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
425
+ - OpenAPI response codes: `200`
426
+
427
+ ```ts
428
+ import posthog from "@utdk/posthog";
429
+
430
+ type ExperimentsFreezeExposureCreateInput = Parameters<typeof posthog.experimentsFreezeExposureCreate> extends [infer T, ...unknown[]] ? T : undefined;
431
+ type ExperimentsFreezeExposureCreateOutput = Awaited<ReturnType<typeof posthog.experimentsFreezeExposureCreate>>;
432
+
433
+ const result: ExperimentsFreezeExposureCreateOutput = await posthog.experimentsFreezeExposureCreate();
434
+
435
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
436
+ ```
437
+
438
+ ### `posthog.experimentsLaunchCreate`
439
+
440
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/launch/`
441
+ - **What it does**: Launch a draft experiment.
442
+
443
+ Validates the experiment is in draft state, activates its linked feature flag,
444
+ sets start_date to the current server time, and transitions the experiment to running.
445
+ Returns 400 if the experiment has already been launched or if the feature flag
446
+ configuration is invalid (e.g. missing "control" variant or fewer than 2 variants).
447
+ - **OpenAPI operationId**: `experiments_launch_create`
448
+ - **Path params**: `id`
449
+ - **Query params**: None
450
+ - **Response codes**: `200`
451
+ - **Transport options**: None
452
+ - **TypeScript**: [Client interface](../types.ts)
453
+
454
+ **Inputs**
455
+
456
+ - Client input type: `{ [key: string]: unknown }`
457
+ - Client transport options: None
458
+
459
+ **Outputs**
460
+
461
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
462
+ - OpenAPI response codes: `200`
463
+
464
+ ```ts
465
+ import posthog from "@utdk/posthog";
466
+
467
+ type ExperimentsLaunchCreateInput = Parameters<typeof posthog.experimentsLaunchCreate> extends [infer T, ...unknown[]] ? T : undefined;
468
+ type ExperimentsLaunchCreateOutput = Awaited<ReturnType<typeof posthog.experimentsLaunchCreate>>;
469
+
470
+ const result: ExperimentsLaunchCreateOutput = await posthog.experimentsLaunchCreate();
471
+
472
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
473
+ ```
474
+
475
+ ### `posthog.experimentsMetricsRecalculationCreate`
476
+
477
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/metrics_recalculation/`
478
+ - **What it does**: Trigger a batch recalculation of all metrics for this experiment.
479
+
480
+ Returns 201 with the new pending recalculation, or 200 with the active one if a recalculation is
481
+ already pending or in progress for this experiment. The response payload intentionally does not
482
+ include the `results` array — at POST time the workflow has just been queued and no per-metric
483
+ results exist yet. Clients should poll `GET metrics_recalculation/{id}/` for results as the workflow
484
+ progresses.
485
+ - **OpenAPI operationId**: `experiments_metrics_recalculation_create`
486
+ - **Path params**: `id`
487
+ - **Query params**: None
488
+ - **Response codes**: `200`, `201`
489
+ - **Transport options**: None
490
+ - **TypeScript**: [Client interface](../types.ts)
491
+
492
+ **Inputs**
493
+
494
+ - Client input type: `{ [key: string]: unknown }`
495
+ - Client transport options: None
496
+
497
+ **Outputs**
498
+
499
+ - Client return type: `{ id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...`
500
+ - OpenAPI response codes: `200`, `201`
501
+
502
+ ```ts
503
+ import posthog from "@utdk/posthog";
504
+
505
+ type ExperimentsMetricsRecalculationCreateInput = Parameters<typeof posthog.experimentsMetricsRecalculationCreate> extends [infer T, ...unknown[]] ? T : undefined;
506
+ type ExperimentsMetricsRecalculationCreateOutput = Awaited<ReturnType<typeof posthog.experimentsMetricsRecalculationCreate>>;
507
+
508
+ const result: ExperimentsMetricsRecalculationCreateOutput = await posthog.experimentsMetricsRecalculationCreate();
509
+
510
+ // Result shape (from schema): { id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...
511
+ ```
512
+
513
+ ### `posthog.experimentsMetricsRecalculationRetrieve`
514
+
515
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/{id}/metrics_recalculation/{recalculation_id}/`
516
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
517
+
518
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
519
+ decorator on serializer methods and converts them into the same responses the viewset path
520
+ produces (see decorators._result_to_response), so both paths share one contract.
521
+ - **OpenAPI operationId**: `experiments_metrics_recalculation_retrieve`
522
+ - **Path params**: `id`, `recalculation_id`
523
+ - **Query params**: None
524
+ - **Response codes**: `200`, `404`
525
+ - **Transport options**: None
526
+ - **TypeScript**: [Client interface](../types.ts)
527
+
528
+ **Inputs**
529
+
530
+ - Client input type: `{ [key: string]: unknown }`
531
+ - Client transport options: None
532
+
533
+ **Outputs**
534
+
535
+ - Client return type: `{ id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...`
536
+ - OpenAPI response codes: `200`, `404`
537
+
538
+ ```ts
539
+ import posthog from "@utdk/posthog";
540
+
541
+ type ExperimentsMetricsRecalculationRetrieveInput = Parameters<typeof posthog.experimentsMetricsRecalculationRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
542
+ type ExperimentsMetricsRecalculationRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsMetricsRecalculationRetrieve>>;
543
+
544
+ const result: ExperimentsMetricsRecalculationRetrieveOutput = await posthog.experimentsMetricsRecalculationRetrieve();
545
+
546
+ // Result shape (from schema): { id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...
547
+ ```
548
+
549
+ ### `posthog.experimentsMetricsRecalculationLatestRetrieve`
550
+
551
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/{id}/metrics_recalculation/latest/`
552
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
553
+
554
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
555
+ decorator on serializer methods and converts them into the same responses the viewset path
556
+ produces (see decorators._result_to_response), so both paths share one contract.
557
+ - **OpenAPI operationId**: `experiments_metrics_recalculation_latest_retrieve`
558
+ - **Path params**: `id`
559
+ - **Query params**: None
560
+ - **Response codes**: `200`, `404`
561
+ - **Transport options**: None
562
+ - **TypeScript**: [Client interface](../types.ts)
563
+
564
+ **Inputs**
565
+
566
+ - Client input type: `{ [key: string]: unknown }`
567
+ - Client transport options: None
568
+
569
+ **Outputs**
570
+
571
+ - Client return type: `{ id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...`
572
+ - OpenAPI response codes: `200`, `404`
573
+
574
+ ```ts
575
+ import posthog from "@utdk/posthog";
576
+
577
+ type ExperimentsMetricsRecalculationLatestRetrieveInput = Parameters<typeof posthog.experimentsMetricsRecalculationLatestRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
578
+ type ExperimentsMetricsRecalculationLatestRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsMetricsRecalculationLatestRetrieve>>;
579
+
580
+ const result: ExperimentsMetricsRecalculationLatestRetrieveOutput = await posthog.experimentsMetricsRecalculationLatestRetrieve();
581
+
582
+ // Result shape (from schema): { id: string; experiment_id: number; status: "pending" | "in_progress" | "completed" | "failed"; total_metrics: number; completed_metrics: number; failed_metrics: number; metric_errors: unknown; trigger: "manual" | "col...
583
+ ```
584
+
585
+ ### `posthog.experimentsPauseCreate`
586
+
587
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/pause/`
588
+ - **What it does**: Pause a running experiment.
589
+
590
+ Deactivates the linked feature flag so it is no longer returned by the
591
+ /decide endpoint. Users fall back to the application default (typically
592
+ the control experience), and no new exposure events are recorded (i.e.
593
+ $feature_flag_called is not fired).
594
+ Returns 400 if the experiment is not running or is already paused.
595
+ - **OpenAPI operationId**: `experiments_pause_create`
596
+ - **Path params**: `id`
597
+ - **Query params**: None
598
+ - **Response codes**: `200`
599
+ - **Transport options**: None
600
+ - **TypeScript**: [Client interface](../types.ts)
601
+
602
+ **Inputs**
603
+
604
+ - Client input type: `{ [key: string]: unknown }`
605
+ - Client transport options: None
606
+
607
+ **Outputs**
608
+
609
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
610
+ - OpenAPI response codes: `200`
611
+
612
+ ```ts
613
+ import posthog from "@utdk/posthog";
614
+
615
+ type ExperimentsPauseCreateInput = Parameters<typeof posthog.experimentsPauseCreate> extends [infer T, ...unknown[]] ? T : undefined;
616
+ type ExperimentsPauseCreateOutput = Awaited<ReturnType<typeof posthog.experimentsPauseCreate>>;
617
+
618
+ const result: ExperimentsPauseCreateOutput = await posthog.experimentsPauseCreate();
619
+
620
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
621
+ ```
622
+
623
+ ### `posthog.experimentsRecalculateTimeseriesCreate`
624
+
625
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/recalculate_timeseries/`
626
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
627
+
628
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
629
+ decorator on serializer methods and converts them into the same responses the viewset path
630
+ produces (see decorators._result_to_response), so both paths share one contract.
631
+ - **OpenAPI operationId**: `experiments_recalculate_timeseries_create`
632
+ - **Path params**: `id`
633
+ - **Query params**: None
634
+ - **Response codes**: `200`
635
+ - **Transport options**: None
636
+ - **TypeScript**: [Client interface](../types.ts)
637
+
638
+ **Inputs**
639
+
640
+ - Client input type: `{ [key: string]: unknown }`
641
+ - Client transport options: None
642
+
643
+ **Outputs**
644
+
645
+ - Client return type: `unknown`
646
+ - OpenAPI response codes: `200`
647
+
648
+ ```ts
649
+ import posthog from "@utdk/posthog";
650
+
651
+ type ExperimentsRecalculateTimeseriesCreateInput = Parameters<typeof posthog.experimentsRecalculateTimeseriesCreate> extends [infer T, ...unknown[]] ? T : undefined;
652
+ type ExperimentsRecalculateTimeseriesCreateOutput = Awaited<ReturnType<typeof posthog.experimentsRecalculateTimeseriesCreate>>;
653
+
654
+ const result: ExperimentsRecalculateTimeseriesCreateOutput = await posthog.experimentsRecalculateTimeseriesCreate();
655
+
656
+ // Result shape (from schema): unknown
657
+ ```
658
+
659
+ ### `posthog.experimentsResetCreate`
660
+
661
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/reset/`
662
+ - **What it does**: Reset an experiment back to draft state.
663
+
664
+ Clears start/end dates, conclusion, and archived flag. The feature
665
+ flag is left unchanged — users continue to see their assigned variants.
666
+
667
+ Previously collected events still exist but won't be included in
668
+ results unless the start date is manually adjusted after re-launch.
669
+
670
+ Returns 400 if the experiment is already in draft state.
671
+ - **OpenAPI operationId**: `experiments_reset_create`
672
+ - **Path params**: `id`
673
+ - **Query params**: None
674
+ - **Response codes**: `200`
675
+ - **Transport options**: None
676
+ - **TypeScript**: [Client interface](../types.ts)
677
+
678
+ **Inputs**
679
+
680
+ - Client input type: `{ [key: string]: unknown }`
681
+ - Client transport options: None
682
+
683
+ **Outputs**
684
+
685
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
686
+ - OpenAPI response codes: `200`
687
+
688
+ ```ts
689
+ import posthog from "@utdk/posthog";
690
+
691
+ type ExperimentsResetCreateInput = Parameters<typeof posthog.experimentsResetCreate> extends [infer T, ...unknown[]] ? T : undefined;
692
+ type ExperimentsResetCreateOutput = Awaited<ReturnType<typeof posthog.experimentsResetCreate>>;
693
+
694
+ const result: ExperimentsResetCreateOutput = await posthog.experimentsResetCreate();
695
+
696
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
697
+ ```
698
+
699
+ ### `posthog.experimentsResumeCreate`
700
+
701
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/resume/`
702
+ - **What it does**: Resume a paused experiment.
703
+
704
+ Reactivates the linked feature flag so it is returned by /decide again.
705
+ Users are re-bucketed deterministically into the same variants they had
706
+ before the pause, and exposure tracking resumes.
707
+ Returns 400 if the experiment is not running or is not paused.
708
+ - **OpenAPI operationId**: `experiments_resume_create`
709
+ - **Path params**: `id`
710
+ - **Query params**: None
711
+ - **Response codes**: `200`
712
+ - **Transport options**: None
713
+ - **TypeScript**: [Client interface](../types.ts)
714
+
715
+ **Inputs**
716
+
717
+ - Client input type: `{ [key: string]: unknown }`
718
+ - Client transport options: None
719
+
720
+ **Outputs**
721
+
722
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
723
+ - OpenAPI response codes: `200`
724
+
725
+ ```ts
726
+ import posthog from "@utdk/posthog";
727
+
728
+ type ExperimentsResumeCreateInput = Parameters<typeof posthog.experimentsResumeCreate> extends [infer T, ...unknown[]] ? T : undefined;
729
+ type ExperimentsResumeCreateOutput = Awaited<ReturnType<typeof posthog.experimentsResumeCreate>>;
730
+
731
+ const result: ExperimentsResumeCreateOutput = await posthog.experimentsResumeCreate();
732
+
733
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
734
+ ```
735
+
736
+ ### `posthog.experimentsShipVariantCreate`
737
+
738
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/ship_variant/`
739
+ - **What it does**: Ship a variant and (optionally) end the experiment.
740
+
741
+ Updates the feature flag so the selected variant gets 100% of the variant
742
+ distribution. By default, existing release conditions on the flag are preserved
743
+ untouched — the variant is served only to users who already match them. Pass
744
+ ``release_to_everyone: true`` to also prepend a catch-all release condition
745
+ that rolls the variant out to 100% of users (overrides any existing release
746
+ conditions on the flag).
747
+
748
+ Can be called on both running and stopped experiments. If the experiment is
749
+ still running, it will also be ended (end_date set and status marked as stopped).
750
+ If the experiment has already ended, only the flag is rewritten - this supports
751
+ the "end first, ship later" workflow.
752
+
753
+ If an approval policy requires review before changes on the flag take effect,
754
+ the API returns 409 with a change_request_id. The experiment is NOT ended until
755
+ the change request is approved and the user retries.
756
+
757
+ Returns 400 if the experiment is in draft state, the variant_key is not found
758
+ on the flag, or the experiment has no linked feature flag.
759
+ - **OpenAPI operationId**: `experiments_ship_variant_create`
760
+ - **Path params**: `id`
761
+ - **Query params**: None
762
+ - **Response codes**: `200`
763
+ - **Transport options**: None
764
+ - **TypeScript**: [Client interface](../types.ts)
765
+
766
+ **Inputs**
767
+
768
+ - Client input type: `{ [key: string]: unknown }`
769
+ - Client transport options: None
770
+
771
+ **Outputs**
772
+
773
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
774
+ - OpenAPI response codes: `200`
775
+
776
+ ```ts
777
+ import posthog from "@utdk/posthog";
778
+
779
+ type ExperimentsShipVariantCreateInput = Parameters<typeof posthog.experimentsShipVariantCreate> extends [infer T, ...unknown[]] ? T : undefined;
780
+ type ExperimentsShipVariantCreateOutput = Awaited<ReturnType<typeof posthog.experimentsShipVariantCreate>>;
781
+
782
+ const result: ExperimentsShipVariantCreateOutput = await posthog.experimentsShipVariantCreate();
783
+
784
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
785
+ ```
786
+
787
+ ### `posthog.experimentsTimeseriesResultsRetrieve`
788
+
789
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/{id}/timeseries_results/`
790
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
791
+
792
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
793
+ decorator on serializer methods and converts them into the same responses the viewset path
794
+ produces (see decorators._result_to_response), so both paths share one contract.
795
+ - **OpenAPI operationId**: `experiments_timeseries_results_retrieve`
796
+ - **Path params**: `id`
797
+ - **Query params**: `fingerprint`, `metric_uuid`
798
+ - **Response codes**: `200`
799
+ - **Transport options**: None
800
+ - **TypeScript**: [Client interface](../types.ts)
801
+
802
+ **Inputs**
803
+
804
+ - Client input type: `{ [key: string]: unknown }`
805
+ - Client transport options: None
806
+
807
+ **Outputs**
808
+
809
+ - Client return type: `unknown`
810
+ - OpenAPI response codes: `200`
811
+
812
+ ```ts
813
+ import posthog from "@utdk/posthog";
814
+
815
+ type ExperimentsTimeseriesResultsRetrieveInput = Parameters<typeof posthog.experimentsTimeseriesResultsRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
816
+ type ExperimentsTimeseriesResultsRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsTimeseriesResultsRetrieve>>;
817
+
818
+ const result: ExperimentsTimeseriesResultsRetrieveOutput = await posthog.experimentsTimeseriesResultsRetrieve();
819
+
820
+ // Result shape (from schema): unknown
821
+ ```
822
+
823
+ ### `posthog.experimentsUnarchiveCreate`
824
+
825
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/unarchive/`
826
+ - **What it does**: Unarchive an archived experiment.
827
+
828
+ Restores the experiment to the default list view. Returns 400 if the
829
+ experiment is not currently archived.
830
+ - **OpenAPI operationId**: `experiments_unarchive_create`
831
+ - **Path params**: `id`
832
+ - **Query params**: None
833
+ - **Response codes**: `200`
834
+ - **Transport options**: None
835
+ - **TypeScript**: [Client interface](../types.ts)
836
+
837
+ **Inputs**
838
+
839
+ - Client input type: `{ [key: string]: unknown }`
840
+ - Client transport options: None
841
+
842
+ **Outputs**
843
+
844
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
845
+ - OpenAPI response codes: `200`
846
+
847
+ ```ts
848
+ import posthog from "@utdk/posthog";
849
+
850
+ type ExperimentsUnarchiveCreateInput = Parameters<typeof posthog.experimentsUnarchiveCreate> extends [infer T, ...unknown[]] ? T : undefined;
851
+ type ExperimentsUnarchiveCreateOutput = Awaited<ReturnType<typeof posthog.experimentsUnarchiveCreate>>;
852
+
853
+ const result: ExperimentsUnarchiveCreateOutput = await posthog.experimentsUnarchiveCreate();
854
+
855
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
856
+ ```
857
+
858
+ ### `posthog.experimentsUnfreezeExposureCreate`
859
+
860
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/{id}/unfreeze_exposure/`
861
+ - **What it does**: Reopen enrollment on an exposure-frozen experiment.
862
+
863
+ Removes the snapshot-cohort condition and freeze markers from every release
864
+ group, restoring the flag's original targeting: new users can enroll again
865
+ and already-enrolled users keep their assigned variant. The snapshot cohort
866
+ is soft-deleted. The serialized status returns to 'running'.
867
+
868
+ Returns 400 if the experiment is not running or its exposure is not frozen.
869
+ - **OpenAPI operationId**: `experiments_unfreeze_exposure_create`
870
+ - **Path params**: `id`
871
+ - **Query params**: None
872
+ - **Response codes**: `200`
873
+ - **Transport options**: None
874
+ - **TypeScript**: [Client interface](../types.ts)
875
+
876
+ **Inputs**
877
+
878
+ - Client input type: `{ [key: string]: unknown }`
879
+ - Client transport options: None
880
+
881
+ **Outputs**
882
+
883
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
884
+ - OpenAPI response codes: `200`
885
+
886
+ ```ts
887
+ import posthog from "@utdk/posthog";
888
+
889
+ type ExperimentsUnfreezeExposureCreateInput = Parameters<typeof posthog.experimentsUnfreezeExposureCreate> extends [infer T, ...unknown[]] ? T : undefined;
890
+ type ExperimentsUnfreezeExposureCreateOutput = Awaited<ReturnType<typeof posthog.experimentsUnfreezeExposureCreate>>;
891
+
892
+ const result: ExperimentsUnfreezeExposureCreateOutput = await posthog.experimentsUnfreezeExposureCreate();
893
+
894
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
895
+ ```
896
+
897
+ ### `posthog.experimentsCalculateRunningTimeCreate`
898
+
899
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/calculate_running_time/`
900
+ - **What it does**: Estimate the recommended sample size and running time for an experiment.
901
+
902
+ Pure statistical calculation — does not read or write any experiment. Pass the metric type, a
903
+ minimum detectable effect, and either a baseline value or raw baseline statistics. When
904
+ `exposure_rate_per_day` is provided, the response also includes the estimated running time in days.
905
+ - **OpenAPI operationId**: `experiments_calculate_running_time_create`
906
+ - **Path params**: None
907
+ - **Query params**: None
908
+ - **Response codes**: `200`
909
+ - **Transport options**: None
910
+ - **TypeScript**: [Client interface](../types.ts)
911
+
912
+ **Inputs**
913
+
914
+ - Client input type: `{ [key: string]: unknown }`
915
+ - Client transport options: None
916
+
917
+ **Outputs**
918
+
919
+ - Client return type: `{ baseline_value: number | null; variance: number | null; recommended_sample_size: number | null; recommended_running_time_days: number | null }`
920
+ - OpenAPI response codes: `200`
921
+
922
+ ```ts
923
+ import posthog from "@utdk/posthog";
924
+
925
+ type ExperimentsCalculateRunningTimeCreateInput = Parameters<typeof posthog.experimentsCalculateRunningTimeCreate> extends [infer T, ...unknown[]] ? T : undefined;
926
+ type ExperimentsCalculateRunningTimeCreateOutput = Awaited<ReturnType<typeof posthog.experimentsCalculateRunningTimeCreate>>;
927
+
928
+ const result: ExperimentsCalculateRunningTimeCreateOutput = await posthog.experimentsCalculateRunningTimeCreate();
929
+
930
+ // Result shape (from schema): { baseline_value: number | null; variance: number | null; recommended_sample_size: number | null; recommended_running_time_days: number | null }
931
+ ```
932
+
933
+ ### `posthog.experimentsCreateFromPromptCreate`
934
+
935
+ - **HTTP**: `POST /api/projects/{project_id}/experiments/create_from_prompt/`
936
+ - **What it does**: Create an experiment that compares N versions of an LLM prompt using a metric template.
937
+
938
+ The user picks 2+ versions of an existing LLMPrompt and 1+ metric templates
939
+ (cost / latency / eval_pass_rate). The endpoint builds the matching variants
940
+ (control + test-N, each named after its prompt version) and attaches one
941
+ metric per selected template, each scoped to the prompt's $ai_prompt_name.
942
+ Resulting experiment is in draft state.
943
+ - **OpenAPI operationId**: `experiments_create_from_prompt_create`
944
+ - **Path params**: None
945
+ - **Query params**: None
946
+ - **Response codes**: `200`
947
+ - **Transport options**: None
948
+ - **TypeScript**: [Client interface](../types.ts)
949
+
950
+ **Inputs**
951
+
952
+ - Client input type: `{ [key: string]: unknown }`
953
+ - Client transport options: None
954
+
955
+ **Outputs**
956
+
957
+ - Client return type: `{ id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...`
958
+ - OpenAPI response codes: `200`
959
+
960
+ ```ts
961
+ import posthog from "@utdk/posthog";
962
+
963
+ type ExperimentsCreateFromPromptCreateInput = Parameters<typeof posthog.experimentsCreateFromPromptCreate> extends [infer T, ...unknown[]] ? T : undefined;
964
+ type ExperimentsCreateFromPromptCreateOutput = Awaited<ReturnType<typeof posthog.experimentsCreateFromPromptCreate>>;
965
+
966
+ const result: ExperimentsCreateFromPromptCreateOutput = await posthog.experimentsCreateFromPromptCreate();
967
+
968
+ // Result shape (from schema): { id: number; name: string; description?: string | null; start_date?: string | null; end_date?: string | null; feature_flag_key: string; feature_flag: { id: number; team_id: number; name?: string; key: string; filters?:...
969
+ ```
970
+
971
+ ### `posthog.experimentsEligibleFeatureFlagsRetrieve`
972
+
973
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/eligible_feature_flags/`
974
+ - **What it does**: Returns a paginated list of feature flags eligible for use in experiments.
975
+
976
+ Eligible flags must:
977
+ - Be multivariate with at least 2 variants
978
+ - Have "control" as the first variant key
979
+
980
+ Query parameters:
981
+ - search: Filter by flag key or name (case insensitive)
982
+ - limit: Number of results per page (default: 20)
983
+ - offset: Pagination offset (default: 0)
984
+ - active: Filter by active status ("true" or "false")
985
+ - created_by_id: Filter by creator user ID
986
+ - order: Sort order field
987
+ - evaluation_runtime: Filter by evaluation runtime
988
+ - has_evaluation_contexts: Filter by presence of evaluation contexts ("true" or "false")
989
+ - **OpenAPI operationId**: `experiments_eligible_feature_flags_retrieve`
990
+ - **Path params**: None
991
+ - **Query params**: None
992
+ - **Response codes**: `200`
993
+ - **Transport options**: None
994
+ - **TypeScript**: [Client interface](../types.ts)
995
+
996
+ **Inputs**
997
+
998
+ - Client input type: `{ [key: string]: unknown }`
999
+ - Client transport options: None
1000
+
1001
+ **Outputs**
1002
+
1003
+ - Client return type: `unknown`
1004
+ - OpenAPI response codes: `200`
1005
+
1006
+ ```ts
1007
+ import posthog from "@utdk/posthog";
1008
+
1009
+ type ExperimentsEligibleFeatureFlagsRetrieveInput = Parameters<typeof posthog.experimentsEligibleFeatureFlagsRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
1010
+ type ExperimentsEligibleFeatureFlagsRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsEligibleFeatureFlagsRetrieve>>;
1011
+
1012
+ const result: ExperimentsEligibleFeatureFlagsRetrieveOutput = await posthog.experimentsEligibleFeatureFlagsRetrieve();
1013
+
1014
+ // Result shape (from schema): unknown
1015
+ ```
1016
+
1017
+ ### `posthog.experimentsPromptTemplatesRetrieve`
1018
+
1019
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/prompt_templates/`
1020
+ - **What it does**: List the LLM metric templates that can be passed to `create_from_prompt`.
1021
+ - **OpenAPI operationId**: `experiments_prompt_templates_retrieve`
1022
+ - **Path params**: None
1023
+ - **Query params**: None
1024
+ - **Response codes**: `200`
1025
+ - **Transport options**: None
1026
+ - **TypeScript**: [Client interface](../types.ts)
1027
+
1028
+ **Inputs**
1029
+
1030
+ - Client input type: `{ [key: string]: unknown }`
1031
+ - Client transport options: None
1032
+
1033
+ **Outputs**
1034
+
1035
+ - Client return type: `({ key: string; label: string; description: string })[]`
1036
+ - OpenAPI response codes: `200`
1037
+
1038
+ ```ts
1039
+ import posthog from "@utdk/posthog";
1040
+
1041
+ type ExperimentsPromptTemplatesRetrieveInput = Parameters<typeof posthog.experimentsPromptTemplatesRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
1042
+ type ExperimentsPromptTemplatesRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsPromptTemplatesRetrieve>>;
1043
+
1044
+ const result: ExperimentsPromptTemplatesRetrieveOutput = await posthog.experimentsPromptTemplatesRetrieve();
1045
+
1046
+ // Result shape (from schema): ({ key: string; label: string; description: string })[]
1047
+ ```
1048
+
1049
+ ### `posthog.experimentsStatsRetrieve`
1050
+
1051
+ - **HTTP**: `GET /api/projects/{project_id}/experiments/stats/`
1052
+ - **What it does**: Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.
1053
+
1054
+ Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate
1055
+ decorator on serializer methods and converts them into the same responses the viewset path
1056
+ produces (see decorators._result_to_response), so both paths share one contract.
1057
+ - **OpenAPI operationId**: `experiments_stats_retrieve`
1058
+ - **Path params**: None
1059
+ - **Query params**: None
1060
+ - **Response codes**: `200`
1061
+ - **Transport options**: None
1062
+ - **TypeScript**: [Client interface](../types.ts)
1063
+
1064
+ **Inputs**
1065
+
1066
+ - Client input type: `{ [key: string]: unknown }`
1067
+ - Client transport options: None
1068
+
1069
+ **Outputs**
1070
+
1071
+ - Client return type: `unknown`
1072
+ - OpenAPI response codes: `200`
1073
+
1074
+ ```ts
1075
+ import posthog from "@utdk/posthog";
1076
+
1077
+ type ExperimentsStatsRetrieveInput = Parameters<typeof posthog.experimentsStatsRetrieve> extends [infer T, ...unknown[]] ? T : undefined;
1078
+ type ExperimentsStatsRetrieveOutput = Awaited<ReturnType<typeof posthog.experimentsStatsRetrieve>>;
1079
+
1080
+ const result: ExperimentsStatsRetrieveOutput = await posthog.experimentsStatsRetrieve();
1081
+
1082
+ // Result shape (from schema): unknown
1083
+ ```
1084
+
1085
+
1086
+ <!-- prompt-hash:
1087
+ 8c3694991a4c289225f05a4e8f1e098cc74d085a088d7dffd82f00d93797b7f8
1088
+ -->