POST
https://jmpy.me/api/v1
/
url-ab-tests
/
{testId}
/
complete
Complete URL A/B Test
curl --request POST \
  --url https://jmpy.me/api/v1/url-ab-tests/{testId}/complete \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "winner_variant_id": "<string>"
}
'
Permanently finish a test. You can optionally specify a winning variant; otherwise, the variant with the highest conversion rate will be automatically selected. The short URL will be updated to point to the winning destination permanently.

Path Parameters

testId
string
required
The UUID of the A/B test to complete.

Body Parameters

winner_variant_id
string
Optional UUID of the winning variant. If omitted, the winner is auto-detected based on conversions.

Request Examples

curl -X POST "https://jmpy.me/api/v1/url-ab-tests/test_url_789/complete" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "winner_variant_id": "var_b" }'

Use Cases

Complete the test and force “Variant B” to be the permanent destination.
await fetch('https://jmpy.me/api/v1/url-ab-tests/test_123/complete', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer <token>',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ winner_variant_id: "var_b" })
});
Complete the test and let the system automatically choose the best performing variant.
await fetch('https://jmpy.me/api/v1/url-ab-tests/test_123/complete', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer <token>' }
});

Response Examples

{
  "test": {
    "id": "test_url_789",
    "status": "completed",
    "end_date": "2024-04-01T10:00:00Z",
    "winner_variant_id": "var_b"
  },
  "message": "A/B test completed",
  "winner_variant_id": "var_b"
}