POST /activities/:activityId/submit

POST /activities/:activityId/submit

Validation schema for quiz submission questionId -> selectedAnswer POST /api/activities/[activityId]/submit Verify user is authenticated with Clerk Get user's profile to get Supabase id Apply rate limiting for API mutations Parse and validate request body Fetch activity to get quiz content Verify activity is a quiz Get or create activity_progress Check max attempts Grade the quiz Points for questions that can be auto-graded Grade based on question type Essay questions require manual grading Not graded yet Case-insensitive matching for short answer Exact match for true/false and multiple choice Fallback for unknown types Calculate percentage based on auto-gradable questions only Essay questions don't count toward automatic passing/failing Overall percentage (including essay questions that will be manually graded) For quizzes with essay questions, only auto-graded portion determines pass/fail Essay questions will be manually graded later Get course_id from module Determine status: if essay questions exist and not all auto-graded questions passed, mark as in_progress Otherwise use passed/failed If there are essay questions and auto-graded portion didn't pass, keep as in_progress If auto-graded portion passed, mark as completed (essays will be graded separately) Update or create activity_progress Update enrollment progress if quiz passed (only if no essay questions or all auto-graded questions passed) Return quiz result Add rate limit headers First get all modules for the course Get all required activities for these modules Get completed activities for this course Update enrollment Don't throw - this is not critical

Endpoint

POST /activities/:activityId/submit

Authentication

This endpoint requires authentication. Include your authentication token in the request headers.

Path Parameters

ParameterTypeDescription
activityIdstringPath parameter

Error Responses

Status CodeError CodeDescription
401HTTP_401Unauthorized
404HTTP_404Not Found
429HTTP_429Error
400HTTP_400Bad Request
404HTTP_404Not Found
400HTTP_400Bad Request
403HTTP_403Forbidden
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error

Example Request

curl -X POST "https://api.allurelms.com/activities/activityId-value/submit" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'