> For the complete documentation index, see [llms.txt](https://docs.stellic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stellic.com/stellic-partner-api/section-enrollment/remove-a-section-enrollment.md).

# Remove a section enrollment

Use this endpoint when a student drops a section or a section enrollment was created by mistake. If it was the course enrollment's last section, planned sections included, the course enrollment is removed too. If your institution runs timestamp-driven data sync, use [`DELETE /planner/enrollment/section/{id}/{timestamp}`](/stellic-partner-api/section-enrollment/remove-a-section-enrollment-by-timestamp.md) instead; this route returns a 400 with `Expected to receive timestamp.` there.

## DELETE /planner/enrollment/section/{id}

>

```json
{"openapi":"3.0.0","info":{"title":"Stellic for Developers","version":"1.0"},"tags":[{"name":"Section Enrollment"}],"servers":[{"url":"https://{institution}.stellic.com/partnerapi/v1","variables":{"institution":{"default":"{institution}","description":"Your institution's Stellic subdomain: the part before `.stellic.com` in the URL you use to sign in. It becomes the host in every request, as in `https://{institution}.stellic.com/partnerapi/v1/...`. Replace the `{institution}` placeholder with your subdomain before sending."}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal Access Token issued by your Stellic integration partner. Send it as `Authorization: Bearer <token>` on every request. One token per institution; do not share across environments."}}},"paths":{"/planner/enrollment/section/{id}":{"delete":{"tags":["Section Enrollment"],"parameters":[{"name":"id","in":"path","required":true,"description":"The `{id}` you assigned when you created the section enrollment. Matches only enrolled section enrollments that have not been removed and are on a primary plan. An `{id}` can contain `/`; a final slash-separated segment matching the timestamp route's date-and-time pattern is interpreted as `{timestamp}` instead.","schema":{"type":"string"}}],"responses":{"200":{"description":"Enrollment removed, or nothing matched this `{id}`: the response is the same either way, and a miss takes about 3 seconds while the lookup retries. The section enrollment is removed; this route doesn't compare timestamps. If no other section remains on the course enrollment (planned sections included), it's removed the same way. The course enrollment's registration status doesn't change.\n\nCommon causes:\n- Enrollment removed - returns `{success: true, errors: []}`\n- Enrollment not found - returns `{success: true, errors: []}` (idempotent; not an error)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"object"}}}}}}},"400":{"description":"Timestamp-mode mismatch or archived student. `errors` is a plain string in the timestamp-mismatch case and a list of `{message}` objects in the archived-student case.\n\nCommon causes:\n- Institution uses timestamp-driven data sync, so the timestamp segment is required - returns `Expected to receive timestamp.`; use `DELETE /planner/enrollment/section/{id}/{timestamp}`\n- Student is archived - returns ``Cannot delete section enrollment id = `{id}` linked to archived student: `{username}` ``"},"401":{"description":"Missing or invalid Bearer token."},"403":{"description":"Your IP address isn't on the allowlist for this endpoint. Contact Stellic to add it; the response includes the `client_ip` Stellic saw.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"client_ip":{"type":"string"}}}}}},"500":{"description":"Unhandled server error.\n\nCommon causes:\n- Server error - returns ``Couldn't delete section enrollment with id: `{id}`.``"}}}}}}
```

#### What happens after the call

* The section enrollment is removed right away.
* If no other section remains on the course enrollment, it's removed the same way.
* The removal appears in the student's activity history shortly after.
* The student's cached audit is invalidated in a background task, so audit and progress views reflect the change once it runs.

#### Notes

* **An unknown `{id}` still returns 200.** The response is the same whether or not anything was removed, and a miss takes about 3 seconds while the lookup retries. Call `GET` first if you need to know.
* **The course's registration status doesn't change.** To record a drop on the course enrollment, update `registration_status` with [`PATCH /planner/enrollment/section/{id}`](/stellic-partner-api/section-enrollment/update-an-existing-section-enrollment-partial.md) before deleting the section.
* **For `{id}` values containing `/`, keep the full value in the path.** Avoid IDs ending in a slash followed by a timestamp such as `/2024-08-15T10:00:00`, which selects the timestamped route.

#### Related APIs

* [`DELETE /planner/enrollment/section/{id}/{timestamp}`](/stellic-partner-api/section-enrollment/remove-a-section-enrollment-by-timestamp.md) for institutions on timestamp-driven data sync.
* [`GET /planner/enrollment/section/{id}`](/stellic-partner-api/section-enrollment/get-a-section-enrollment.md) to check whether the enrollment exists.
* [`POST /planner/enrollment/section/{id}`](/stellic-partner-api/section-enrollment/enroll-a-student-in-a-section.md) to create a section enrollment.
* [`PUT /planner/enrollment/course/{username}/{term_id}`](/stellic-partner-api/course-enrollments/replace-a-student-s-course-enrollments-for-a-term.md) to remove a whole course by leaving it out of the student's term.
