Skip to main content
Starting a test needs the Pro plan: below it, POST /ab-tests answers 403 with code: FEATURE_LOCKED and details.feature: "abTests". Reading, stopping, declaring a winner and deleting are never gated. Every route works in the API key’s mode (live or test).

Start a test

variants are the challengers (B, C, D). Variant A is the product as it is now and is added for you.
Optional: name, and weights — the traffic split in whole percents, A first, each 5–95, adding up to 100 (default: equal).

Routes

Results

  • pValue — two-proportion z-test of the conversion rate against A (two-sided). Under 0.05 = 95% confident they differ.
  • probabilityToBeat — Bayesian chance (flat prior, exact) the variant’s conversion rate is higher than A’s.
  • revenueProbabilityToBeat — price tests: chance the variant earns more per visitor. Price tests are judged on this (metric: "revenue_per_visitor").
  • verdict — collecting until both arms have 100+ visitors and 10+ conversions between them; then winning, losing or no_difference.
  • Conversions are paid, unrefunded sales credited to the variant the buyer saw; revenue is in your account currency.

Visitor assignment

POST /ab-tests/public/assign with { productId, visitorId, currency? } returns { test: { testId, variantId, type, basePrice, overrides } } or { test: null }. visitorId is the visitor’s own random id (16–64 characters of A-Z a-z 0-9 _ -); the same id always gets the same variant, and the first call logs the visit. Bots get null. With currency, a price variant also comes back as displayPrice, converted exactly as checkout will charge it. The hosted product page and checkout send the same id as abVisitor, and the variant they actually rendered as abVariant, when they create the checkout session. The server charges the variant only when abVariant matches its own record of the visitor; otherwise (no claim, "", or another id — the page could not load the variant) it charges the product’s own price and the sale is not credited to the test. A price never comes from the page. GET /pricing/quote/{productId} and GET /personal-deadlines/public/offer take the same pair as vid + abv.

Webhook

ab_test.completed fires when a test ends — a winner was declared, it was stopped, or a conflicting product edit stopped it — with every variant’s results. See Webhook events.

MCP tools

list_ab_tests, create_ab_test, get_ab_test, get_ab_test_results, stop_ab_test, declare_ab_test_winner, delete_ab_test.