EngagIQ API

Message variants

EngagIQ’s auto-tuning message A/B testing surface. Register an experiment, log impressions + conversions, then read the recommended variant — picked with a Wilson lower-bound at 95% confidence.

Live demo — experiment welcome_push_v1
Recommended variant
The GET report below hits /api/variants/welcome_push_v1. Numbers are refreshed daily by the seed-variants cron.
How the recommendation is picked
EngagIQ ranks variants by their Wilson lower bound at z = 1.96 — a closed-form 95% confidence lower bound on the true conversion rate. The variant with the highest Wilson LB wins, provided it leads the runner-up by ≥ 2% and every variant has at least 20 logged impressions. Otherwise insufficient_data is returned with a reason and EngagIQ keeps its current strategy.

Endpoints

Try a request →
POST/api/variants
POST /api/variants

Register (or replace) an experiment and its variant set. Idempotent on experimentId — re-running replaces the variant list.

Body

{ experimentId, variants: [{ id, copy }, ...] }

Returns · 201 with the persisted ExperimentItem.

POST/api/variants/{experiment_id}/impression
POST /api/variants/{experiment_id}/impression

Log that a user was shown a variant. variantId must be registered on the experiment.

Body

{ userId, variantId }

Returns · 201 with { ok: true }.

POST/api/variants/{experiment_id}/conversion
POST /api/variants/{experiment_id}/conversion

Log a conversion tied to a shown variant. Conversions without a prior impression are accepted (more permissive default).

Body

{ userId, variantId, eventType: "click" | "open" }

Returns · 201 with { ok: true }.

GET/api/variants/{experiment_id}
GET /api/variants/{experiment_id}

Returns per-variant impressions, conversions, conversion rate, Wilson lower bound (95%), and the recommended variant — or insufficient_data.

Body

Returns · ExperimentReport JSON; 404 if the experiment is unknown.

Last polled: . Schema lives in src/lib/contracts/variants.ts; selection rule in src/lib/business/variants.ts.