---
title: "Reset an A/B test"
method: POST
path: "/v1/sites/{site_id}/widgets/ab-tests/{test_id}/reset"
tags: ["Widgets"]
---

# Reset an A/B test

`POST /v1/sites/{site_id}/widgets/ab-tests/{test_id}/reset`

## Request

- Base URL: `https://api.getsitecontrol.com`
- URL: `https://api.getsitecontrol.com/v1/sites/{site_id}/widgets/ab-tests/{test_id}/reset`
- Auth: HTTP bearer

Starts the results over: every widget's counts go to zero, `added_at` moves to now and visitors are drawn anew. The widgets and their on/off state stay. The admin's Reset results.

## Path parameters

- `site_id` integer, required
- `test_id` integer, required: A/B test id from List A/B tests

## Headers

- `Idempotency-Key` string: Makes a retry of a POST safe: a repeat with the same key, body and GSC-Version returns the stored response with `Idempotency-Replayed: true` instead of running again. The key protects against repeated execution while the key store works. Saving the change and storing the response under the key are not atomic: if the process or the key store fails between them, the change is kept, the key is released after 15 minutes and a retry runs the request again. After a timeout or a 5xx, read the resource to check the result before retrying. 5xx and 429 responses and responses over 256 KB are not stored, so a repeat runs the request again. A key is kept for 24 hours. The same key with another body or version is 422; a repeat while the first request runs is 409.

## Response `200`

Successful Response

- WidgetAbTest
  - `id` integer, required
  - `name` string, required: The admin's slot, shown there as Test 1 … Test 5
  - `leader_id` integer, required: The widget ahead: the highest CTR, ties to the first listed; the one Stop keeps unless told otherwise
  - `widgets` WidgetAbTestWidget[], required: In the admin's order; at least one. Visitors are split evenly between the widgets that are on
    - `id` integer, required
    - `name` string, nullable
    - `is_active` boolean, required: An off widget stays in the test but is not shown; a test shows its widgets that are on
    - `added_at` string, date-time, required: Results counted from: when the widget joined the test or the results were last reset
    - `total` object, required: Counts by event type since `added_at`: `show` (views) and every action the widget has now — `submit` (forms sent), `openUrl`, `showWidget`, `addToCart`, `applyCoupon`, `copyToClipboard` (button clicks); only the keys the widget has
    - `views` integer, required: Times the widget was shown since `added_at`; `total.show`. The admin's Views
    - `actions` integer, required: Forms sent and buttons used since `added_at`: every key of `total` but `show`, summed. The admin's Actions
    - `ctr` number, required: `actions` / `views` as a fraction, the admin's CTR rounded half up to 4 places (0.0325 is 3.25%); 0 while there are no views

## Other responses

- `400`: Unsupported GSC-Version
- `401`: Missing or invalid API key or access token
- `403`: Access denied
- `404`: `ab_test_not_found`: the site has no such test, or it was stopped
- `409`: Conflict
- `413`: Request body too large
- `422`: Validation failed
- `429`: Rate limited
- `503`: Temporarily unavailable; retry later

---

[API](https://skmtc.dev/getsitecontrol/apis/getsitecontrol-public-api.md) - [All operations](https://skmtc.dev/getsitecontrol/apis/getsitecontrol-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getsitecontrol/apis/getsitecontrol-public-api/revisions/084fcad80e75?raw)
