API · A/B tests
Variants to a sample of the audience and automatic send of the winner to the rest.
Base: https://api.pushtifly.com. Every response uses { errCode, errMsg, data, meta }. Authentication and keys · Error catalog
GET/v1/ab-tests
A/B tests (most recent first)
Key: sk_
Parameters
| Name | In | Type | Description |
|---|---|---|---|
appId | query | string | |
page | query | integer | |
perPage | query | integer |
Responses: 200
curl -X GET "https://api.pushtifly.com/v1/ab-tests" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY"POST/v1/ab-tests
Create an A/B test (202): 2-4 variants to a sample; the winner goes only to the rest
Key: sk_
Same fields as POST /v1/notifications (audience, category, options) plus abTest. Each variant can change content, deepLink, data, actions and media. samplePercent 10-50 (split among the variants), waitMinutes 30-1440, metric open_rate or click_rate. Immediate send (schedule not allowed: 2011). Plan feature ab_testing (3004). If any variant doesn't reach 100 accepted deliveries, or nobody opens, the test ends inconclusive and the winner is picked with /winner.
Body
| Field | Type | Description |
|---|---|---|
appId | string | |
name | string | max. 120 characters |
target* | object | |
category | "transactional" | "marketing" | |
validateOnly | boolean | |
abTest* | object | |
abTest.variants* | object[] | max. 4 items |
abTest.samplePercent | integer | 10–50 |
abTest.waitMinutes | integer | 30–1440 |
abTest.metric | "open_rate" | "click_rate" |
Responses: 202422
curl -X POST "https://api.pushtifly.com/v1/ab-tests" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"appId": "text",
"name": "text",
"target": {},
"category": "transactional",
"validateOnly": true,
"abTest": {
"variants": []
}
}'GET/v1/ab-tests/{id}
Status (testing, sending_winner, completed, inconclusive, cancelled), rates of each variant and the winner's send
Key: sk_
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id* | path | string |
Responses: 200
curl -X GET "https://api.pushtifly.com/v1/ab-tests/ID_ID" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY"POST/v1/ab-tests/{id}/winner
Pick the winner manually (before the decision or if it ended inconclusive); 4009 if it already has a winner
Key: sk_
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id* | path | string |
Body
| Field | Type | Description |
|---|---|---|
variant* | integer | 1–4 |
Responses: 202
curl -X POST "https://api.pushtifly.com/v1/ab-tests/ID_ID/winner" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"variant": 1
}'POST/v1/ab-tests/{id}/cancel
Cancel (no winner is sent; variants already sent aren't undone)
Key: sk_
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id* | path | string |
Responses: 200
curl -X POST "https://api.pushtifly.com/v1/ab-tests/ID_ID/cancel" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY"