# Keeping a copy in sync

> Keep a local copy current with a watermark and removal checks.

Source: https://platform.kite.sa/docs/guides/sync

**Only after what's new? Subscribe to webhooks instead.** If you are re-running `GET /listings` with `sort=newest` on a timer to catch new listings, price changes or removals, a [webhook](https://platform.kite.sa/docs/guides/webhooks) posts `listing.created`, `listing.price_changed`, `listing.updated`, `listing.delisted` and `listing.relisted` to your URL for the same filters, and deliveries aren't metered. Keep the sync below for a full local copy, and let webhooks tell you what changed between passes.

Most integrations keep a local copy of the listings they care about. The API is built for that, and one shape works:

1. Query with `sort=updated_asc` and an `updated_since` of your choice.
2. Page through with the cursor, writing each listing to your own store.
3. When you reach the end of the results — or `result_window_reached` tells you you've reached your plan's paging depth — start a new query with `updated_since` set to the last `updated_at` you received and `updated_after_id` set to that listing's `id`. Keep the full timestamp precision.
4. Repeat on whatever schedule suits you. Kite picks up most new listings hourly and re-reads every source twice a day, so more often than hourly buys you little.

```bash
curl "https://api.kite.sa/v1/listings?city=riyadh&listing_type=rent\
&sort=updated_asc&updated_since=2026-09-01T00:00:00Z&limit=100" \
  -H "Authorization: Bearer $KITE_API_KEY"
```

**Why `updated_asc` and not `newest`.** Cursors carry an offset into the result set. Under any other sort, a listing added or removed while you're paging shifts rows across a page boundary, so you silently skip some and see others twice. Ordering by `updated_at` ascending and advancing a watermark means anything you miss on one pass simply arrives on the next.

**Expect listings you have already seen.** `updated_at` is the source's own update time where it publishes one, and the last time Kite saw the listing where it doesn't. For those sources it moves every crawl, so those listings re-enter your sync twice a day even when nothing about them changed. Compare before you write, or accept the churn.

**Detecting removals.** Subscribe to `listing.delisted` and a removal is posted to you; `listing.relisted` tells you when one comes back under the same id. Without a webhook, a listing that is sold, rented, withdrawn or merged as a duplicate simply stops being returned: `GET /listings/{id}` gives a `404` and `GET /listings/batch` returns the id in `missing_ids`. Re-check the ids you hold on a schedule — batch costs 1 unit per id — and treat a miss as removed. Under the terms you have 7 days to stop showing it.

**Storage is capped at 30 days.** You may keep Kite data to run your application for up to 30 days from when you retrieved it; after that, refresh it or delete it. A sync that keeps its copy current satisfies this by construction, which is the main reason to run one rather than to bulk-load once. Aggregates you derive for internal reporting may be kept longer, as long as they can't be reversed into listing-level data.

**Sizing it.** Paging depth caps how far one query reaches — 500 results on Sandbox, 5,000 results on Starter, 5,000 results on Growth, 20,000 results on Pro. A city-wide sync will exceed that, which is exactly what the advancing watermark is for. A page of 100 costs 100 units, so a 20,000-listing pass costs 20,000.
