# Ending an API Test

When your API test reaches a conclusion, it's time to review the results and decide what to do next. Unlike template tests (which have an "Apply variant" button), API tests require you to implement the winning experience yourself — either by deploying the code permanently or removing it entirely.

### End your test

When you're ready to stop your test, open the test in Shoplift and click **End test**. This stops the test immediately — Shoplift will no longer execute the variant or control code for any visitors.

#### Pausing a test

If you need to temporarily stop a test to fix a bug or make adjustments, you can click **Pause** instead of ending it. Pausing stops all script execution and reverts all visitors to their normal store experience. Your test data stays intact so you can resume later.

{% hint style="info" %}
Avoid pausing tests unless absolutely necessary. Extended pauses can compromise your test data. If you need to pause for more than a short period, end the test instead, duplicate it to a new draft, and relaunch when you're ready.
{% endhint %}

### If your variant won

API tests don't have an "Apply variant" button because the winning experience is powered by custom JavaScript — there's no template or theme to reassign. To make the winning variant permanent, your developer needs to deploy the code directly into your Shopify theme. The steps differ slightly depending on whether you ran a basic or manual API test.

#### Deploy the winning code

Work with your developer to move the variant JavaScript from Shoplift into your theme permanently. This typically involves:

1. **Remove the Shoplift test dependency.** The deployed code should run on its own, without relying on Shoplift's test engine. Strip out any references to `isHypothesisActive()` or test-specific conditions. The code should now run for all visitors (or whatever audience you want).
2. **Test the deployed code.** Preview your theme to verify the code works correctly outside of Shoplift's test engine.

### If your original won

If the control outperformed the variant, you'll want to work with your developer to remove the variant code from the codebase.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shoplift.ai/test/javascript-api/ending-an-api-test.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
