> For the complete documentation index, see [llms.txt](https://docs.telm.ai/telmai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telm.ai/telmai/monitoring-data/user-defined-monitors/replay-scan.md).

# Replay Scan

The **Replay** feature lets you run custom SQL metrics against historical data scans. This enables you to validate new monitor logic against past data and backfill results to identify historical anomalies without waiting for new data to arrive.

{% hint style="info" %}
**Why use Replay?** If you create a new **Custom metric** monitor written as a **SQL query** that uses `@now`, Replay lets you see how it would have performed over previous scans, providing immediate historical context.
{% endhint %}

## Prerequisites & Availability

To ensure data consistency during historical runs, the Replay feature has specific requirements:

* **Scope:** Available for **Custom metric** monitors written as a **SQL query** only.
* **Required Parameter:** The monitor's SQL query **must** contain the `@now` parameter. This ensures the logic anchors correctly to the specific timestamp of the historical scan.

## Triggering a Replay

Replay is started when you save the monitor in the monitor builder.

1. On the last step of the builder, click the arrow next to **Save** and choose **Save & Replay**.
2. In **Replay Configuration**, set the **Scan Depth**: how many past scans to replay the monitor against, up to **20**, or as many as the asset has.
3. Click **Confirm & Replay**.

**Save** on its own saves the monitor without replaying it. See [Creating a Monitor](https://docs.telm.ai/telmai/monitoring-data/monitors-management/creating-a-monitor.md).

## Validation & Error States

| Condition               | UI Behavior                                                                                                |
| ----------------------- | ---------------------------------------------------------------------------------------------------------- |
| **@now not in query**   | **Save & Replay** is disabled; its tooltip says the SQL needs the @now parameter to define the time window |
| **No historical scans** | Replay disabled; indicator shows "No data to replay"                                                       |
| **Replay in progress**  | Progress indicator shown; re-triggering is disabled                                                        |

### API Reference

See [Replay Monitor Scan](https://docs.telm.ai/telmai/api-reference/upload-data-api/replay-monitor-scan.md) for the API reference.
