> For the complete documentation index, see [llms.txt](https://docs.kinwall.family/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kinwall.family/connecting-calendars/sync.md).

# Sync behaviour & intervals

## What gets synced

Each synced calendar keeps events from **30 days back to 365 days ahead**. Sync replaces that calendar's events in one atomic batch. Kinwall-only annotations (members, categories, travel time) are stored separately and re-applied. See [Writable vs read-only](/connecting-calendars/writable-vs-read-only.md).

## When

| Target             | Trigger                                                                                                                                                                  |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Docker / Node      | Every `SYNC_INTERVAL_MINUTES` (default **10**).                                                                                                                          |
| Cloudflare Workers | A cron every **5 minutes**. Each tick syncs only calendars older than `SYNC_INTERVAL_MINUTES` (default 10 in `wrangler.toml`), so a faster cron doesn't double the work. |
| Manual             | **Sync now** on a calendar in **Settings → Calendars**, or `POST /api/calendars/{id}/sync`.                                                                              |
| Reconnect          | Re-attaching an imported calendar, or changing an ICS URL, syncs in the background right away.                                                                           |

Calendars sync **stalest first**, so a newly added calendar (never synced) goes first on the next tick. A tick stops after about 20 seconds.

## Staying within the free tier

* **Google, Microsoft, CalDAV** sync in **31-day slices**. The near slice (yesterday through the next 31 days) refreshes every tick. The far slices take turns and refresh at most every 6 hours.
* **ICS feeds** are fingerprinted. An unchanged feed is skipped without parsing.
* **Sync now** does a full-window sync in one request. On the Workers free tier, a big feed can exceed the CPU budget there even though the cron handles it fine.

## Status and errors

Each calendar row in **Settings → Calendars** shows "Synced *time*", "Never synced", "Local calendar", or the **last error** (with secrets redacted). A failed sync keeps the previous events. Each sync fires a `calendar.synced` [webhook](/integrations/webhooks.md) (with `error` on failure) and `events.changed`.

Turn **Enabled** off in the calendar's **Edit calendar** sheet to stop syncing and hide its events without removing it.

## Live updates in the UI

The apps poll `GET /api/rev` every 15 seconds and when they come back into view. The number goes up on every write, including syncs, and the apps then refetch.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.kinwall.family/connecting-calendars/sync.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
