POST /modules/:moduleId/activities

POST /modules/:moduleId/activities

Validation schema for creating an activity JSONB content varies by activity type GET /api/modules/[moduleId]/activities Use service role client to bypass RLS for profile lookup Verify user is authenticated with Clerk Get user's profile for tenant_id Verify the module exists and user has access Fetch all activities for this module Note: learning_activities table may not exist yet, return empty array if it doesn't Table may not exist yet - return empty array instead of error POST /api/modules/[moduleId]/activities Use service role client to bypass RLS for profile lookup Verify user is authenticated with Clerk Parse and validate request body Additional validation for quiz content Get user's profile for tenant_id and permissions Verify the module exists and user has access (fetch tenant_id and course info in one query) Check if user has permission to create activities Check for explicit permissions if not admin/instructor Get the next order_index Create the activity with tenant_id

Endpoint

POST /modules/:moduleId/activities

Authentication

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

Path Parameters

ParameterTypeDescription
moduleIdstringPath parameter

Error Responses

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

Example Request

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