Documentation

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

    min: 0
  • actualSecondsintegerRequired

    Actual elapsed time

    min: 0
  • 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)

    format: date-time
  • completedAtstring<date-time>Required

    Session end time (ISO 8601)

    format: date-time
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

      format: date-time
    • completedAtstring<date-time>Required

      When the session ended

      format: date-time
    • createdAtstring<date-time>Required

      Record creation timestamp

      format: date-time
  • dailyStatsPomodoroDailyStats
    • idinteger
    • userIdstring
    • datestring<date>

      Date (YYYY-MM-DD)

      format: date
    • 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>
      format: date-time
    • updatedAtstring<date-time>
      format: 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"
}'