Sessions
Record a session
Records a completed, skipped, or abandoned session. Also updates daily statistics automatically.
Production (Pomodoro microservice)StagingUAT
POSThttps://pomodoro.ankiren.com/api/me/pomodoro/sessions
Request Body
Bắt buộc.
- type"work" | "shortBreak" | "longBreak"Required
Type of Pomodoro session:
- work: Focus/work session (default 25 min)
- shortBreak: Short break (default 5 min)
- longBreak: Long break after 4 work sessions (default 15 min)
- durationSecondsintegerRequired
Configured duration
- actualSecondsintegerRequired
Actual elapsed time
- status"completed" | "skipped" | "abandoned"Required
Session completion status:
- completed: Session ran to completion
- skipped: User skipped to next session
- abandoned: User reset or changed session type mid-timer
- startedAtstring<date-time>Required
Session start time (ISO 8601)
- completedAtstring<date-time>Required
Session end time (ISO 8601)
application/json
{ "type": "work", "durationSeconds": 1500, "actualSeconds": 1500, "status": "completed", "startedAt": "2026-01-10T10:00:00Z", "completedAt": "2026-01-10T10:25:00Z" }
Responses
201 · Session recorded
- sessionPomodoroSession
- idintegerRequired
Session ID
- userIdstringRequired
User ID
- type"work" | "shortBreak" | "longBreak"Required
Type of Pomodoro session:
- work: Focus/work session (default 25 min)
- shortBreak: Short break (default 5 min)
- longBreak: Long break after 4 work sessions (default 15 min)
- durationSecondsintegerRequired
Configured duration in seconds
- actualSecondsintegerRequired
Actual time elapsed before completion/skip/abandon
- status"completed" | "skipped" | "abandoned"Required
Session completion status:
- completed: Session ran to completion
- skipped: User skipped to next session
- abandoned: User reset or changed session type mid-timer
- startedAtstring<date-time>Required
When the session started
- completedAtstring<date-time>Required
When the session ended
- createdAtstring<date-time>Required
Record creation timestamp
- dailyStatsPomodoroDailyStats
- idinteger
- userIdstring
- datestring<date>
Date (YYYY-MM-DD)
- workSessionsCompletedinteger
Number of completed work sessions
- workSecondsTotalinteger
Total work time in seconds
- breakSessionsCompletedinteger
Number of completed break sessions
- breakSecondsTotalinteger
Total break time in seconds
- longestStreakinteger
Longest consecutive work sessions
- createdAtstring<date-time>
- updatedAtstring<date-time>
application/json
{ "session": { "id": 1, "userId": "clxyz123", "type": "work", "durationSeconds": 1500, "actualSeconds": 1500, "status": "completed", "startedAt": "2026-01-10T10:00:00Z", "completedAt": "2026-01-10T10:25:00Z", "createdAt": "2026-01-10T10:25:00Z" }, "dailyStats": { "id": 1, "userId": "clxyz123", "date": "2026-01-10", "workSessionsCompleted": 5, "workSecondsTotal": 7500, "breakSessionsCompleted": 4, "breakSecondsTotal": 1500, "longestStreak": 4, "createdAt": "2026-01-10T08:00:00Z", "updatedAt": "2026-01-10T10:25:00Z" } }
Sample Code
Đổi ngôn ngữ ở ô Language trên thanh Documentation.
cURL
curl -X POST 'https://pomodoro.ankiren.com/api/me/pomodoro/sessions' \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"type": "work",
"durationSeconds": 1500,
"actualSeconds": 1500,
"status": "completed",
"startedAt": "2026-01-10T10:00:00Z",
"completedAt": "2026-01-10T10:25:00Z"
}'