0 people focusing right now

GET /api/user/data

Get complete user profile and productivity data

Retrieve complete user profile including points, streaks, badges, and preferences for app synchronization.

Sample User "janechen": 45-minute default sessions, 8-session daily goal, 12-day current streak. Your app must handle real user preferences, not defaults.
Endpoint URL
GET https://game.regardingwork.com/api/user/data
Authentication
JWT Bearer token required

📤 Request

Headers
Authorization: Bearer <your_jwt_token>

No request body required - This is a GET endpoint

✅ Response (200 OK)

{
  "userId": "42",
  "username": "janechen",
  "email": "jane@example.com",
  "timezone": "America/New_York",
  "points": {
    "total": 234.7,
    "today": 12.5,
    "this_week": 89.2,
    "this_month": 67.3
  },
  "streaks": {
    "current": 12,
    "longest": 28,
    "days_active_this_week": 5,
    "days_active_this_month": 18
  },
  "badges": [
    "early_bird",
    "consistent_week", 
    "power_user",
    "marathon_session",
    "weekend_warrior"
  ],
  "preferences": {
    "daily_goal": 8,
    "default_duration": 45,
    "short_break_duration": 5,
    "long_break_duration": 20,
    "notification_sound": "chime",
    "theme_preference": "dark"
  },
  "session_stats": {
    "total_sessions": 89,
    "total_minutes": 3420,
    "average_session_length": 38.4,
    "most_productive_hour": 14,
    "favorite_category": "Programming"
  }
}

💡 How to Use This Data

App Configuration
  • Set timer default to preferences.default_duration
  • Show daily goal progress using preferences.daily_goal
  • Configure break timers from preferences
  • Apply user's theme preference
Motivation Display
  • Show current streak: streaks.current
  • Display total points: points.total
  • Highlight earned badges
  • Track progress toward daily goal

❌ Error Responses

401 Unauthorized
{
  "error": "Invalid or expired token"
}
403 Forbidden
{
  "error": "Token required"
}

💻 Code Examples

JavaScript (Fetch)
const token = localStorage.getItem('jwt_token');

const response = await fetch('https://game.regardingwork.com/api/user/data', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

const userData = await response.json();
console.log(`Total points: ${userData.points.total}`);
console.log(`Current streak: ${userData.streaks.current} days`);
console.log(`Default duration: ${userData.preferences.default_duration} minutes`);
cURL
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     https://game.regardingwork.com/api/user/data

🔗 Related Endpoints

User Management
Session Management