Client
lessons.list()
Fetches available lessons from the courses configured in timeback.config.json.
Filter to a specific configured course. If omitted, returns lessons across all configured courses.
Return type
Response shape (not executable)
Examples
lessons.start()
Starts or resumes a lesson session. Returns a LessonSession that manages the question loop and time tracking. An activity tracker starts automatically, so TimeSpentEvent heartbeats begin immediately.
Course reference for time tracking. Required unless a client-level
defaultCourse is configured. Must match a course in timeback.config.json. Use either subject + grade or a course code.Determines how the SDK handles the question loop and completion. Pass
lesson.type from the discovery result. The two primary types behave differently:powerpath-100: adaptive (questions served one at a time by the lesson mastery check; the session completes when the check passes, which is when the score becomes 100)quiz: static (all questions fetched in a batch, session completes via explicit finalization)
test-out, placement, unit-test) follow the same static pattern as quiz.Display name for the activity tracker. Defaults to the server lesson type, then the lesson ID; pass
name: lesson.name for the discovery title.Request a fresh attempt instead of reusing progress. The SDK catches errors from finalization/creation; inspect the returned attempt because this option does not guarantee that a new attempt was created. Without it, existing progress can include an already finalized attempt.When
true, the behavior depends on the lesson type:- Quiz-like types (
quiz,test-out, etc.): the current attempt is finalized first (scored with whatever was answered), then a new attempt is created powerpath-100: PowerPath attempts cannot be finalized via the API, so a new attempt is created directly
Examples
Lesson session
The object returned bylessons.start(). Manages the question loop, scoring state, and time tracking for a single lesson attempt.
Properties
Most properties are set once when the session is created.
score updates after submit() and complete(); finalized updates only after complete(). These mutations do not automatically trigger framework rendering.The delivery mode for this session. Resolved from the server response, falling back to the
lessonType you passed to lessons.start(), then to 'quiz'.Controls how the SDK fetches questions (next() hits the server each time for adaptive, fetches all at once for linear) and how completion works (adaptive auto-completes at score 100, linear requires explicit finalization).The PowerPath attempt number (1, 2, 3, …).
undefined on first-ever access when no prior
attempt data exists.Cumulative score for the current attempt. Starts at the value returned by PowerPath (0 for new attempts, or the saved score when resuming).Updates live after each
submit() call and again after complete() with the final score. For powerpath-100, this is the mastery check’s progress: it rises after each right answer, never falls, stays at 99 or below while the attempt is open or after a fail, and is 100 only when the check passes, which completes the lesson. For quiz types, the score typically updates at finalization.Total questions in the lesson, as reported by PowerPath. For linear lessons (
quiz, test-out,
etc.), this is the fixed question count. For adaptive lessons (powerpath-100), this may be
undefined since the total varies based on the student’s performance.Number of questions the student had already seen when the session started. For
powerpath-100,
reflects how many questions were served before the session was resumed. For linear lesson types,
always 0 (linear quizzes track answered questions differently via their local buffer).Whether the lesson attempt has been finalized. This is the SDK/PowerPath progress flag, not an acknowledgement of all downstream gradebook or event delivery.Initial value depends on lesson type: for
powerpath-100, always starts false (adaptive sessions are never pre-finalized). For quiz types, reflects whether the attempt was already completed when resuming.submit() updates the private question-loop completion state, not this public flag. complete() updates the flag from the server result.Methods
Returns the next question, or
null when there are no more questions.Behavior depends on lesson type:powerpath-100(adaptive): each call makes a server round-trip. The lesson mastery check serves the next question on its list; a wrong answer adds another question on the same skill. Returnsnullafter a submit that passed the check (score 100). After a failed check the server refuses the next question (422), and the student has to review the lesson before a new attempt.quizand other linear types: the first call fetches all questions from the server in a single batch and buffers them locally. Subsequent calls return the next unanswered question from the buffer with no network request. Already-answered questions (from a resumed attempt) are skipped automatically.
null immediately if the session is already completed.Submits the student’s answer to PowerPath and returns the scored result.After each call,
session.score is updated with the server’s response. If the server signals that the lesson is complete (e.g., a powerpath-100 mastery check that passed, score 100), the private question-loop completion state is set and subsequent next() calls return null; public session.finalized is unchanged until complete().For powerpath-100, correct reflects real-time scoring (the server evaluates immediately). For quiz types, correct is always false during the quiz. Evaluation happens at finalization.Finalizes the lesson in two steps:
- Server: reads progress and, for unfinalized linear lessons, attempts finalization then re-reads progress. Errors in that finalization call are caught; the result can still have
finalized: false. For adaptive lessons the SDK returns current progress withfinalized: truewithout checking a mastery threshold. - Client: calls
activity.end()to flush the final time tracking heartbeat. Ifend()rejects,timeTrackingSentis false. Heartbeat network failures are usually swallowed inside the tracker, so true does not confirm server delivery.
session.score and session.finalized with the server’s final values.Flushes any accumulated time to the server, then stops heartbeats until
resume() is called.
No-op if already paused or if the session has ended. Paused time is not counted as active
learning time.Starts a fresh time tracking window and restarts heartbeats. No-op if not currently paused or if
the session has ended.
LessonQuestion
The object returned by session.next():
Response shape (not executable)
content.rawXml field contains QTI XML. Your app is responsible for parsing and rendering this.
LessonSubmitResult
The object returned by session.submit():
Response shape (not executable)
LessonSessionCompleteResult
The object returned by session.complete():
Response shape (not executable)
timeTrackingSent reports whether tracker cleanup threw. It is not delivery confirmation. Inspect finalized separately and reconcile missing analytics; data loss is not limited to the last heartbeat interval. See Handle time tracking
errors.lessons.attempts()
Lists all attempts for a lesson.
Return type
Response shape (not executable)
lessons.attemptDetails()
Gets per-question data for a specific attempt. The response is a discriminated union based on lesson type.
Which attempt to review (1, 2, 3, …). Get available attempt numbers from
lessons.attempts().Return type
Adaptive lessons (powerpath-100):
Response shape (not executable)
quiz, test-out, etc.):
Response shape (not executable)
LessonAttemptQuestion
Response shape (not executable)
getLessonAttemptQuestions()
Helper that normalizes the discriminated attemptDetails() response into a flat LessonAttemptQuestion[]:
Server
The server-side lessons namespace exposes the same operations without session management or automatic time tracking. Each operation is a standalone async function call — your backend controls the lifecycle directly. See the FastAPI or Next.js adapter docs for server setup.The server namespace uses
lesson and student identifiers directly, unlike the client API which uses lessonId and resolves the student from the authenticated session.timeback.lessons.list(input?)
Lists lessons from the configured courses. Same behavior as the client lessons.list().
Filter to a specific configured course. Accepts
{ subject, grade } or { code }. If omitted, returns lessons across all configured courses.Examples
timeback.lessons.start(input)
Starts or resumes a lesson attempt. Unlike the client’s lessons.start(), this returns a plain result object — no LessonSession or time tracking.
Start a fresh attempt instead of resuming. Behaves the same as the client
forceNew option.Return type
Response shape (not executable)
Examples
timeback.lessons.next(input)
Returns the next question(s) for a lesson attempt. The return type depends on lesson type:
powerpath-100: returns a singleLessonQuestion- All other types: returns a
LessonQuestionBatchwith all questions
Pass
"powerpath-100" for adaptive single-question delivery. If omitted, the server inspects progress and routes adaptive lessons accordingly; a contradictory explicit type is rejected.Return type
Response shape (not executable)
Examples
timeback.lessons.submit(input)
Submits a student’s answer to a lesson question.
Return type
Response shape (not executable)
Examples
timeback.lessons.complete(input)
Attempts linear finalization and returns progress, with the limitations described for session.complete() above. Unlike the client method, it does not flush time tracking.
Return type
Response shape (not executable)
Examples
timeback.lessons.attempts(input)
Lists all attempts for a lesson/student pair. Same return type as the client lessons.attempts().
Examples
timeback.lessons.attemptDetails(input)
Returns raw progress data for a specific attempt. See client lessons.attemptDetails() for the discriminated return shape.