Skip to main content
POST
/
course_lessons
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  appID: 'app_xxxxxxxxxxxxxx',
  apiKey: 'My API Key',
});

const lesson = await client.courseLessons.create({ chapter_id: 'chap_xxxxxxxxxxxxx', lesson_type: 'text' });

console.log(lesson.id);
{
  "id": "lesn_xxxxxxxxxxxxx",
  "title": "<string>",
  "order": 42,
  "lesson_type": "text",
  "visibility": "visible",
  "content": "<string>",
  "days_from_course_start_until_unlock": 42,
  "video_asset": {
    "id": "mux_xxxxxxxxxxxxxx",
    "asset_id": "<string>",
    "playback_id": "<string>"
  },
  "main_pdf": {
    "id": "<string>",
    "filename": "<string>",
    "content_type": "<string>",
    "url": "<string>"
  },
  "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": "<string>",
        "content_type": "<string>",
        "url": "<string>"
      },
      "options": [
        {
          "id": "crsaqo_xxxxxxxxxxx",
          "option_text": "<string>",
          "is_correct": true,
          "order": 42
        }
      ]
    }
  ],
  "attachments": [
    {
      "id": "<string>",
      "filename": "<string>",
      "content_type": "<string>",
      "url": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json

Parameters for CreateLesson

chapter_id
string
required

The ID of the chapter to create the lesson in

Example:

"chap_xxxxxxxxxxxxx"

lesson_type
enum<string>
required

The type of the lesson

Available options:
text,
video,
pdf,
multi,
quiz,
knowledge_check
content
string | null

The content of the lesson

days_from_course_start_until_unlock
integer | null

Days from course start until unlock

Example:

42

title
string | null

The title of the lesson

Response

A successful response

A lesson from the courses app

id
string
required

The ID of the lesson

Example:

"lesn_xxxxxxxxxxxxx"

title
string
required

The title of the lesson

order
integer
required

The order of the lesson within its chapter

Example:

42

lesson_type
enum<string>
required

The type of the lesson (text, video, pdf, multi, quiz, knowledge_check)

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

The visibility of the lesson. Determines how / whether this lesson is visible to users.

Available options:
visible,
hidden
content
string | null
required

The content of the lesson

days_from_course_start_until_unlock
integer | null
required

Number of days from course start until the lesson is unlocked

Example:

42

video_asset
object | null
required

The associated Mux asset for video lessons

main_pdf
object | null
required

The main PDF file for this lesson

assessment_questions
object[]
required

Assessment questions for quiz/knowledge check lessons

attachments
object[]
required

The attached files in this lesson as a flat array