REST: Versions
Overview
Each time a draft is published, WebForms keeps the state it replaces as a version. These reads list a form's versions and return the document of any one of them; restore-version brings an old state back through a draft. In the admin the same list is the form's version history, see Drafts and versions.
GET /V1/webforms/forms/{formId}/versions returns items, newest first, and total_count:
| Member | Meaning |
|---|---|
id | Version id |
form_id | The live form |
operation | What replaced this state: publish (a draft was published) or revert (a restored version was published) |
captured_at | When the state was replaced, RFC 3339 in UTC |
replaced_by_admin_id | The admin user whose publish replaced it; 0 when an integration published |
GET /V1/webforms/forms/{formId}/versions/{versionId}/document returns the version's document in the same envelope as a live document (schema_version, schema_digest, document_json, revision). Inside the document, form_id is the version's own id.
Restoring a version
POST /V1/webforms/forms/{formId}/commands/restore-version with request_id, version_id and expected_live_revision (the live form's current revision) opens a new draft holding that version's content and returns its draft summary. Nothing changes on the live form until you validate and publish that draft as described on REST: Drafts; the publish is then recorded with operation: revert. Validate first: a restore that drops fields lists them in the impact, and drops answered fields only with a confirmation.
Authentication
OAuth 1.0a integration credentials, as described on REST API. Reading versions needs forms_view. restore-version needs forms_edit.
Operations
| Method | Path | Operation | ACL resource |
|---|---|---|---|
| GET | /V1/webforms/forms/{formId}/versions | FormReadInterface_getVersions | MageMe_WebForms::api_v1_forms_view |
| GET | /V1/webforms/forms/{formId}/versions/{versionId}/document | FormReadInterface_getVersionDocument | MageMe_WebForms::api_v1_forms_view |
POST /V1/webforms/forms/{formId}/commands/restore-version is listed with the form operations on REST: Forms.
Errors
| Code | HTTP | When |
|---|---|---|
NOT_FOUND | 404 | No such form, a form outside the integration's form scope, or a version id that is not a version of this form |
LIVE_REVISION_MISMATCH | 409 | restore-version: the live form changed; details_json.current_revision has its revision |
DRAFT_EXISTS | 409 | restore-version: a draft is already open for the form; details_json.draft_id names it. Publish or discard that draft first |
REQUEST_ID_REUSED | 409 | restore-version: the request_id was already used with a different request |
ACTOR_NOT_ALLOWED | 403 | restore-version without forms_scripts when the version brings back markup that runs code the live form doesn't run; details_json {key, store_id, parts[]}, see Markup that runs code |
LICENSE_NOT_COVERED | 403 | restore-version: the store's WebForms license does not cover this version |
The refusals every route shares are listed on REST API.
Examples
List the versions of form 995542:
curl https://yourdomain.com/rest/all/V1/webforms/forms/995542/versions \
-H "Authorization: <signed-header>"
{
"items": [
{"id": 995548, "form_id": 995542, "operation": "revert", "captured_at": "2026-10-05T20:19:21Z", "replaced_by_admin_id": 0},
{"id": 995546, "form_id": 995542, "operation": "publish", "captured_at": "2026-10-05T20:18:53Z", "replaced_by_admin_id": 0}
],
"search_criteria": null,
"total_count": 2
}
Restore version 995546 (this example shows the moment before the restore; the revert version in the list above is what its later publish recorded):
curl -X POST https://yourdomain.com/rest/all/V1/webforms/forms/995542/commands/restore-version \
-H "Authorization: <signed-header>" -H "Content-Type: application/json" \
-d '{"request": {"request_id": "erp-restore-0001", "expected_live_revision": 8, "version_id": 995546}}'
{"draft_id": 995547, "live_id": 995542, "draft_revision": 0, "live_revision": 8, "started_by_type": "integration", "started_by_id": 5, "started_by_name": "ERP sync"}
Sending the same body again replays this answer. A second restore with a new request_id (erp-restore-0002) while that draft is still open:
{"message": "A draft is already open for this form; discard it or take it over first.", "parameters": {"code": "DRAFT_EXISTS", "details_schema_version": "1", "details_json": "{\"draft_id\":995547}"}}
With a stale live revision:
{"message": "The live form changed.", "parameters": {"code": "LIVE_REVISION_MISMATCH", "details_schema_version": "1", "details_json": "{\"current_revision\":8}"}}