DELETE /courses/:courseId

DELETE /courses/:courseId

GET /api/courses/[courseId] - Get a single course Check authentication with Clerk Use service role client to bypass RLS (we check permissions manually) Get user's profile Fetch the course (try without foreign key first, then add instructor separately if needed) Fetch instructor separately Add instructor to course object Check access permissions Users who are the instructor can always access their courses (This includes users with course:create permission who created the course) Access granted Fetch modules for this course PATCH /api/courses/[courseId] - Update a course Check authentication with Clerk Get user's profile Fetch the existing course Check permissions Parse request body Build update object Only admins can reassign instructor Verify new instructor exists in the same tenant Update the course DELETE /api/courses/[courseId] - Soft delete a course Check authentication with Clerk Get user's profile Only admins can delete courses Soft delete the course

Endpoint

DELETE /courses/:courseId

Authentication

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

Path Parameters

ParameterTypeDescription
courseIdstringPath parameter

Error Responses

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

Example Request

curl -X DELETE "https://api.allurelms.com/courses/courseId-value" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"