---
title: "Generate All Schedules"
method: POST
path: "/schedules/{schedule_id}/generate_all"
---

# Generate All Schedules

`POST /schedules/{schedule_id}/generate_all`

Start one background task to generate all remaining schedules up to the limit.

Args:
    schedule_id: Unique identifier of the generation session to exhaust.

Returns:
    Confirmation containing the current retained count and target limit; the
    response does not wait for enumeration to finish.

Raises:
    HTTPException: Status 404 for an unknown session, 409 when another background
        run is active, 400 when the requested limit is already reached, or the
        initialization errors documented by the scheduler/generator helpers.

Behavior:
    Initialization completes before a single session-owned task is created.
    That task repeatedly uses the same locked advance path as ``/next``, stopping
    on the requested bound, solution-space exhaustion, cancellation, or error.
    Terminal reasons and unexpected error text are recorded for status queries;
    concurrent next or generate-all calls observe the active-task conflict.

## Path parameters

- `schedule_id` string, required

## Response `200`

Successful Response

- GenerateAllResponse — Response model for generate-all schedule requests. **Usage:** ```python GenerateAllResponse(message='...', current_count=1, target_count=10) ``` **Fields:** - message: Status message about the generation process - current_count: Number of schedules already generated - target_count: Target number of schedules to generate
  - `message` string, required
  - `current_count` integer, required
  - `target_count` integer, 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)
