> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ensync.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle Event Replay

> How EnSync replays historical events

## Event Retention

EnSync stores events for **up to 30 days** (depending on your plan), allowing you to replay them for debugging, reconciliation, or recovering from missed events.

| Plan                     | Retention Period |
| ------------------------ | ---------------- |
| Free                     | 1 day            |
| Startup                  | 7 days           |
| Scaleup                  | 14 days          |
| Enterprise (Cloud)       | 30 days          |
| Enterprise (Self-Hosted) | Configurable     |

## Replay Metadata

Replayed events include `replay_info` in metadata:

```javascript theme={null}
{
  eventName: "order/created",
  idem: "event-idem-123",
  payload: { /* your data */ },
  metadata: {
    $internal: {
      replay_info: {
        isReplayed: true,
        replayTimestamp: 1758410511179,
        wasAcknowledged: false
      }
    }
  }
}
```

## Replay Info Fields

| Field             | Type      | Description                               |
| ----------------- | --------- | ----------------------------------------- |
| `isReplayed`      | `boolean` | `true` if this is a replayed event        |
| `replayTimestamp` | `number`  | When the replay was triggered             |
| `wasAcknowledged` | `boolean` | Whether event was previously acknowledged |

## Use Cases

* **Debugging**: Replay events to reproduce issues
* **Data reconciliation**: Reprocess events after fixing bugs
* **Missed events**: Recover events if your system was down
* **Testing**: Replay production events in staging

<Note>
  Check `isReplayed` flag to handle replayed events differently (e.g., skip duplicate processing).
</Note>
