v4

latestOpenAPI 3.1.02026-08-08349225311.7 KB
runtime_mutations
notebook

Save Draft 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.

post/notebook/draft/save-to-canonical

Request body

notebook_idstring required
forceboolean
autosaveboolean

Response

Successful Response

{"stackTrail":"paths:/notebook/draft/save-to-canonical:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}