import weflayr
from weflayr.openapi.models import RestoreAbTestInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.restore_ab_test(body=RestoreAbTestInput.from_dict({
"slug": "summarize-profile-ab-test",
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.restoreAbTest({
client,
throwOnError: true,
body: {
slug: 'summarize-profile-ab-test',
},
});
curl -X POST https://app.weflayr.com/api/ab-test-restore/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "summarize-profile-ab-test"
}'
{
"slug": "summarize-profile-ab-test",
"version": 1,
"document": {
"name": "Summarize profile A/B test",
"slug": "summarize-profile-ab-test",
"variants": {
"variant_a": {
"traffic_pct": 80,
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
},
"variant_b": {
"traffic_pct": 20,
"target": {
"type": "strategy",
"strategy_slug": "summarize-profile-router",
"version": null
}
}
},
"customer_exclusion": {
"excluded_customers": [
"Meridian Health"
],
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
}
},
"archived_at": null,
"updated_at": "2026-10-24T10:00:00+00:00",
"url": "https://app.weflayr.com/dashboard/ab-tests/?test=summarize-profile-ab-test",
"blockers": []
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "The A/B test 'summarize-profile-ab-test' cannot be restored: the routing strategy 'summarize-profile-router' is archived: restore it or target another one. Save a version targeting a routing strategy that is not archived with set_ab_test, which also restores it.", "code": "target_cannot_route"}
{"error": "No A/B test has the slug 'nope'. List the project's A/B tests, archived ones included, with get_ab_tests (status=all)."}
{"error": "Invalid request payload.", "detail": [{"field": "slug", "error": "Field required"}]}
A/B tests
Restore A/B test
Restore an archived A/B test.
POST
/
api
/
ab-test-restore
/
import weflayr
from weflayr.openapi.models import RestoreAbTestInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.restore_ab_test(body=RestoreAbTestInput.from_dict({
"slug": "summarize-profile-ab-test",
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.restoreAbTest({
client,
throwOnError: true,
body: {
slug: 'summarize-profile-ab-test',
},
});
curl -X POST https://app.weflayr.com/api/ab-test-restore/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "summarize-profile-ab-test"
}'
{
"slug": "summarize-profile-ab-test",
"version": 1,
"document": {
"name": "Summarize profile A/B test",
"slug": "summarize-profile-ab-test",
"variants": {
"variant_a": {
"traffic_pct": 80,
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
},
"variant_b": {
"traffic_pct": 20,
"target": {
"type": "strategy",
"strategy_slug": "summarize-profile-router",
"version": null
}
}
},
"customer_exclusion": {
"excluded_customers": [
"Meridian Health"
],
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
}
},
"archived_at": null,
"updated_at": "2026-10-24T10:00:00+00:00",
"url": "https://app.weflayr.com/dashboard/ab-tests/?test=summarize-profile-ab-test",
"blockers": []
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "The A/B test 'summarize-profile-ab-test' cannot be restored: the routing strategy 'summarize-profile-router' is archived: restore it or target another one. Save a version targeting a routing strategy that is not archived with set_ab_test, which also restores it.", "code": "target_cannot_route"}
{"error": "No A/B test has the slug 'nope'. List the project's A/B tests, archived ones included, with get_ab_tests (status=all)."}
{"error": "Invalid request payload.", "detail": [{"field": "slug", "error": "Field required"}]}
Every version is kept. An A/B test that sends calls to an archived routing strategy cannot be restored: save a version targeting another one with set_ab_test, which also restores it.
Changes live routing: the AI gateway splits the calls that send the A/B test’s
strategy/<slug> between its variants again.Parameters
Passed in the request body. The response also carriesblockers (what prevents the usual next step), in plain words. It is empty when the usual workflow applies.
import weflayr
from weflayr.openapi.models import RestoreAbTestInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.restore_ab_test(body=RestoreAbTestInput.from_dict({
"slug": "summarize-profile-ab-test",
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.restoreAbTest({
client,
throwOnError: true,
body: {
slug: 'summarize-profile-ab-test',
},
});
curl -X POST https://app.weflayr.com/api/ab-test-restore/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "summarize-profile-ab-test"
}'
{
"slug": "summarize-profile-ab-test",
"version": 1,
"document": {
"name": "Summarize profile A/B test",
"slug": "summarize-profile-ab-test",
"variants": {
"variant_a": {
"traffic_pct": 80,
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
},
"variant_b": {
"traffic_pct": 20,
"target": {
"type": "strategy",
"strategy_slug": "summarize-profile-router",
"version": null
}
}
},
"customer_exclusion": {
"excluded_customers": [
"Meridian Health"
],
"target": {
"model": "claude-sonnet-5-5",
"provider": "anthropic",
"region": "GLOBAL",
"type": "model"
}
}
},
"archived_at": null,
"updated_at": "2026-10-24T10:00:00+00:00",
"url": "https://app.weflayr.com/dashboard/ab-tests/?test=summarize-profile-ab-test",
"blockers": []
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "The A/B test 'summarize-profile-ab-test' cannot be restored: the routing strategy 'summarize-profile-router' is archived: restore it or target another one. Save a version targeting a routing strategy that is not archived with set_ab_test, which also restores it.", "code": "target_cannot_route"}
{"error": "No A/B test has the slug 'nope'. List the project's A/B tests, archived ones included, with get_ab_tests (status=all)."}
{"error": "Invalid request payload.", "detail": [{"field": "slug", "error": "Field required"}]}