curl --request POST \
--url https://api.abconvert.io/v1/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"test_groups": [
{
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"name": "Variant A",
"control": false
}
],
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 100,
"shared": {
"theme": {},
"offer": {
"combines_with": {
"product_discounts": true,
"order_discounts": true,
"shipping_discounts": true
}
}
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": {
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
}
}
'import requests
url = "https://api.abconvert.io/v1/experiments"
payload = {
"name": "<string>",
"test_groups": [
{
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"name": "Variant A",
"control": False
}
],
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 100,
"shared": {
"theme": {},
"offer": { "combines_with": {
"product_discounts": True,
"order_discounts": True,
"shipping_discounts": True
} }
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": { "filter_groups": [{ "filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
] }, { "filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
] }] }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
test_groups: [
{
split: 50,
changes: [
{
type: 'price',
adjustment: {unit: 'percentage', value: 0},
prices: [
{
product_variant_id: 'gid://shopify/ProductVariant/45678',
price: {amount: '17.99', currency: 'USD'},
compare_at_price: {amount: '24.99', currency: 'USD'},
country_prices: [{country: 'AU', price: {amount: '27.99', currency: 'AUD'}}]
}
]
}
],
name: 'Variant A',
control: false
}
],
hypothesis: '<string>',
primary_metric: 'revenue_per_visitor',
traffic_allocation: 100,
shared: {
theme: {},
offer: {
combines_with: {product_discounts: true, order_discounts: true, shipping_discounts: true}
}
},
schedule: {start_at: '2023-11-07T05:31:56Z', end_at: '2023-11-07T05:31:56Z'},
audience: {
filter_groups: [
{filters: [{type: 'device', operator: 'equals', value: 'mobile'}]},
{filters: [{type: 'visitor_type', operator: 'equals', value: 'new'}]}
]
}
})
};
fetch('https://api.abconvert.io/v1/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.abconvert.io/v1/experiments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'test_groups' => [
[
'split' => 50,
'changes' => [
[
'type' => 'price',
'adjustment' => [
'unit' => 'percentage',
'value' => 0
],
'prices' => [
[
'product_variant_id' => 'gid://shopify/ProductVariant/45678',
'price' => [
'amount' => '17.99',
'currency' => 'USD'
],
'compare_at_price' => [
'amount' => '24.99',
'currency' => 'USD'
],
'country_prices' => [
[
'country' => 'AU',
'price' => [
'amount' => '27.99',
'currency' => 'AUD'
]
]
]
]
]
]
],
'name' => 'Variant A',
'control' => false
]
],
'hypothesis' => '<string>',
'primary_metric' => 'revenue_per_visitor',
'traffic_allocation' => 100,
'shared' => [
'theme' => [
],
'offer' => [
'combines_with' => [
'product_discounts' => true,
'order_discounts' => true,
'shipping_discounts' => true
]
]
],
'schedule' => [
'start_at' => '2023-11-07T05:31:56Z',
'end_at' => '2023-11-07T05:31:56Z'
],
'audience' => [
'filter_groups' => [
[
'filters' => [
[
'type' => 'device',
'operator' => 'equals',
'value' => 'mobile'
]
]
],
[
'filters' => [
[
'type' => 'visitor_type',
'operator' => 'equals',
'value' => 'new'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.abconvert.io/v1/experiments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.abconvert.io/v1/experiments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.abconvert.io/v1/experiments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "experiment",
"id": "3021",
"type": "price",
"status": "draft",
"name": "<string>",
"test_groups": [
{
"name": "Variant A",
"control": false,
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"template_preview_url": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 123,
"shared": {
"price": {
"product_ids": [
"gid://shopify/Product/8123456789"
],
"markets": [
{
"id": "gid://shopify/Market/13762560",
"countries": [
"<string>"
]
}
]
},
"shipping": {
"zone_ids": [
"gid://shopify/DeliveryZone/282141261"
]
},
"theme": {
"path_rules": {
"mode": "include",
"rules": [
{
"match_type": "exact",
"match_value": "/collections/sale",
"subject": "path"
}
]
}
},
"template": {
"theme_id": "gid://shopify/OnlineStoreTheme/123456789",
"template_type": "product",
"path_rules": {
"mode": "include",
"rules": [
{
"match_type": "exact",
"match_value": "/collections/sale",
"subject": "path"
}
]
}
},
"url_redirect": {
"rules": [
{
"key": "<string>",
"match_type": "exact",
"match_value": "/products/old-pdp",
"subject": "path"
}
],
"redirect": {
"mode": "always",
"preserve_query_string": true
}
},
"offer": {
"combines_with": {
"product_discounts": true,
"order_discounts": true,
"shipping_discounts": true
}
}
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": {
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
},
"has_force_assign_rules": true,
"assignment_version": 123,
"product_group": {
"id": "66c1f0a2e4b0a1d2c3e4f5a6",
"name": "Bestsellers"
},
"results_summary": {
"computed_at": "2023-11-07T05:31:56Z",
"test_groups": [
{
"test_group_index": 1,
"sample_size": 5231,
"session_count": 6816,
"conversion_rate": 0.034,
"revenue_per_visitor": {
"amount": "17.99",
"currency": "USD"
},
"average_order_value": {
"amount": "17.99",
"currency": "USD"
},
"profit_per_visitor": {
"amount": "17.99",
"currency": "USD"
},
"add_to_cart_rate": 0.081,
"reached_checkout_rate": 0.052
}
],
"outcome": "winner",
"winning_test_group_index": 123,
"srm_status": "ok"
},
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"warnings": [
{
"severity": "warning",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}Create a test
Creates a test in draft. Launching is a separate step: call
POST /experiments/{id}/start.
You can include schedule in the same call, so a single request
creates a scheduled draft.
What you can’t create here: a visual editor test’s DOM changes,
combined tests, checkout block customizations, and offer widgets.
You author those in the ABConvert admin, and they read back read-only.
A visual_editor test itself is creatable, carrying custom CSS and
JavaScript per test group.
For the plan each test type needs, see Feature availability.
curl --request POST \
--url https://api.abconvert.io/v1/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"test_groups": [
{
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"name": "Variant A",
"control": false
}
],
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 100,
"shared": {
"theme": {},
"offer": {
"combines_with": {
"product_discounts": true,
"order_discounts": true,
"shipping_discounts": true
}
}
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": {
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
}
}
'import requests
url = "https://api.abconvert.io/v1/experiments"
payload = {
"name": "<string>",
"test_groups": [
{
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"name": "Variant A",
"control": False
}
],
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 100,
"shared": {
"theme": {},
"offer": { "combines_with": {
"product_discounts": True,
"order_discounts": True,
"shipping_discounts": True
} }
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": { "filter_groups": [{ "filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
] }, { "filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
] }] }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
test_groups: [
{
split: 50,
changes: [
{
type: 'price',
adjustment: {unit: 'percentage', value: 0},
prices: [
{
product_variant_id: 'gid://shopify/ProductVariant/45678',
price: {amount: '17.99', currency: 'USD'},
compare_at_price: {amount: '24.99', currency: 'USD'},
country_prices: [{country: 'AU', price: {amount: '27.99', currency: 'AUD'}}]
}
]
}
],
name: 'Variant A',
control: false
}
],
hypothesis: '<string>',
primary_metric: 'revenue_per_visitor',
traffic_allocation: 100,
shared: {
theme: {},
offer: {
combines_with: {product_discounts: true, order_discounts: true, shipping_discounts: true}
}
},
schedule: {start_at: '2023-11-07T05:31:56Z', end_at: '2023-11-07T05:31:56Z'},
audience: {
filter_groups: [
{filters: [{type: 'device', operator: 'equals', value: 'mobile'}]},
{filters: [{type: 'visitor_type', operator: 'equals', value: 'new'}]}
]
}
})
};
fetch('https://api.abconvert.io/v1/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.abconvert.io/v1/experiments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'test_groups' => [
[
'split' => 50,
'changes' => [
[
'type' => 'price',
'adjustment' => [
'unit' => 'percentage',
'value' => 0
],
'prices' => [
[
'product_variant_id' => 'gid://shopify/ProductVariant/45678',
'price' => [
'amount' => '17.99',
'currency' => 'USD'
],
'compare_at_price' => [
'amount' => '24.99',
'currency' => 'USD'
],
'country_prices' => [
[
'country' => 'AU',
'price' => [
'amount' => '27.99',
'currency' => 'AUD'
]
]
]
]
]
]
],
'name' => 'Variant A',
'control' => false
]
],
'hypothesis' => '<string>',
'primary_metric' => 'revenue_per_visitor',
'traffic_allocation' => 100,
'shared' => [
'theme' => [
],
'offer' => [
'combines_with' => [
'product_discounts' => true,
'order_discounts' => true,
'shipping_discounts' => true
]
]
],
'schedule' => [
'start_at' => '2023-11-07T05:31:56Z',
'end_at' => '2023-11-07T05:31:56Z'
],
'audience' => [
'filter_groups' => [
[
'filters' => [
[
'type' => 'device',
'operator' => 'equals',
'value' => 'mobile'
]
]
],
[
'filters' => [
[
'type' => 'visitor_type',
'operator' => 'equals',
'value' => 'new'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.abconvert.io/v1/experiments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.abconvert.io/v1/experiments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.abconvert.io/v1/experiments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"test_groups\": [\n {\n \"split\": 50,\n \"changes\": [\n {\n \"type\": \"price\",\n \"adjustment\": {\n \"unit\": \"percentage\",\n \"value\": 0\n },\n \"prices\": [\n {\n \"product_variant_id\": \"gid://shopify/ProductVariant/45678\",\n \"price\": {\n \"amount\": \"17.99\",\n \"currency\": \"USD\"\n },\n \"compare_at_price\": {\n \"amount\": \"24.99\",\n \"currency\": \"USD\"\n },\n \"country_prices\": [\n {\n \"country\": \"AU\",\n \"price\": {\n \"amount\": \"27.99\",\n \"currency\": \"AUD\"\n }\n }\n ]\n }\n ]\n }\n ],\n \"name\": \"Variant A\",\n \"control\": false\n }\n ],\n \"hypothesis\": \"<string>\",\n \"primary_metric\": \"revenue_per_visitor\",\n \"traffic_allocation\": 100,\n \"shared\": {\n \"theme\": {},\n \"offer\": {\n \"combines_with\": {\n \"product_discounts\": true,\n \"order_discounts\": true,\n \"shipping_discounts\": true\n }\n }\n },\n \"schedule\": {\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"end_at\": \"2023-11-07T05:31:56Z\"\n },\n \"audience\": {\n \"filter_groups\": [\n {\n \"filters\": [\n {\n \"type\": \"device\",\n \"operator\": \"equals\",\n \"value\": \"mobile\"\n }\n ]\n },\n {\n \"filters\": [\n {\n \"type\": \"visitor_type\",\n \"operator\": \"equals\",\n \"value\": \"new\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"object": "experiment",
"id": "3021",
"type": "price",
"status": "draft",
"name": "<string>",
"test_groups": [
{
"name": "Variant A",
"control": false,
"split": 50,
"changes": [
{
"type": "price",
"adjustment": {
"unit": "percentage",
"value": 0
},
"prices": [
{
"product_variant_id": "gid://shopify/ProductVariant/45678",
"price": {
"amount": "17.99",
"currency": "USD"
},
"compare_at_price": {
"amount": "24.99",
"currency": "USD"
},
"country_prices": [
{
"country": "AU",
"price": {
"amount": "27.99",
"currency": "AUD"
}
}
]
}
]
}
],
"template_preview_url": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"hypothesis": "<string>",
"primary_metric": "revenue_per_visitor",
"traffic_allocation": 123,
"shared": {
"price": {
"product_ids": [
"gid://shopify/Product/8123456789"
],
"markets": [
{
"id": "gid://shopify/Market/13762560",
"countries": [
"<string>"
]
}
]
},
"shipping": {
"zone_ids": [
"gid://shopify/DeliveryZone/282141261"
]
},
"theme": {
"path_rules": {
"mode": "include",
"rules": [
{
"match_type": "exact",
"match_value": "/collections/sale",
"subject": "path"
}
]
}
},
"template": {
"theme_id": "gid://shopify/OnlineStoreTheme/123456789",
"template_type": "product",
"path_rules": {
"mode": "include",
"rules": [
{
"match_type": "exact",
"match_value": "/collections/sale",
"subject": "path"
}
]
}
},
"url_redirect": {
"rules": [
{
"key": "<string>",
"match_type": "exact",
"match_value": "/products/old-pdp",
"subject": "path"
}
],
"redirect": {
"mode": "always",
"preserve_query_string": true
}
},
"offer": {
"combines_with": {
"product_discounts": true,
"order_discounts": true,
"shipping_discounts": true
}
}
},
"schedule": {
"start_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z"
},
"audience": {
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
},
"has_force_assign_rules": true,
"assignment_version": 123,
"product_group": {
"id": "66c1f0a2e4b0a1d2c3e4f5a6",
"name": "Bestsellers"
},
"results_summary": {
"computed_at": "2023-11-07T05:31:56Z",
"test_groups": [
{
"test_group_index": 1,
"sample_size": 5231,
"session_count": 6816,
"conversion_rate": 0.034,
"revenue_per_visitor": {
"amount": "17.99",
"currency": "USD"
},
"average_order_value": {
"amount": "17.99",
"currency": "USD"
},
"profit_per_visitor": {
"amount": "17.99",
"currency": "USD"
},
"add_to_cart_rate": 0.081,
"reached_checkout_rate": 0.052
}
],
"outcome": "winner",
"winning_test_group_index": 123,
"srm_status": "ok"
},
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"warnings": [
{
"severity": "warning",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"details": {},
"findings": [
{
"severity": "error",
"code": "product_not_found",
"message": "<string>",
"param": "<string>"
}
]
}
}Authorizations
Bearer tokens created in the ABConvert admin under
Settings → MCP & API Access. Scopes:
read_experiments and write_experiments (write implies read; the
default is read). See
Authentication for which scope each
request needs.
Headers
Replaying a request with the same key returns the original response
instead of creating a second resource. Reusing a key with a different
body returns 409 idempotency_key_in_use, and a key outside 1-255
characters returns 400 invalid_idempotency_key rather than being
ignored. See Idempotency.
1 - 255Body
The types you can create through the API. A combined test is authored in the ABConvert admin, with read and lifecycle access only.
price, shipping, theme, template, url_redirect, checkout, offer, visual_editor 2552 - 5 elementsShow child attributes
Show child attributes
What you expect this test to show, in your own words.
The metric the test is judged on.
revenue_per_visitor, average_order_value, conversion_rate, profit_per_visitor, add_to_cart_rate, reached_checkout_rate "revenue_per_visitor"
The percentage of eligible visitors who enter the test.
1 <= x <= 100Required on price, shipping, template, and url_redirect
tests, which each carry a mandatory key here. Optional on theme,
offer, and checkout. Omitting it where it is required returns
422.
Show child attributes
Show child attributes
The window the scheduler runs the test in. Send at least one bound.
After launch, only end_at is editable.
Show child attributes
Show child attributes
Limits the test to visitors who match your filters. Without an
audience, every visitor is eligible. In PATCH, audience: null
turns targeting off.
Filter groups combine with AND: a visitor must match every filter group to enter the test. Filters inside one filter group combine with OR: one match is enough.
To require two filters at once, put each one in its own filter group. The example below enters visitors who are on mobile and new. Putting the same two filters in one filter group would enter visitors who are on mobile or new instead.
A test whose targeting you turn off in the ABConvert admin reads
back with no audience.
Show child attributes
Show child attributes
{
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
}
Response
The created draft. The response can carry non-blocking warnings.
"experiment"The test's numeric ID as a string.
"3021"
What the test changes: product prices, shipping rates, the theme a
visitor sees, a page template, the URL a visitor lands on, checkout
delivery and payment methods, or a cart offer. visual_editor is a
storefront edit: custom CSS and JavaScript, which you can write here,
alongside DOM changes authored in the ABConvert visual editor.
combined bundles more than one change type in one test. See
CreatableExperimentType for the ones you can create here.
price, shipping, theme, template, url_redirect, checkout, offer, visual_editor, combined The test's current status. The ABConvert admin labels ended as
Closed; the wire value stays ended. Scheduling isn't a status: a
scheduled test is a draft or preview with a schedule.
draft, preview, active, paused, ended, failed, archived Show child attributes
Show child attributes
The metric the test is judged on.
revenue_per_visitor, average_order_value, conversion_rate, profit_per_visitor, add_to_cart_rate, reached_checkout_rate "revenue_per_visitor"
Configuration shared by every test group in the test, keyed by
change type. Send exactly the key that matches the test's type. A
combined test carries one key per change type it bundles.
Show child attributes
Show child attributes
The window the scheduler runs the test in. Send at least one bound.
After launch, only end_at is editable.
Show child attributes
Show child attributes
Limits the test to visitors who match your filters. Without an
audience, every visitor is eligible. In PATCH, audience: null
turns targeting off.
Filter groups combine with AND: a visitor must match every filter group to enter the test. Filters inside one filter group combine with OR: one match is enough.
To require two filters at once, put each one in its own filter group. The example below enters visitors who are on mobile and new. Putting the same two filters in one filter group would enter visitors who are on mobile or new instead.
A test whose targeting you turn off in the ABConvert admin reads
back with no audience.
Show child attributes
Show child attributes
{
"filter_groups": [
{
"filters": [
{
"type": "device",
"operator": "equals",
"value": "mobile"
}
]
},
{
"filters": [
{
"type": "visitor_type",
"operator": "equals",
"value": "new"
}
]
}
]
}
True when the test has force-assign rules, which you author in
the ABConvert admin. ABConvert evaluates them only for visitors
who already match audience, and applies the first rule whose
filters all match: that rule either puts the visitor in the test
group it names or keeps them out of the test, in place of the
random split.
Increments whenever visitors are reassigned to test groups, for example after a split change.
The product group attached to this test, or null. Its id is what
product_group_id takes on a custom result query. No
product-group endpoint exists, so read it here.
Show child attributes
Show child attributes
Present only with ?include=results_summary. Null when no
snapshot has been computed for the test yet.
Show child attributes
Show child attributes
Non-blocking findings. Absent when the request raised none.
Show child attributes
Show child attributes