Restore canvas version
POST /canvas/v1/canvases/{canvas_id}:restore
Recover a canvas after an unwanted edit by restoring a retained version from versions.list or its earliest_restorable_version. This replaces current nodes, variables and themes with the target state and creates one new version; history remains available, so restoring can itself be undone with another restore. Restoring the current version succeeds without creating a version. Optionally guard the write with expected_version from retrieve or nodes.list; if it is stale, inspect current state and retry with the new value. Repeating an unguarded request after another edit can create another restore version. Versions from before history was enabled or outside retention cannot be recovered. Connected viewers resync after a successful restore.
Support: supported
Parameters
| Name | Location | Type | Required | Description |
|---|---|---|---|---|
| canvas_id | path | string | true | Canvas id returned by create or list, in the form cvs_ followed by 16 lowercase letters or digits; a display name is not accepted. |
Request body (application/json)
Required: true
| Name | Type | Description |
|---|---|---|
| version | string | Historical target from versions.list or earliest_restorable_version; restoring the current version creates no new commit. |
| expected_version | string | Current version from retrieve or nodes.list to guard against concurrent edits; omission applies the restore to whichever version is current. |
{ "type": "object", "required": [ "version" ], "properties": { "version": { "type": "string", "pattern": "^[0-9]+$", "example": "1", "description": "Historical target from versions.list or earliest_restorable_version; restoring the current version creates no new commit." }, "expected_version": { "type": "string", "pattern": "^[0-9]+$", "example": "2", "description": "Current version from retrieve or nodes.list to guard against concurrent edits; omission applies the restore to whichever version is current." } }}Response
HTTP 200
New current version and the target it restored; restoring the already-current version leaves the version unchanged.
application/json
| Name | Type | Description |
|---|---|---|
| version | string | Current version after restoring; increases by one except when the requested target was already current. |
| restored_from | string | Historical target that supplied the restored canvas state; use versions.list to inspect its commit metadata. |