Log Activity
curl -X POST https://api.inspir.uk/api/streaks/activity \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"activityType": "quiz_completed",
"timeMinutes": 15
}'
Log a study activity for the current day. Automatically updates streak information.
Request
Type of study activity (e.g., quiz_completed, study_guide_created, flashcard_session)
Duration of activity in minutes
Response
Date in YYYY-MM-DD format
Number of activities (incremented on duplicate)
Total time spent in minutes
Longest streak ever achieved
Total days with study activity
{
"activity": {
"user_id": "user123",
"activity_date": "2024-01-15",
"activity_type": "quiz_completed",
"activity_count": 1,
"total_time_minutes": 15
},
"streak": {
"current_streak": 7,
"longest_streak": 14,
"total_study_days": 42
}
}
Errors
{
"error": "Activity type is required"
}
Get Current Streak
curl https://api.inspir.uk/api/streaks/current \
-H "Authorization: Bearer YOUR_TOKEN"
Get the current user’s streak information.
Response
Current consecutive days with activity
Longest streak ever achieved
Total number of days with study activity
Date of last activity (YYYY-MM-DD format)
Number of streak freezes available
{
"current_streak": 7,
"longest_streak": 14,
"total_study_days": 42,
"last_activity_date": "2024-01-15",
"streak_freeze_count": 2
}
Get Activity History
curl https://api.inspir.uk/api/streaks/history?days=30 \
-H "Authorization: Bearer YOUR_TOKEN"
Get study activity history for the specified time period.
Query Parameters
Number of days to retrieve (going back from today)
Response
Array of activity records sorted by date (descending)
Date in YYYY-MM-DD format
Activities grouped by date for easier consumption
Number of unique days with activity in the period
{
"activities": [
{
"user_id": "user123",
"activity_date": "2024-01-15",
"activity_type": "quiz_completed",
"activity_count": 3,
"total_time_minutes": 45
},
{
"user_id": "user123",
"activity_date": "2024-01-15",
"activity_type": "study_guide_created",
"activity_count": 1,
"total_time_minutes": 20
},
{
"user_id": "user123",
"activity_date": "2024-01-14",
"activity_type": "quiz_completed",
"activity_count": 2,
"total_time_minutes": 30
}
],
"groupedByDate": {
"2024-01-15": [
{
"activity_type": "quiz_completed",
"activity_count": 3,
"total_time_minutes": 45
},
{
"activity_type": "study_guide_created",
"activity_count": 1,
"total_time_minutes": 20
}
],
"2024-01-14": [
{
"activity_type": "quiz_completed",
"activity_count": 2,
"total_time_minutes": 30
}
]
},
"totalDays": 2
}
Get Activity Stats
curl https://api.inspir.uk/api/streaks/stats?days=30 \
-H "Authorization: Bearer YOUR_TOKEN"
Get aggregated statistics by activity type for the specified time period.
Query Parameters
Number of days to analyze (going back from today)
Response
Returns an object where keys are activity types and values are aggregated statistics.
Total number of activities of this type
Total time spent on this activity type
{
"quiz_completed": {
"count": 15,
"totalTimeMinutes": 225
},
"study_guide_created": {
"count": 3,
"totalTimeMinutes": 60
},
"flashcard_session": {
"count": 8,
"totalTimeMinutes": 120
}
}