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
| Parameter | Type | Description |
|---|---|---|
moduleId | string | Path parameter |
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 400 | HTTP_400 | Bad Request |
| 400 | HTTP_400 | Bad Request |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal 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 '{}'