The API provides two ways to retrieve time spent records:
  1. The time a user spent on a specific attempt
  2. The **cumulative **time spent across all attempts associated with a specific learning item (e.g., activity, module, or training), or across the entire platform.
The API always returns the time spent value in seconds. Formatting the output should be handled on the client platform.

๐Ÿงช Attempt-Level Time Spent

Time spent for a specific attempt is available in the AttemptMetrics object, accessible via the Attempt -> metrics field. This applies to all learning items (e.g. trainings, modules activities). See the example below:
query getLearningPath {
  getLearningPath(lpId: 7) {
    navigation {
      edgeRid
      title
      attempt {
        metrics {
          globalScore
          progress
          status
          timeSpent
        }
      }
    }
    training {
      title
      attempt {
        metrics {
          globalScore
          progress
          status
          timeSpent
        }
      }
    }
  }
}
As shown in the example above, the attempt field is available for both training and navigation items. Within it, youโ€™ll find the time spent (in seconds) for each attempt.

๐Ÿ“Š Cumulative Time Spent

Cumulative time spent can be retrieved using the getCumulativeTimeSpent query. This query accepts several optional arguments that can be combined to filter the results.

Query Arguments
ArgumentTypeRequiredDescription
userContextIdIDNoThe user context ID. If omitted, the user context from the API request will be used.
lpIdIDNoThe learning path ID.
edgeRidIDNoThe edge revision ID (e.g., for a specific activity or module). Requires lpId to be provided.
startDateDateNoStart date in YYYY-MM-DD format. Must be used together with endDate.
endDateDateNoEnd date in YYYY-MM-DD format. Must be used together with startDate.

๐Ÿงพ Usage Examples

By specifying the appropriate arguments, you can retrieve cumulative time spent data for a variety of use cases:
  • โฑ๏ธ Cumulative time spent on a specific learning item (activity or module), optionally filtered by date range
query getCumulativeTimeSpent {
    getCumulativeTimeSpent (userContextId: 251, lpId: 7, edgeRid: 154)
}
  • ๐Ÿ“˜ Cumulative time spent within a learning path, optionally filtered by date range
query getCumulativeTimeSpent {
    getCumulativeTimeSpent (userContextId: 251, lpId: 8, startDate: "2025-05-14", endDate: "2025-05-16")
}
  • ๐ŸŒ Cumulative time spent by a user across the entire platform, optionally filtered by date range
query getCumulativeTimeSpent {
    getCumulativeTimeSpent (userContextId: 251, startDate: "2025-05-14", endDate: "2025-05-16")
}