---
title: "Save Draft To Canonical"
method: POST
path: "/notebook/draft/save-to-canonical"
tags: ["runtime_mutations", "notebook"]
---

# Save Draft To Canonical

`POST /notebook/draft/save-to-canonical`

Promote a session draft to canonical.

Outside generation: CAS conflict detection (or ``force=True``). During
generation, ``save_to_canonical`` force-writes the live draft because the
draft store is the notebook source of truth for user and agent edits. Either
way the draft is preserved on success with a refreshed
``canonical_base_revision``.

Any ``pending_user_edits`` are applied first via the same per-cell write
path the ``notebook_cell_user_edit`` socket handler uses, so an explicit
save inside the user edit debounce window is atomic with respect to the
user's latest typing.

Autosave requests (``autosave=True``) no-op during generation instead of
inheriting the force-write semantics above, mirroring what ``save_draft``
does for draft saves. An autosave flag wins over ``force`` — a background
save must never bypass CAS.

## Request body

- DraftSaveToCanonicalRequest
  - `notebook_id` string, required
  - `force` boolean
  - `autosave` boolean
  - `pending_user_edits` PendingUserEdit[]
    - `cell_id` string, required
    - `content` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

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