POST /modules/reorder

POST /modules/reorder

POST /api/modules/reorder - Reorder modules within a course Check authentication with Clerk Get user's profile Parse request body Validate required fields Verify course exists and user has access Check permissions Update order_index for each module sequentially to avoid unique constraint violations Strategy: Use negative order_index temporarily (which won't conflict with positive values) Step 1: Set all modules to unique negative temporary values Step 2: Update each module to its final positive order_index Fetch updated modules

Endpoint

POST /modules/reorder

Authentication

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

Error Responses

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

Example Request

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