CourseLit logoCourseLit Docs
Api reference

Create a product lesson

Creates a lesson. `text` lessons accept Tiptap/ProseMirror JSON in `content`; `embed` lessons accept `{ value }` in `content`; `quiz` lessons accept quiz JSON in `content`; media-backed lessons (`video`, `audio`, `pdf`, `file`) use `media`. SCORM lessons are not supported.

POST
/api/products/{productId}/lessons

Creates a lesson. text lessons accept Tiptap/ProseMirror JSON in content; embed lessons accept { value } in content; quiz lessons accept quiz JSON in content; media-backed lessons (video, audio, pdf, file) use media. SCORM lessons are not supported.

Authorization

ApiKeyAuth
x-api-key<token>

API key created in CourseLit dashboard settings. The legacy apikey request-body field is still accepted but deprecated.

In: header

Path Parameters

productId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://school.courselit.app/api/products/string/lessons" \  -H "Content-Type: application/json" \  -d '{    "title": "Introduction to AI",    "type": "text",    "groupId": "section_abc123",    "content": {      "type": "doc",      "content": [        {          "type": "heading",          "attrs": {            "level": 2          },          "content": [            {              "type": "text",              "text": "Install Rust"            }          ]        },        {          "type": "paragraph",          "content": [            {              "type": "text",              "text": "Install "            },            {              "type": "text",              "marks": [                {                  "type": "bold"                }              ],              "text": "rustup"            },            {              "type": "text",              "text": " and create your first project."            }          ]        },        {          "type": "bulletList",          "content": [            {              "type": "listItem",              "content": [                {                  "type": "paragraph",                  "content": [                    {                      "type": "text",                      "text": "Run the installer."                    }                  ]                }              ]            }          ]        },        {          "type": "codeBlock",          "attrs": {            "language": "bash"          },          "content": [            {              "type": "text",              "text": "cargo new hello-rust"            }          ]        }      ]    },    "requiresEnrollment": true,    "published": false  }'
{
  "lessonId": "string",
  "title": "string",
  "type": "text",
  "content": {
    "type": "doc",
    "content": [
      {}
    ]
  },
  "media": {
    "mediaId": "string",
    "originalFileName": "string",
    "mimeType": "string",
    "size": 0,
    "access": "public",
    "file": "string",
    "thumbnail": "string",
    "caption": "string"
  },
  "downloadable": true,
  "courseId": "string",
  "groupId": "string",
  "requiresEnrollment": true,
  "published": true
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}