All Docs
API ReferenceCSI Teachable Replacement AppUpdated March 13, 2026

Lesson Completion Marking API

Lesson Completion Marking API

Available since v1.0.39

This API records when a learner marks a lesson as complete, persists the completion timestamp, and triggers a recalculation of the learner's overall course progress percentage for the enrollment.


Mark a Lesson as Complete

POST /api/enrollments/{enrollmentId}/lessons/{lessonId}/complete

Path Parameters

ParameterTypeRequiredDescription
enrollmentIdstringThe unique identifier of the learner's enrollment in the course.
lessonIdstringThe unique identifier of the lesson being completed.

Request Body

No request body is required.

Response

200 OK — The lesson was successfully marked as complete and the enrollment progress has been updated.

{
  "enrollmentId": "enr_abc123",
  "lessonId": "les_xyz789",
  "completedAt": "2025-01-15T14:32:00Z",
  "courseProgress": {
    "completedLessons": 5,
    "totalLessons": 12,
    "progressPercentage": 41.67
  }
}

409 Conflict — The lesson has already been marked as complete for this enrollment. No duplicate record is created.

{
  "error": "LESSON_ALREADY_COMPLETED",
  "message": "This lesson has already been marked as complete for the given enrollment."
}

404 Not Found — The specified enrollment or lesson does not exist.

{
  "error": "NOT_FOUND",
  "message": "Enrollment or lesson not found."
}

Behavior

  • Idempotency — Calling this endpoint for a lesson that is already complete returns a 409 and does not create duplicate completion records.
  • Timestamp Persistence — The completedAt timestamp is recorded at the time the request is processed and stored permanently against the enrollment.
  • Progress Recalculation — Immediately after a completion is recorded, the course progress percentage is recalculated and returned in the response. The updated value is also reflected in the learner's sidebar and dashboard without requiring a page refresh.

Progress Calculation Formula

progressPercentage = (completedLessons / totalLessons) × 100

The totalLessons count includes all published lessons in the course at the time of the request.


Related