Hello everyone ![]()
I’m currently integrating Open edX with an external backend (built in Node.js) and I’m trying to programmatically unenroll users from courses as an administrator or staff user.
So far, I’ve tested several endpoints:
-
POST /change_enrollment→ works only when the user themselves is logged in (not as admin). -
DELETE /api/enrollment/v1/enrollment→ returns 405 Method Not Allowed on my instance. -
PATCH /api/enrollment/v1/enrollment→ also 405 Method Not Allowed.
I know the Instructor Dashboard → Membership → Unenroll button performs a real unenrollment, but I’d like to reproduce that behavior via API or script — using admin credentials or a service account — without logging in as the learner.
My question:
Is there an officially supported API endpoint or a recommended approach to unenroll a user as admin/staff (e.g., the same one used by the instructor dashboard’s “Unenroll” button)?
If not, would the correct approach be to directly call CourseEnrollment.unenroll(user, course_id) through a Django management command or a custom REST endpoint?
Any pointers to documentation, code references, or working examples (for current Open edX releases) would be greatly appreciated ![]()
Environment:
-
Tutor (local) deployment
-
Open edX Palm (or later)
-
Using LMS REST APIs via admin session (CSRF + cookies)
Thanks in advance for your help!