Skip to main content
PATCH
/
course_lessons
/
{id}
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});

const lesson = await client.courseLessons.update('lesn_xxxxxxxxxxxxx');

console.log(lesson.id);
{
  "id": "lesn_xxxxxxxxxxxxx",
  "title": "Understanding Candlestick Patterns",
  "order": 42,
  "lesson_type": "text",
  "visibility": "visible",
  "content": "In this lesson, we will cover the basics of technical analysis...",
  "days_from_course_start_until_unlock": 42,
  "embed_type": "youtube",
  "embed_id": "dQw4w9WgXcQ",
  "created_at": "2023-12-01T05:00:00.401Z",
  "thumbnail": {
    "url": "https://media.whop.com/abc123/optimized.jpg"
  },
  "video_asset": {
    "id": "mux_xxxxxxxxxxxxxx",
    "asset_id": "<string>",
    "playback_id": "<string>",
    "signed_playback_id": "<string>",
    "status": "uploading",
    "audio_only": true,
    "duration_seconds": 42,
    "signed_video_playback_token": "<string>",
    "signed_thumbnail_playback_token": "<string>",
    "signed_storyboard_playback_token": "<string>",
    "created_at": "2023-12-01T05:00:00.401Z",
    "updated_at": "2023-12-01T05:00:00.401Z",
    "finished_uploading_at": "2023-12-01T05:00:00.401Z"
  },
  "main_pdf": {
    "id": "<string>",
    "filename": "document.pdf",
    "content_type": "image/jpeg",
    "url": "https://media.whop.com/abc123/optimized.jpg"
  },
  "assessment_questions": [
    {
      "id": "crsaq_xxxxxxxxxxxx",
      "question_text": "<string>",
      "question_type": "short_answer",
      "correct_answer": "<string>",
      "order": 42,
      "created_at": "2023-12-01T05:00:00.401Z",
      "image": {
        "id": "<string>",
        "filename": "document.pdf",
        "content_type": "image/jpeg",
        "url": "https://media.whop.com/abc123/optimized.jpg"
      },
      "options": [
        {
          "id": "crsaqo_xxxxxxxxxxx",
          "option_text": "<string>",
          "is_correct": true,
          "order": 42
        }
      ]
    }
  ],
  "attachments": [
    {
      "id": "<string>",
      "filename": "document.pdf",
      "content_type": "image/jpeg",
      "url": "https://media.whop.com/abc123/optimized.jpg"
    }
  ]
}

Authorizations

Authorization
string
header
required

A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************

Path Parameters

id
string
required

The unique identifier of the lesson to update (e.g., "les_XXXXX").

Example:

"lesn_xxxxxxxxxxxxx"

Body

application/json

Parameters for UpdateLesson

assessment_completion_requirement
object

The passing criteria for quiz or knowledge check lessons, such as minimum grade or correct answers.

assessment_questions
object[] | null

The full list of assessment questions for quiz or knowledge check lessons. Replaces all existing questions.

attachments
FileInputWithId · object[] | null

File attachments for the lesson such as PDFs or documents. Replaces all existing attachments.

content
string | null

The rich text or HTML content body of the lesson.

days_from_course_start_until_unlock
integer | null

The number of days after a student starts the course before this lesson becomes accessible.

Example:

42

embed_id
string | null

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

embed_type
enum<string> | null

The type of video embed for this lesson, such as YouTube or Loom.

Available options:
youtube,
loom
lesson_type
enum<string> | null

The content type of the lesson, such as video, text, quiz, or knowledge check.

Available options:
text,
video,
pdf,
multi,
quiz,
knowledge_check
main_pdf
FileInputWithId · object

The primary PDF document attached to this lesson for student reference.

max_attempts
integer | null

The maximum number of attempts a student is allowed for assessment lessons.

Example:

42

mux_asset_id
string | null

The identifier of a Mux video asset to attach to this lesson (e.g., "mux_XXXXX").

Example:

"mux_xxxxxxxxxxxxxx"

thumbnail
FileInputWithId · object

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

title
string | null

The display title of the lesson (e.g., "Getting Started with APIs").

visibility
enum<string> | null

Controls whether this lesson is visible to students or hidden as a draft.

Available options:
visible,
hidden

Response

A successful response

An individual learning unit within a chapter, which can contain text, video, PDF, or assessment content.

id
string
required

The unique identifier for the lesson.

Example:

"lesn_xxxxxxxxxxxxx"

title
string
required

The display name of the lesson shown to students. Maximum 120 characters.

Example:

"Understanding Candlestick Patterns"

order
integer
required

The sort position of this lesson within its parent chapter, starting from zero.

Example:

42

lesson_type
enum<string>
required

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

Available options:
text,
video,
pdf,
multi,
quiz,
knowledge_check
visibility
enum<string>
required

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

Available options:
visible,
hidden
content
string | null
required

The text body of the lesson in plain text format. Null if the lesson has no text content.

Example:

"In this lesson, we will cover the basics of technical analysis..."

days_from_course_start_until_unlock
integer | null
required

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

Example:

42

embed_type
enum<string> | null
required

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

Available options:
youtube,
loom
embed_id
string | null
required

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

Example:

"dQw4w9WgXcQ"

created_at
string<date-time>
required

The datetime the lesson was created.

Example:

"2023-12-01T05:00:00.401Z"

thumbnail
object
required

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

video_asset
object
required

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

main_pdf
object
required

The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded.

assessment_questions
object[]
required

The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types.

attachments
object[]
required

All supplementary files attached to this lesson returned as a flat array rather than a paginated connection.