0 people focusing right now

GET /api/projects

Get user's projects with statistics and team projects

Retrieve user's personal and team projects with session statistics, colors, and activity data.

Projects System Overview

RegardingWork has three project types:

Individual Projects: Returns your personal projects with session statistics, colors, and activity data.
Endpoint URL
GET https://game.regardingwork.com/api/projects
Authentication
JWT Bearer token required

📤 Request

Headers
Authorization: Bearer <your_jwt_token>
Optional Query Parameters
  • include_inactive - Include inactive projects (true/false, default: false)
  • type - Filter by type: "personal", "team", or "all" (default: all)
  • sort - Sort by: "recent", "name", "sessions" (default: recent)

✅ Response (200 OK)

{
  "projects": [
    {
      "id": "personal_47",
      "name": "Mac App Development",
      "type": "personal",
      "color": "#3B82F6",
      "pomodoro_count": 34,
      "total_duration": 1150,
      "total_points": 46.8,
      "created_at": "2025-08-01T09:00:00Z",
      "last_used": "2025-08-16T14:30:00Z",
      "is_active": true
    },
    {
      "id": "team_12",
      "name": "Website Redesign",
      "type": "team",
      "team_id": 5,
      "team_name": "Marketing Team",
      "color": "#10B981",
      "pomodoro_count": 8,
      "total_duration": 360,
      "total_points": 14.4,
      "created_at": "2025-08-01T09:00:00Z",
      "last_used": "2025-08-15T16:45:00Z",
      "is_active": true,
      "slack_channel": "#website-redesign"
    },
    {
      "id": "personal_23",
      "name": "Documentation",
      "type": "personal",
      "color": "#F59E0B",
      "pomodoro_count": 18,
      "total_duration": 485,
      "total_points": 19.4,
      "created_at": "2025-07-15T11:30:00Z",
      "last_used": "2025-08-10T10:15:00Z",
      "is_active": true
    }
  ],
  "summary": {
    "total_projects": 3,
    "personal_projects": 2,
    "team_projects": 1,
    "active_projects": 3,
    "total_sessions": 60,
    "total_points": 80.6
  }
}

🎯 Using Project Data

App UI
  • Display projects in dropdowns/lists
  • Show session counts and duration
  • Use project colors for themes
  • Group by personal vs team
Session Submission
  • Use id field for session submission
  • Team projects trigger Slack notifications
  • Personal projects: use project_id
  • Team projects: use team_project_id

💻 Code Examples

JavaScript (Fetch) - Get All Projects
const token = localStorage.getItem('jwt_token');

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

const data = await response.json();

// Separate personal and team projects
const personalProjects = data.projects.filter(p => p.type === 'personal');
const teamProjects = data.projects.filter(p => p.type === 'team');

console.log(`Found ${personalProjects.length} personal and ${teamProjects.length} team projects`);
JavaScript - Build Project Dropdown
// Create project options for UI dropdown
const projectOptions = data.projects.map(project => ({
  value: project.id,
  label: project.type === 'team' ? `🏢 ${project.name}` : `👤 ${project.name}`,
  color: project.color,
  sessions: project.pomodoro_count
}));

// Sort by recent usage
projectOptions.sort((a, b) => new Date(b.last_used) - new Date(a.last_used));

🔗 Related Endpoints

Session Flow
User Management

🔗 Related Endpoints