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

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

const response = await client.courseLessons.submitAssessment('lesson_id', {
  answers: [{ question_id: 'question_id' }],
});

console.log(response.id);
{
  "id": "crsar_xxxxxxxxxxxx",
  "created_at": "2023-12-01T05:00:00.401Z",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "result_grade": 6.9,
  "result_correct": 42,
  "result_question_count": 42,
  "result_passing_grade": true,
  "result_graded_questions": {},
  "score_percent": 6.9,
  "user": {
    "id": "user_xxxxxxxxxxxxx",
    "name": "<string>",
    "username": "<string>"
  },
  "lesson": {
    "id": "lesn_xxxxxxxxxxxxx",
    "title": "<string>"
  }
}

Authorizations

Authorization
string
header
required

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

Path Parameters

lesson_id
string
required

The ID of the lesson (quiz or knowledge check) to submit answers for

Body

application/json

Parameters for SubmitAssessment

answers
object[]
required

The answers to the assessment questions

Response

A successful response

The result of a user's assessment attempt

id
string
required

The ID of the assessment result

Example:

"crsar_xxxxxxxxxxxx"

created_at
string<date-time>
required

When the assessment was taken

Example:

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

updated_at
string<date-time>
required

When the assessment result was last updated

Example:

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

result_grade
number
required

The grade achieved on the assessment

Example:

6.9

result_correct
integer
required

The number of correct answers

Example:

42

result_question_count
integer
required

The total number of questions in the assessment

Example:

42

result_passing_grade
boolean
required

Whether the user achieved a passing grade

result_graded_questions
object
required

Array of graded questions with details

score_percent
number
required

The percentage score achieved on the assessment

Example:

6.9

user
object
required

The user who took the assessment

lesson
object
required

The lesson this assessment result is for