---
title: "Cleanup Schedule Session"
method: POST
path: "/schedules/{schedule_id}/cleanup"
---

# Cleanup Schedule Session

`POST /schedules/{schedule_id}/cleanup`

Immediately remove a session and request cancellation of its active work.

Args:
    schedule_id: Unique identifier of the session to clean up.

Returns:
    A cleanup confirmation message for the supplied identifier.

Raises:
    None for missing sessions; cleanup is intentionally idempotent.

Behavior:
    Existing sessions are synchronously removed through ``cleanup_session``;
    unknown identifiers still receive the same success-shaped response. Running
    thread-pool work may finish internally after its future is cancelled, but
    its session is no longer addressable.

## Path parameters

- `schedule_id` string, required

## Response `200`

Successful Response

- MessageResponse — Generic message response model. **Usage:** ```python MessageResponse(message="ok") ``` **Fields:** - message: Response message text
  - `message` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/mucsci/apis/course-scheduler-api.md) · [All operations](https://skmtc.net/mucsci/apis/course-scheduler-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mucsci/course-scheduler-api/revisions/f728bfcee693/schema)
