Create a new A/B test for a short URL to compare different destination pages and optimize for conversions.
Body Parameters
The name of the A/B test.
Array of variant configurations. At least 2 variants are required.
Name of the variant (e.g., “Control”, “Page B”).
variants[].destination_url
The destination URL for this variant.
variants[].traffic_weight
Percentage of traffic to route to this variant. Defaults to an equal split among all variants if not specified. Must sum to 100 if traffic_split_mode is weighted.
Optional description for the test.
How traffic is split. One of equal or weighted.
Minimum number of clicks required before statistical significance is calculated.
Target confidence level percentage (e.g., 90, 95, 99).
Request Examples
cURL
Node.js
TypeScript
Python
Go
PHP
Java
curl -X POST "https://jmpy.me/api/v1/url-ab-tests" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Landing Page CTA Test",
"primary_url_id": "url_abc123",
"variants": [
{ "name": "Control", "destination_url": "https://mysite.com/landing-a", "traffic_weight": 50 },
{ "name": "Variant B", "destination_url": "https://mysite.com/landing-b", "traffic_weight": 50 }
]
}'
const response = await fetch ( 'https://jmpy.me/api/v1/url-ab-tests' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer <token>' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
name: 'Landing Page CTA Test' ,
primary_url_id: 'url_abc123' ,
variants: [
{ name: 'Control' , destination_url: 'https://mysite.com/landing-a' , traffic_weight: 50 },
{ name: 'Variant B' , destination_url: 'https://mysite.com/landing-b' , traffic_weight: 50 }
]
})
});
import axios from 'axios' ;
const response = await axios . post ( 'https://jmpy.me/api/v1/url-ab-tests' , {
name: 'Landing Page CTA Test' ,
primary_url_id: 'url_abc123' ,
variants: [
{ name: 'Control' , destination_url: 'https://mysite.com/landing-a' , traffic_weight: 50 },
{ name: 'Variant B' , destination_url: 'https://mysite.com/landing-b' , traffic_weight: 50 }
]
}, {
headers: { 'Authorization' : 'Bearer <token>' }
});
import requests
response = requests.post(
"https://jmpy.me/api/v1/url-ab-tests" ,
headers = { "Authorization" : "Bearer <token>" },
json = {
"name" : "Landing Page CTA Test" ,
"primary_url_id" : "url_abc123" ,
"variants" : [
{ "name" : "Control" , "destination_url" : "https://mysite.com/landing-a" , "traffic_weight" : 50 },
{ "name" : "Variant B" , "destination_url" : "https://mysite.com/landing-b" , "traffic_weight" : 50 }
]
}
)
package main
import (
" bytes "
" net/http "
" encoding/json "
)
func main () {
data := map [ string ] interface {}{
"name" : "Landing Page CTA Test" ,
"primary_url_id" : "url_abc123" ,
"variants" : [] map [ string ] interface {}{
{ "name" : "Control" , "destination_url" : "https://mysite.com/landing-a" , "traffic_weight" : 50 },
{ "name" : "Variant B" , "destination_url" : "https://mysite.com/landing-b" , "traffic_weight" : 50 },
},
}
jsonData , _ := json . Marshal ( data )
req , _ := http . NewRequest ( "POST" , "https://jmpy.me/api/v1/url-ab-tests" , bytes . NewBuffer ( jsonData ))
req . Header . Set ( "Authorization" , "Bearer <token>" )
req . Header . Set ( "Content-Type" , "application/json" )
http . DefaultClient . Do ( req )
}
<? php
$client = new GuzzleHttp\ Client ();
$response = $client -> request ( 'POST' , 'https://jmpy.me/api/v1/url-ab-tests' , [
'headers' => [
'Authorization' => 'Bearer <token>' ,
'Content-Type' => 'application/json'
],
'json' => [
'name' => 'Landing Page CTA Test' ,
'primary_url_id' => 'url_abc123' ,
'variants' => [
[ 'name' => 'Control' , 'destination_url' => 'https://mysite.com/landing-a' , 'traffic_weight' => 50 ],
[ 'name' => 'Variant B' , 'destination_url' => 'https://mysite.com/landing-b' , 'traffic_weight' => 50 ]
]
]
]);
?>
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.URI;
import java.net.http.HttpResponse;
String json = """
{
"name": "Landing Page CTA Test",
"primary_url_id": "url_abc123",
"variants": [
{ "name": "Control", "destination_url": "https://mysite.com/landing-a", "traffic_weight": 50 },
{ "name": "Variant B", "destination_url": "https://mysite.com/landing-b", "traffic_weight": 50 }
]
}
""" ;
HttpClient client = HttpClient . newHttpClient ();
HttpRequest request = HttpRequest . newBuilder ()
. uri ( URI . create ( "https://jmpy.me/api/v1/url-ab-tests" ))
. header ( "Authorization" , "Bearer <token>" )
. header ( "Content-Type" , "application/json" )
. POST ( HttpRequest . BodyPublishers . ofString (json))
. build ();
client . send (request, HttpResponse . BodyHandlers . ofString ());
Use Cases
Create a standard A/B test split equally between two destinations. const response = await fetch ( 'https://jmpy.me/api/v1/url-ab-tests' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer <token>' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
name: "Headline Test" ,
primary_url_id: "url_123" ,
variants: [
{ name: "Original" , destination_url: "https://site.com/a" },
{ name: "New Headline" , destination_url: "https://site.com/b" }
]
})
});
Slowly roll out a new page to only 10% of users. const response = await fetch ( 'https://jmpy.me/api/v1/url-ab-tests' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer <token>' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
name: "New Feature Rollout" ,
primary_url_id: "url_123" ,
traffic_split_mode: "weighted" ,
variants: [
{ name: "Stable" , destination_url: "https://site.com/v1" , traffic_weight: 90 },
{ name: "Beta" , destination_url: "https://site.com/v2" , traffic_weight: 10 }
]
})
});
List A/B Tests View your existing tests
Start Test Launch a created test
Short URL Details Get primary URL ID
Analytics Monitor test performance
Response Examples
201 Created
400 Invalid Input
403 Feature Disabled
{
"test" : {
"id" : "test_url_789" ,
"user_id" : "usr_55555" ,
"name" : "Landing Page CTA Test" ,
"primary_url_id" : "url_abc123" ,
"status" : "draft" ,
"variants" : [
{
"id" : "var_a" ,
"test_id" : "test_url_789" ,
"name" : "Control" ,
"destination_url" : "https://mysite.com/landing-a" ,
"traffic_weight" : 50
},
{
"id" : "var_b" ,
"test_id" : "test_url_789" ,
"name" : "Variant B" ,
"destination_url" : "https://mysite.com/landing-b" ,
"traffic_weight" : 50
}
]
},
"message" : "A/B test created successfully"
}
{
"success" : false ,
"error" : {
"code" : "INVALID_INPUT" ,
"message" : "At least 2 variants are required"
}
}
{
"success" : false ,
"error" : {
"code" : "FEATURE_DISABLED" ,
"message" : "A/B Testing is not available on your plan"
}
}