Skip to content

Sync API

GET /api/sync/status
Terminal window
curl http://localhost:8000/api/sync/status

Response 200 OK

{
"running": false,
"last_run_at": "2026-04-03T10:00:00Z",
"last_summary": {
"synced": 42,
"errors": 0,
"conflicts": 2
}
}

Starts a sync run in the background. Returns immediately.

POST /api/sync/run
Terminal window
curl -X POST http://localhost:8000/api/sync/run

Response 202 Accepted

{"message": "Sync started"}

Monitor progress via WebSocket at ws://localhost:8000/ws.

Errors

CodeReason
409A sync cycle is already running

Runs sync and waits for completion. Suitable for automation/cron.

POST /api/sync/run/await
Terminal window
curl -X POST http://localhost:8000/api/sync/run/await

Response 200 OK

{
"summary": {
"synced": 42,
"errors": 0,
"conflicts": 2
}
}

Errors

CodeReason
409A sync cycle is already running
500Sync engine error
---
## WebSocket events
Connect to `ws://localhost:8000/ws` to receive real-time events:
| Event | Payload |
|---|---|
| `sync_complete` | `{synced, errors, conflicts}` |
| `sync_error` | `{message}` |
| `conflict_resolved` | `{wcp_id, winner}` |
| `conflict_dismissed` | `{wcp_id}` |
| `scan_complete` | `{bindings_count}` |
| `link_deleted` | `{wcp_id}` |
| `ping` | *(keepalive, no payload)* |