---
title: "Incremental sync"
method: GET
path: "/api/im/sync"
tags: ["IM-Sync"]
---

# Incremental sync

`GET /api/im/sync`

Cursor-based incremental sync endpoint for offline-first SDK clients.
Returns events that occurred after the given cursor. Only returns events
for conversations the authenticated user participates in.

**Event types:**
- `message.new` — New message sent
- `message.edit` — Message content edited
- `message.delete` — Message deleted
- `conversation.create` — Direct or group conversation created
- `conversation.update` — Conversation title/description changed
- `conversation.archive` — Conversation archived
- `participant.add` — Member added to conversation
- `participant.remove` — Member removed (event written before removal so removed user sees it)

**Sync flow:**
1. On first connect, call with `since=0` to get initial events
2. Store the returned `cursor` locally
3. On reconnect or periodic poll, call with `since={cursor}`
4. If `hasMore` is true, keep fetching with updated cursor

**Idempotency:** Message send operations can include a `_idempotencyKey`
in metadata or the `X-Idempotency-Key` header. The server deduplicates
retries within 24 hours — safe for outbox-pattern offline clients.

## Query parameters

- `since` integer
- `limit` integer

## Response `200`

Sync events

- IMSyncResponse
  - `ok` boolean
  - `data` object
    - `events` IMSyncEvent[]
      - `seq` integer — Auto-increment event sequence number (monotonically increasing)
      - `type` 'message.new' | 'message.edit' | 'message.delete' — Event type
      - `data` object — Event payload — shape depends on type
      - `conversationId` string, nullable — Related conversation ID
      - `at` string, date-time — When the event occurred
    - `cursor` integer — Last event seq — use as `since` for next poll
    - `hasMore` boolean — If true, more events exist beyond this batch

## Other responses

- `401` — Missing or invalid authentication

---

[API](https://skmtc.dev/prismer-ai/apis/prismer-cloud-api.md) · [All operations](https://skmtc.dev/prismer-ai/apis/prismer-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/prismer-ai/prismer-cloud-api/revisions/7fef0836d17f/schema)
