---
title: "End Experiment"
method: POST
path: "/experiments/{id}/end"
tags: ["Experiments"]
---

# End Experiment

`POST /experiments/{id}/end`

Concludes the experiment and records required `findings`. Pass `winning_arm` to serve the winning treatment to everyone; omit it when control won. Ended experiments cannot restart, but may be ended again to correct the winner. Requires experiment:manage on the account, or internal access for platform experiments.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `findings` string, required — What you learned and why you chose this outcome. Required.
  - `winning_arm` string, nullable — The treatment that won. Setting it rolls that arm out: every later evaluation returns it to every caller, ignoring targeting and allocation, and exposures stop being recorded. Omit it when control won — an ended experiment with no winning arm evaluates to `control` for everyone, so ending again without one also reverts a rollout recorded by mistake. Not accepted on feature flags, which evaluate to disabled once ended.

## Response `200`

experiment ended

- Experiment
  - `account_id` string, required — Owning account ID, or internal for Whop platform experiments.
  - `assignment_seed` string, required — Assignment hashes UTF-8 seed + subject ID with CRC32 modulo 100 and selects the stored end-exclusive range.
  - `bucket_by` 'user' | 'account' | 'anonymous', nullable — Randomization unit — `user` buckets each user independently, `account` buckets whole accounts (every user of an account gets the same arm). `null` for feature flags.
  - `configuration_revision` integer, required — Revision of the serving configuration. Does not change the assignment seed.
  - `control` object, required
    - `related_resource` ExperimentResourceReference
      - `id` string, required — Referenced resource tag, belonging to the experiment owner.
      - `object` 'app' | 'app_build' | 'product' | 'plan', required
  - `created_at` string, nullable — When the experiment was created, as an ISO 8601 timestamp.
  - `created_by` string, nullable — ID of the user who created the experiment, prefixed `user_`. `null` for experiments created before creators were recorded.
  - `ended_at` string, nullable — When the experiment stopped collecting data, as an ISO 8601 timestamp. `null` while still running.
  - `feature_flag_only` boolean, nullable — `true` when this was created as a feature flag rather than a full experiment. Feature flags share the same evaluation API but do not collect metric results.
  - `findings` string, nullable — What was learned and why this outcome, recorded when the experiment was ended. `null` until then.
  - `flag_key` string, required — Developer-chosen handle referenced from code. Anywhere the API takes an experiment identifier, the `expt_` id and the flag_key are interchangeable.
  - `hypothesis` string, nullable — Hypothesis for this experiment. `null` when none is set, and always `null` for feature flags.
  - `id` string, required — Unique identifier for the experiment, prefixed `expt_`.
  - `name` string, required — Human-readable display name.
  - `related_resource` ExperimentResourceReference, required
    - `id` string, required — Referenced resource tag, belonging to the experiment owner.
    - `object` 'app' | 'app_build' | 'product' | 'plan', required
  - `started_at` string, nullable — When the experiment began collecting data, as an ISO 8601 timestamp. `null` for drafts.
  - `status` 'draft' | 'active' | 'paused' | 'ended', required — Lifecycle state. `draft` — not yet live; `active` — currently running; `paused` — traffic paused; `ended` — concluded.
  - `targeting_rules` object[], required — Rules gating who is in the experiment at all. Conditions within a rule are AND-ed, rules are OR-ed, and `exclude` rules always win. Empty means everyone qualifies.
    - `conditions` object[], required — Conditions within this rule, all of which must match.
      - `field` string, nullable — Property name to read from the user context. Present when `type` is `property`.
      - `operator` 'any' | 'none' | 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte', required — Comparison to apply.
      - `type` 'user_id' | 'account_id' | 'property', required — What the condition matches on: the user ID, the account ID, or a named user property.
      - `value` unknown, required
    - `type` 'include' | 'exclude' — `include` — users matching this rule qualify; `exclude` — users matching this rule are always excluded, overriding any include rule.
  - `updated_at` string, date_time, nullable, required
  - `variants` object[], required — Treatment arms. Users outside every arm's allocation form the implicit `control` group. Weights only ever grow and arms are never removed, so a user moves from control into a treatment at most once.
    - `name` string, required — Treatment identifier. `control` is reserved — it is the implicit remainder.
    - `ranges` array[] — Granted bucket ranges (1% units, end-exclusive) recording this arm's allocation history. Server-managed; ranges are only ever appended, which is what keeps assignments permanent.
      - integer[]
    - `related_resource` ExperimentResourceReference
      - `id` string, required — Referenced resource tag, belonging to the experiment owner.
      - `object` 'app' | 'app_build' | 'product' | 'plan', required
    - `weight` integer, required — Percentage of all users assigned to this treatment, 1–100. All weights together sum to at most 100; the remainder is control.
  - `winning_arm` string, nullable — The treatment that won, set when the experiment was ended. Once set, every evaluation returns this arm to every caller regardless of targeting or allocation, and no further exposures are recorded. `null` means control won — an ended experiment with no winning arm evaluates to `control` for everyone. Always `null` for feature flags, which simply evaluate to disabled once ended.

## Other responses

- `400` — Invalid Parameters
- `409` — Conflict

---

[API](https://skmtc.dev/whop/apis/whop-api.md) · [All operations](https://skmtc.dev/whop/apis/whop-api/llms.txt) · [OpenAPI document](https://skmtc.dev/whop/apis/whop-api/revisions/35edb053220a?raw)
