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
| Parameter | Type | Description |
|---|---|---|
courseId | string | Path parameter |
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 400 | HTTP_400 | Bad Request |
| 400 | HTTP_400 | Bad Request |
| 403 | HTTP_403 | Forbidden |
| 404 | HTTP_404 | Not Found |
| 400 | HTTP_400 | Bad Request |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 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 DELETE "https://api.allurelms.com/courses/courseId-value" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"