POST
https://jmpy.me/api/v1
/
url-ab-tests
Create URL A/B Test
curl --request POST \
  --url https://jmpy.me/api/v1/url-ab-tests \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "primary_url_id": "<string>",
  "variants": [
    {}
  ],
  "variants[].name": "<string>",
  "variants[].destination_url": "<string>",
  "variants[].traffic_weight": 123,
  "description": "<string>",
  "traffic_split_mode": "<string>",
  "min_sample_size": 123,
  "confidence_level": 123
}
'
Create a new A/B test for a short URL to compare different destination pages and optimize for conversions.

Body Parameters

name
string
required
The name of the A/B test.
primary_url_id
string
required
The UUID of the primary Short URL to test.
variants
object[]
required
Array of variant configurations. At least 2 variants are required.
variants[].name
string
Name of the variant (e.g., “Control”, “Page B”).
variants[].destination_url
string
required
The destination URL for this variant.
variants[].traffic_weight
number
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.
description
string
Optional description for the test.
traffic_split_mode
string
default:"equal"
How traffic is split. One of equal or weighted.
min_sample_size
number
default:"100"
Minimum number of clicks required before statistical significance is calculated.
confidence_level
number
default:"95"
Target confidence level percentage (e.g., 90, 95, 99).

Request Examples

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 }
    ]
  }'

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 }
    ]
  })
});

Response Examples

{
  "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"
}