Restore version
layerz_restore_versionRestore the model to a previous version, replacing the current items, schema, and inputs with that snapshot. Identify the target with exactly one of { revision_id } (preferred — stable sha256 from layerz_history), { version_number }, or { id } (raw row UUID). Non-destructive: the current live state is first saved as a new restore version, so a restore can itself be undone by restoring that backup. The restored state is then recorded as its own history entry labelled with your summary. backup_version_id is null when the live state already matched the latest snapshot (nothing new to back up) — the prior state stays recoverable from that existing snapshot. Pick the target by reading layerz_history / layerz_diff first. Returns { ok, restored_version_id, restored_version_number, restored_revision_id, backup_version_id }. Mutating — not available for read-only API keys. Requires write access; the target must be inside the plan history retention window.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| summary | Yes | Required: short human-readable note (3–100 chars) summarising what this change does. Shown as the label in the model version history. Be specific (e.g. "Renamed Revenue to Net Revenue", "Imported 2024 OPEX from Excel"). | |
| version | Yes | Version to restore. Exactly one of revision_id / version_number / id. | |
| model_id | No | Target model UUID. Required for user-scoped API keys; ignored (or validated against scope) for model-scoped keys. |