Start a widget experiment
Starts an A/B test of two saved widget versions, arm A (a version of the widget in the path) and arm B (a version of the same widget or, with `widgetId`, of another widget of the site on the same pages). Neither has to be the live version, and a version tested before can be used again. Each session is assigned to one arm at its first eligible page view, 50/50, and keeps it. The floor of sessions per arm is set by the system and the split is fixed, so the body names the two arms and, when needed, what you confirm. Both versions can no longer change once it starts. The start can take other live widgets on an arm's mount slot offline and replaces the live version of an arm's widget for the test's sessions: call `POST /experiments/preview` first and send what it names in `confirm`. Refused with `widget_experiment_refused` when it cannot start: its `reason` is `same_arm` (the two arms are the same version), `widget_held` (a widget is already in a running test), `no_page_type` (a version shows on no page type), `targeting_mismatch` (the arms target different pages or hold different page rules: same page types on every device, desktop and mobile, and the same rules by products and collections, in any order), `perimeter_overlap` (another test runs on some of the same pages), `holdout_running` (a holdout runs on the site) or `confirmation_required` (the start would take live widgets offline or replace live versions and `confirm` does not cover them: the problem carries a `confirmation` member with what to send back). A widget or version that is not in the site is a `404`. Records an audit entry (`engagement_widget.experiment_started`) attributed to the API key.
ApiKeyAuthAuthorizationBearer <token>A WorkOS org-scoped API key, created from the dashboard's organization settings page. Identifies the tenant every read and write is scoped to. Missing, malformed, unknown, revoked, expired, or non-organization-owned keys all return 401 (no distinction, so the response can't be used to probe which keys or org ids exist).
siteId*stringThe site id (prefixed site_). A site id that isn't yours is a 404, same as any other cross-tenant id.
widgetId*stringThe widget id (prefixed ewgt_). For an experiment it may be the widget of either arm.
application/json- body
The split (50/50) and the floor are not inputs: a body that names anything else is refused with 400.
arms*array<>The two arms, [arm A, arm B]. They must be two different versions.
2 <= items <= 2confirm?What you accept the start to change. Optional when the preview says no confirmation is required; the start is refused with confirmation_required unless it covers everything the start would change.
The experiment that just started.
application/json- response
data*A widget A/B test with its per-arm counts and verdict.
curl -X POST 'https://example.com/api/v1/sites/string/engagement-widgets/string/experiments' \ -H 'Content-Type: application/json' \ -d '{ "arms": [ { "versionId": "ewgv_01kvnwmagvf27rc9cze5rm9e1r" }, { "widgetId": "ewgt_01kvnwmagwf27rc9d7zef4qksf", "versionId": "ewgv_01kvnwmagwf27rc9d7zef4qksf" } ], "confirm": { "offlineWidgetIds": [], "displacedLiveVersions": true }}'{ "data": { "id": "ewxp_01kvnwmagvf27rc9cze5rm9e1r", "status": "running", "endedReason": null, "startedAt": "2026-11-02T09:30:00.000Z", "endedAt": null, "floorPerArm": 2400, "splitPercent": 50, "arms": [ { "arm": "a", "widgetId": "ewgt_01kvnwmagvf27rc9cze5rm9e1r", "versionId": "ewgv_01kvnwmagvf27rc9cze5rm9e1r", "assignedSessions": 0, "startedSessions": 0, "startRate": null }, { "arm": "b", "widgetId": "ewgt_01kvnwmagwf27rc9d7zef4qksf", "versionId": "ewgv_01kvnwmagwf27rc9d7zef4qksf", "assignedSessions": 0, "startedSessions": 0, "startRate": null } ], "verdict": { "state": "below_floor", "winner": null } }}List a widget's experiments
Returns a summary of the A/B tests where the widget is the widget of either arm, newest first, at most 50: the status, when it started and ended, why it ended, the floor, the split and the two arms (each with its widget and version). It carries no count and no verdict: read one experiment with `GET /experiments/{experimentId}`.
Preview a widget experiment start
A dry run of the start: takes the start body without `confirm` and answers which live widgets the start would take offline and which live versions it would replace, so you can send them back as `confirm`. Nothing is written and no audit entry is recorded. Every other refusal of the start (`widget_experiment_refused`, with its closed `reason`, or a `404` for a widget or version that is not in the site) is answered as the start would answer it.