# Event-Based Notifications & CDC

Gormic provides a unified **change tracking system** to help external systems stay in sync with your data. This system supports both:

* **CDC Logs**: Pull-based access to historical change events.
* **Event-Based Notifications**: Real-time push via webhooks.

Both mechanisms operate over a shared, abstract interface, allowing integrators to track changes across modules like Orders, Products, Customers, and more.

## How It Works

Each module that supports change tracking is identified by a **log key** (e.g., main, `transactional`). You can either:

* **Pull changes** manually from the log (`pullChanges` endpoint)
* **Subscribe** to receive webhooks in real time for selected actions

This enables flexible sync patterns for both batch systems and real-time integrations.

## Pull-Based Change Log (CDC)

Use the `pullChanges` API to **manually fetch change events** for a specific log key.

#### Parameters:

<table><thead><tr><th width="168.15753173828125">Param</th><th>Description</th></tr></thead><tbody><tr><td><code>logKey</code></td><td>The log key to track (e.g., <code>main</code>, <code>transactional</code>)</td></tr><tr><td><code>offset</code></td><td>Cursor returned from the previous pull. Start with <code>"0"</code> or latest offset.</td></tr></tbody></table>

* Use the `next` value as the offset in your next request.
* Continue pulling until `next` is not present.

## Event-Based Notifications (Webhooks)

For real-time integration, you can subscribe to webhook notifications triggered by changes in supported modules.

#### Parameters

<table><thead><tr><th width="187.294677734375">Param</th><th>Description</th></tr></thead><tbody><tr><td><code>logKey</code></td><td>The log key to track(e.g., <code>main</code>, <code>transactional</code>)</td></tr><tr><td><code>action</code></td><td>optional. Example: <code>create</code>, <code>update</code>, <code>delete</code></td></tr><tr><td><code>url</code></td><td>The public URL where events should be delivered</td></tr><tr><td><code>token</code></td><td>Bearer token used to sign the request for auth</td></tr></tbody></table>
