import { WhopClient } from "@whop/sdk";
const client = new WhopClient({ token: "YOUR_TOKEN", apiVersionDate: "2026-08-21-1", idempotencyKey: "YOUR_IDEMPOTENCY_KEY" });
await client.courseLessons.submitAssessment({
lesson_id: "lesson_id",
answers: [{
question_id: "question_id"
}]
});
curl --request POST \
--url https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"answers": [
{
"question_id": "<string>",
"answer_text": "<string>",
"selected_option_ids": [
"<string>"
]
}
]
}
'import requests
url = "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment"
payload = { "answers": [
{
"question_id": "<string>",
"answer_text": "<string>",
"selected_option_ids": ["<string>"]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
answers: [
{
question_id: '<string>',
answer_text: '<string>',
selected_option_ids: ['<string>']
}
]
})
};
fetch('https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'answers' => [
[
'question_id' => '<string>',
'answer_text' => '<string>',
'selected_option_ids' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment"
payload := strings.NewReader("{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-12-01T05:00:00.401Z",
"id": "crsar_xxxxxxxxxxxx",
"lesson": {
"id": "lesn_xxxxxxxxxxxxx",
"title": "Understanding Candlestick Patterns"
},
"result_correct": 42,
"result_grade": 6.9,
"result_graded_questions": {},
"result_passing_grade": true,
"result_question_count": 42,
"score_percent": 6.9,
"updated_at": "2023-12-01T05:00:00.401Z",
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}{
"error": null
}{
"error": null
}{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}Submit assessment course lesson
Submit answers for a quiz or knowledge check lesson and receive a graded result.
import { WhopClient } from "@whop/sdk";
const client = new WhopClient({ token: "YOUR_TOKEN", apiVersionDate: "2026-08-21-1", idempotencyKey: "YOUR_IDEMPOTENCY_KEY" });
await client.courseLessons.submitAssessment({
lesson_id: "lesson_id",
answers: [{
question_id: "question_id"
}]
});
curl --request POST \
--url https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"answers": [
{
"question_id": "<string>",
"answer_text": "<string>",
"selected_option_ids": [
"<string>"
]
}
]
}
'import requests
url = "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment"
payload = { "answers": [
{
"question_id": "<string>",
"answer_text": "<string>",
"selected_option_ids": ["<string>"]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
answers: [
{
question_id: '<string>',
answer_text: '<string>',
selected_option_ids: ['<string>']
}
]
})
};
fetch('https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'answers' => [
[
'question_id' => '<string>',
'answer_text' => '<string>',
'selected_option_ids' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment"
payload := strings.NewReader("{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/course_lessons/{lesson_id}/submit_assessment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"answers\": [\n {\n \"question_id\": \"<string>\",\n \"answer_text\": \"<string>\",\n \"selected_option_ids\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-12-01T05:00:00.401Z",
"id": "crsar_xxxxxxxxxxxx",
"lesson": {
"id": "lesn_xxxxxxxxxxxxx",
"title": "Understanding Candlestick Patterns"
},
"result_correct": 42,
"result_grade": 6.9,
"result_graded_questions": {},
"result_passing_grade": true,
"result_question_count": 42,
"score_percent": 6.9,
"updated_at": "2023-12-01T05:00:00.401Z",
"user": {
"id": "user_xxxxxxxxxxxxx",
"name": "John Doe",
"username": "johndoe42"
}
}{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}{
"error": null
}{
"error": null
}{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}Authorizations
An Account API key, account-scoped JWT, App API key, or user OAuth token. Prepend the key or token with Bearer, for example Bearer ***************************.
Path Parameters
The unique identifier of the quiz or knowledge check lesson to submit answers for (e.g., "les_XXXXX").
Body
Parameters for SubmitAssessment
The list of answers to submit for each assessment question.
Show child attributes
Show child attributes
Response
A successful response
The result of a user's assessment attempt
The datetime the assessment result was created.
"2023-12-01T05:00:00.401Z"
The unique identifier for the assessment result.
"crsar_xxxxxxxxxxxx"
The lesson this assessment result is for
Show child attributes
Show child attributes
The number of correct answers
42
The grade achieved on the assessment
6.9
Array of graded questions with details
Whether the user achieved a passing grade
The total number of questions in the assessment
42
The percentage score achieved on the assessment
6.9
The datetime the assessment result was last updated.
"2023-12-01T05:00:00.401Z"
The user who took the assessment
Show child attributes
Show child attributes

