Response Format
All endpoints return a consistent JSON envelope:
{
"success": true,
"data": { ... },
"error": "...",
"timestamp": "2026-01-15T10:00:00.000Z"
}Authentication
The API supports two authentication methods depending on the endpoint:
Authorization: Bearer <key> header or x-api-key header. Used by the SDK for assignment and event endpoints.x-user-email header. Used by the dashboard.Assignments
Get treatment assignments for users in experiments
/assignmentsCreate assignment
Request a treatment assignment for a user in an experiment. The bandit algorithm selects the optimal treatment based on historical performance. If the user already has a cached assignment, it is returned instead.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| experimentId | string | required | ID of the experiment to assign |
| userId | string | required | Unique identifier for the user |
| context | Record<string, string | number | boolean> | optional | Optional context for contextual bandit algorithms (e.g. device type, location) |
Responses
Example
Request
{
"experimentId": "exp_abc123",
"userId": "user_42",
"context": {
"deviceType": "mobile",
"country": "US"
}
}Response
{
"success": true,
"data": {
"assignmentId": "asgn_xyz789",
"experimentId": "exp_abc123",
"treatment": {
"id": "trt_def456",
"name": "Headline B",
"config": {
"content": "Start your free trial today"
}
},
"confidence": 0.87
},
"timestamp": "2026-01-15T10:30:00.000Z"
}/assignments/:experimentIdGet assignment
Retrieve a treatment assignment for a user via query parameters. Functionally equivalent to the POST endpoint but useful for simple GET-based integrations.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| experimentId | string | required | ID of the experiment |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string | required | Unique identifier for the user |
| context | string (JSON) | optional | JSON-encoded context object for contextual bandits |
Responses
Events
Track user events and conversions
/eventsTrack event
Record a user event such as a conversion, click, or view. Use assignmentId for precise attribution (recommended) or provide the legacy experimentId + treatmentId + userId triplet. Conversion events automatically update the bandit algorithm.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| assignmentId | string | optional | ID of the assignment (recommended). Provide this OR the legacy triplet below. |
| experimentId | string | optional | Experiment ID (legacy, use with treatmentId + userId) |
| treatmentId | string | optional | Treatment ID (legacy, use with experimentId + userId) |
| userId | string | optional | User ID (legacy, use with experimentId + treatmentId) |
| eventType | EventType | required | One of: ASSIGNMENT, CONVERSION, CLICK, VIEW, CUSTOM |
| value | number | optional | Numeric value (e.g. revenue amount for conversions) |
| metadata | Record<string, any> | optional | Arbitrary metadata to attach to the event |
Responses
Example
Request
{
"assignmentId": "asgn_xyz789",
"eventType": "CONVERSION",
"value": 29.99,
"metadata": {
"product": "premium-plan"
}
}Response
{
"success": true,
"data": {
"id": "evt_abc123",
"experimentId": "exp_abc123",
"treatmentId": "trt_def456",
"userId": "user_42",
"eventType": "CONVERSION",
"value": 29.99,
"metadata": {
"product": "premium-plan",
"assignmentId": "asgn_xyz789"
},
"timestamp": "2026-01-15T10:35:00.000Z"
},
"timestamp": "2026-01-15T10:35:00.000Z"
}/events/:experimentIdList events
Retrieve event history for a specific experiment. Results are paginated with limit and offset query parameters.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| experimentId | string | required | ID of the experiment |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| limit | number | optional | Maximum number of events to return (default: 100) |
| offset | number | optional | Number of events to skip (default: 0) |
Responses
/events/batchBatch track events
Send multiple events in a single request. Accepts 1 to 1,000 events per batch. Each event is processed independently; partial failures return a 207 Multi-Status response with per-event error details.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| events | TrackEventRequest[] | required | Array of event objects (1-1000). Each follows the same schema as POST /events. |
Responses
Example
Request
{
"events": [
{
"assignmentId": "asgn_xyz789",
"eventType": "CLICK",
"metadata": {
"element": "cta-button"
}
},
{
"assignmentId": "asgn_xyz789",
"eventType": "CONVERSION",
"value": 49.99
}
]
}Response
{
"success": true,
"data": {
"total": 2,
"success_count": 2,
"created": [
"..."
],
"errors": []
},
"timestamp": "2026-01-15T10:36:00.000Z"
}Experiments
Create and manage experiments
/experimentsList experiments
Retrieve all experiments belonging to the authenticated company. Returns experiments with their treatments.
Responses
/experimentsCreate experiment
Create a new experiment in DRAFT status. Optionally include initial treatments. The experiment must be activated separately via PUT after adding at least one treatment.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Human-readable name for the experiment |
| description | string | optional | Description of the experiment goals |
| algorithm | BanditAlgorithm | required | Algorithm to use: EPSILON_GREEDY, UCB1, THOMPSON_SAMPLING, LINEAR_CONTEXTUAL, or NEURAL_CONTEXTUAL |
| contentType | ContentType | optional | Content type of treatments (default: PLAIN_TEXT) |
| algorithmConfig | Record<string, any> | optional | Algorithm-specific configuration (e.g. epsilon value) |
| assignmentTtl | number | optional | Assignment cache TTL in seconds (default: 86400 = 24 hours) |
| treatments | Treatment[] | optional | Optional initial treatments to create with the experiment |
Responses
Example
Request
{
"name": "Homepage Headline Test",
"description": "Test different headlines on the landing page",
"algorithm": "THOMPSON_SAMPLING",
"treatments": [
{
"name": "Control",
"config": {
"content": "Welcome to our platform"
},
"isControl": true
},
{
"name": "Urgency",
"config": {
"content": "Limited time offer - start free today!"
}
}
]
}Response
{
"success": true,
"data": {
"id": "exp_abc123",
"name": "Homepage Headline Test",
"algorithm": "THOMPSON_SAMPLING",
"status": "draft",
"treatments": [
"..."
]
},
"timestamp": "2026-01-15T10:00:00.000Z"
}/experiments/:idGet experiment
Retrieve a single experiment by ID, including all associated treatments and their configurations.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment |
Responses
/experiments/:idUpdate experiment
Update experiment properties including name, description, status, and TTL. To activate an experiment, set status to ACTIVE. Activation requires at least one treatment.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment to update |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Updated name |
| description | string | optional | Updated description |
| status | ExperimentStatus | optional | New status: DRAFT, ACTIVE, PAUSED, COMPLETED, or ARCHIVED |
| assignmentTtl | number | optional | Updated assignment TTL in seconds |
| endAt | string (ISO 8601) | optional | Scheduled end date for the experiment |
Responses
/experiments/:id/generate-variantAI generate variant
Use AI to generate a new treatment variant based on the experiment's existing treatments and performance data. The AI analyzes what's working and generates a new variant using one of eight strategies (emotional appeal, urgency, social proof, etc.).
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment |
Responses
/experiments/:id/refreshRefresh algorithm state
Rebuild the in-memory algorithm state from the event history in the database. Useful after manual data changes or if algorithm state has drifted.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment |
Responses
/experiments/:id/treatmentsAdd treatment
Add a new treatment (variant) to an experiment. Each treatment has a name, content configuration, optional weight for traffic allocation, and an optional control flag.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Name of the treatment variant |
| description | string | optional | Description of this variant |
| config | { content: string, metadata?: Record<string, any> } | required | Treatment configuration with content and optional metadata |
| weight | number | optional | Traffic weight (default: 1.0) |
| isControl | boolean | optional | Whether this is the control variant (default: false) |
Responses
/experiments/:id/treatments/:treatmentIdRemove treatment
Remove a treatment from an experiment. The treatment must belong to the specified experiment.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the experiment |
| treatmentId | string | required | ID of the treatment to remove |
Responses
Funnels
Create and manage multi-step experiment funnels
/funnelsList funnels
Retrieve all funnels belonging to the authenticated company. Each funnel links multiple experiments into a sequential conversion path.
Responses
/funnelsCreate funnel
Create a new funnel linking one or more experiments into a multi-step conversion path. Requires at least one experiment ID.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Human-readable name for the funnel |
| description | string | optional | Description of the funnel goals |
| experimentIds | string[] | required | Ordered list of experiment IDs that form the funnel steps (minimum 1) |
Responses
Example
Request
{
"name": "Onboarding Flow",
"description": "Test headline → CTA → pricing across the onboarding funnel",
"experimentIds": [
"exp_headline",
"exp_cta",
"exp_pricing"
]
}Response
{
"success": true,
"data": {
"id": "fnl_abc123",
"name": "Onboarding Flow",
"description": "Test headline → CTA → pricing across the onboarding funnel",
"experimentIds": [
"exp_headline",
"exp_cta",
"exp_pricing"
],
"status": "draft"
},
"timestamp": "2026-01-15T12:00:00.000Z"
}/funnels/:idGet funnel
Retrieve a single funnel by ID, including details about its linked experiments and their current status.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the funnel |
Responses
/funnels/:idUpdate funnel
Update funnel properties such as name, description, or status.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the funnel to update |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Updated name |
| description | string | optional | Updated description |
| status | string | optional | New status: draft, active, paused, or completed |
Responses
/funnels/:idDelete funnel
Delete a funnel. This does not delete the linked experiments, only the funnel grouping.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the funnel to delete |
Responses
/funnels/:id/rewardRecord funnel reward
Record a reward (conversion value) for a user who completed the funnel. Updates the bandit algorithm state for all experiments in the funnel based on the treatments the user was assigned. Each user can only have one reward per funnel.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | required | ID of the funnel |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string | required | ID of the user who completed the funnel |
| value | number | required | Reward value (must be >= 0, e.g. revenue amount) |
Responses
Example
Request
{
"userId": "user_42",
"value": 49.99
}Response
{
"success": true,
"data": {
"funnelId": "fnl_abc123",
"userId": "user_42",
"value": 49.99
},
"timestamp": "2026-01-15T14:00:00.000Z"
}