Experiments

Evaluate Experiments

Changed on

Evaluates experiments and feature flags for a subject and records an exposure. Pass flag_key to evaluate one flag, or omit it to evaluate every active flag in the account and related resource scope. Requires no authentication; when a credential resolves, its authentication method, API key ID, and signed-in user ID are recorded on the exposure event.

get/experiments/exposures

Request

  • Base URL
    https://api.whop.com/api/v1
  • URL
    https://api.whop.com/api/v1/experiments/exposures
  • Auth
    • HTTP bearer
    • or none

Query parameters

account_idstring
anonymous_idstring
user_idstring

Bucketing subject: the user, account, or anonymous ID the experiment's bucket_by assigns on. Only the identity matching bucket_by is used; when it is missing, evaluating a single flag fails and a batch omits that experiment. Subjects outside every treatment range receive control. subject[account_id] also enables account-level targeting rules. Experiment ownership comes from the top-level account_id.

idstring required

Referenced resource tag, belonging to the experiment owner.

object'app' | 'app_build' | 'product' | 'plan' required

Restricts batch evaluation to this related resource; omitted batches contain only unbound experiments.

{
  "object": "app"
}
flag_keystring

Flag or experiment to evaluate — the flag_key handle or the expt_ id. Omit to return all flags the caller qualifies for.

account_idstring

Owning account ID. Required when evaluating by flag_key or in a batch; optional for an expt_ ID.

JSON-encoded scalar values that property targeting conditions match against. Numeric and boolean strings are coerced. Nested query keys such as properties[variant]=pro remain accepted for existing callers.

log_exposureboolean

Set false to read an assignment without recording an exposure, such as when a client caches assignments up front and records the exposure when the arm is rendered. Omitted records the exposure.

Response

single flag evaluated

OR

Example response

{
  "enabled": true,
  "flag_key": "checkout_redesign",
  "related_resource": {
    "object": "app"
  },
  "variant": "treatment"
}

Changes