Contents
On this page

Start A/B Test - Plugixa Chat

POST /plugixa-chat/v1/experiments/{id}/start

Start a draft test: visitors start being split between the two widgets.

Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_edit capability. Administrators have it.

Starting switches both widgets on. Widget A and widget B are set to active, whatever their status was.

Request

POST https://your-site.example/wp-json/plugixa-chat/v1/experiments/7/start

Path parameters

Name Type Description
id integer The test’s id

Responses

200 OK. data is the running test.

{
  "success": true,
  "data": {
    "id": 7,
    "name": "Green button or blue button",
    "widget_a": 2,
    "widget_b": 5,
    "split": 50,
    "status": "running",
    "started_at": "2026-11-12 09:40:00",
    "ended_at": null,
    "winner_id": 0,
    "deleted_at": null,
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-12 09:30:00",
    "created_by": "1",
    "modified_by": "1"
  }
}
Field Type Meaning
data.status string draft, running or ended
data.started_at string|null UTC datetime it started, null for a draft

Errors

Status Code When
404 plugixa_chat_test_missing No test has this id, or it is in the trash.
409 plugixa_chat_test_started The test is not a draft.
400 plugixa_chat_test_widgets A widget is missing, does not exist or is in the trash.
400 plugixa_chat_test_same widget_a and widget_b are the same widget.
409 plugixa_chat_test_busy One of the widgets is already in a running test.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-chat/v1/experiments/7/start" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/experiments/7/start');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/experiments/7/start', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share