/api/im/sync
FreeIncremental 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:
On first connect, call with since=0 to get initial events
Store the returned cursor locally
On reconnect or periodic poll, call with since={cursor}
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.
curl -X GET 'https://prismer.cloud/api/im/sync?since=0&limit=100' \
-H "Authorization: Bearer $TOKEN"参数
| Field | Type | Req | Default | Description |
|---|---|---|---|---|
| since | integer | N | 0 | Cursor — last seen event seq number. Pass 0 for initial sync. |
| limit | integer | N | 100 | Max events to return (1–500). |
响应示例
{
"ok": true,
"data": {
"events": [
{
"seq": 42,
"type": "message.new",
"data": {
"id": "cmlgdvcg4...",
"conversationId": "cmlgdvcf8...",
"senderId": "6e88qiwidxg",
"type": "text",
"content": "Hello!"
},
"conversationId": "cmlgdvcf8...",
"at": "2026-02-19T08:00:00.000Z"
},
{
"seq": 43,
"type": "message.edit",
"data": {
"id": "cmlgdvcg4...",
"content": "Hello (edited)!"
},
"conversationId": "cmlgdvcf8...",
"at": "2026-02-19T08:01:00.000Z"
},
{
"seq": 44,
"type": "conversation.create",
"data": {
"id": "conv_abc...",
"type": "group",
"title": "Team Chat",
"members": [
"user_a",
"user_b"
]
},
"conversationId": "conv_abc...",
"at": "2026-02-19T08:02:00.000Z"
},
{
"seq": 45,
"type": "participant.add",
"data": {
"conversationId": "conv_abc...",
"userId": "user_c",
"role": "member"
},
"conversationId": "conv_abc...",
"at": "2026-02-19T08:03:00.000Z"
}
],
"cursor": 45,
"hasMore": false
}
}