# How to Automatically Pause Failing Tests

## Overview <a href="#step-1-get-your-api-keys" id="step-1-get-your-api-keys"></a>

This guide explains how to extend your monitoring workflow to automatically pause an experiment if it fails your health thresholds. This ensures that a poor-performing or "broken" test doesn't negatively impact your store's performance while you're away from your desk.

### Prerequisite

You must have the [Automated Test Alerting for Slack](https://docs.intelligems.io/developer-resources/external-api/automations-and-guides/automated-test-alerting-for-slack) workflow set up before completing this guide.

## How to Automatically Pause Failing Tests

### Step 1: Set up the Alerting Workflow <a href="#step-1-get-your-api-keys" id="step-1-get-your-api-keys"></a>

If you haven't already, follow the [Automated Test Alerting for Slack](https://docs.intelligems.io/developer-resources/external-api/automations-and-guides/automated-test-alerting-for-slack) guide to create a workflow that:

* Fetches all running tests via the Intelligems API
* Checks each test against your health thresholds (visitor count, SRM, conversion drop, minimum orders)
* Posts a Slack alert when a test fails

Once that workflow is live and verified, continue to Step 2.

### Step 2: Add the "Pause Test" Node <a href="#step-1-get-your-api-keys" id="step-1-get-your-api-keys"></a>

Once a test is flagged as having issues, you can trigger a `POST` request to the Intelligems API to halt the experiment

1. After your Slack Message node, add **"HTTP Request"** node
2. Configure:
   * **Method**: POST
   * **URL**: `https://api.intelligems.io/v25-10-beta/experiences/{{ $('Code in JavaScript1').item.json.experienceId }}/actions/pause`
   * **Authentication**: None
   * Enable **Send Headers**
     * **Name**: `intelligems-access-token`
     * **Value**: `{{ $('Code in JavaScript1').item.json.apiKey }}`
3. Click "Execute step" to verify it works

### Step 3: Update Your Slack Alert (Recommended)

Now that tests are being paused automatically, it's a good idea to update your Slack message to reflect this. Replace your existing Slack message text with something like:

```
🔴 *TEST AUTO-PAUSED*

*Client:* {{ $json.clientName }}
*Test:* <https://app.intelligems.io/experiment/{{ $json.experienceId }}|{{ $json.testName }}>
*Failed Threshold(s):* {{ $json.failedThresholds }}

*Action Taken:* This test has been automatically paused. Please review before restarting.
```

This makes it immediately clear to your team that the test is already stopped — no one needs to manually intervene.


---

# 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.intelligems.io/developer-resources/external-api/automations-and-guides/how-to-automatically-pause-failing-tests.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.
