GET /api/sync/status
Check synchronization status across devices
Monitor synchronization status across all user devices and detect sync conflicts or delays.
Use Case: Essential for app startup checks and troubleshooting sync issues between Mac, Windows, and web platforms.
Endpoint URL
GET https://game.regardingwork.com/api/sync/status
Authentication
JWT Bearer token required📤 Request
Headers
Authorization: Bearer <your_jwt_token>
Optional Query Parameters
include_devices
- Include device-specific details (true/false, default: true)check_conflicts
- Check for data conflicts (true/false, default: false)last_hours
- Check sync status for last N hours (default: 24)
✅ Response (200 OK)
{
"sync_status": "healthy",
"last_sync": "2025-08-24T15:30:45Z",
"sync_lag": "2 minutes",
"total_devices": 3,
"active_devices": 2,
"pending_syncs": 0,
"devices": [
{
"device_id": "mac-app-v1.2.3",
"device_type": "mac_app",
"last_seen": "2025-08-24T15:30:45Z",
"sync_status": "up_to_date",
"version": "1.2.3",
"sessions_pending": 0
},
{
"device_id": "web-chrome-desktop",
"device_type": "web_timer",
"last_seen": "2025-08-24T15:25:30Z",
"sync_status": "up_to_date",
"version": "web-2.1.0",
"sessions_pending": 0
},
{
"device_id": "windows-app-v1.1.0",
"device_type": "windows_app",
"last_seen": "2025-08-24T14:15:22Z",
"sync_status": "stale",
"version": "1.1.0",
"sessions_pending": 2
}
],
"data_summary": {
"total_sessions": 89,
"unsynced_sessions": 2,
"last_session": "2025-08-24T15:30:00Z",
"preferences_updated": "2025-08-23T10:15:30Z",
"conflicts_detected": 0
},
"recommendations": [
"Windows app has 2 pending sessions - sync recommended",
"All preferences are up to date across devices"
]
}
🔄 Sync Status Types
Overall Status
- healthy: All devices synced ✅
- delayed: Minor sync lag ⚠️
- conflicts: Data conflicts detected ❌
- offline: No recent device activity 📱
Device Status
- up_to_date: Fully synced
- stale: Behind by hours/days
- pending: Sessions waiting to sync
- offline: Not seen recently
⚠️ Conflict Detection Response
When conflicts are detected (check_conflicts=true)
{
"sync_status": "conflicts",
"conflicts": [
{
"type": "session_overlap",
"description": "Overlapping sessions detected from different devices",
"affected_sessions": ["uuid-1", "uuid-2"],
"resolution": "manual_review_required",
"devices": ["mac_app", "web_timer"]
}
],
"conflict_resolution": {
"auto_resolvable": false,
"recommended_action": "Review overlapping sessions and delete duplicates",
"support_contact": "api-support@regardingwork.com"
}
}
💻 Code Examples
JavaScript (Fetch) - Quick Sync Check
const token = localStorage.getItem('jwt_token');
async function checkSyncStatus() {
const response = await fetch('https://game.regardingwork.com/api/sync/status', {
headers: {
'Authorization': `Bearer ${token}`
}
});
const sync = await response.json();
if (sync.sync_status === 'healthy') {
console.log('✅ All devices synced');
} else if (sync.pending_syncs > 0) {
console.log(`⏳ ${sync.pending_syncs} sessions pending sync`);
} else if (sync.sync_status === 'conflicts') {
console.warn('❌ Sync conflicts detected - manual review needed');
}
return sync;
}
JavaScript - Device Status Display
// Display device sync status in UI
function displayDeviceStatus(devices) {
devices.forEach(device => {
const statusIcon = {
'up_to_date': '✅',
'stale': '⚠️',
'pending': '⏳',
'offline': '📱'
}[device.sync_status] || '❓';
const timeSinceSync = new Date() - new Date(device.last_seen);
const hoursAgo = Math.floor(timeSinceSync / (1000 * 60 * 60));
console.log(`${statusIcon} ${device.device_type} (${hoursAgo}h ago)`);
if (device.sessions_pending > 0) {
console.log(` 📋 ${device.sessions_pending} sessions pending`);
}
});
}
🔗 Related Endpoints
Sync & Status
- GET /api/health - Service health
- GET /api/user/data - Current user data
- GET /api/analytics/tracking - Usage analytics
Resolve Issues
- POST /api/pomodoro/submit - Sync pending sessions
- PUT /api/user/preferences - Update preferences
- POST /api/login - Re-authenticate