Skip to main content

REST: Forms

Overview​

The forms resource manages live forms: listing and reading them, reading a form's full definition (its document), creating forms, duplicating them and switching them on or off. Changing the fields and settings of an existing form goes through a draft (REST: Drafts), opened with POST /V1/webforms/forms/{formId}/draft; earlier states are under REST: Versions.

All paths are relative to https://yourdomain.com/rest/all. Drafts and saved versions never appear in these reads: every id here is a live form.

Form summary​

The list, the single read, create, create from template, duplicate and activate return form summaries (opening a draft and restoring a version return a draft summary instead):

Member Meaning
id Form id
code Form code, empty when none is set
name Form name
revision Revision of the live form. Grows with every publish; send it as expected_live_revision when you publish or restore
is_active Whether the form is switched on
has_draft Whether a draft is open; draft_started_by_type (admin or integration) and draft_started_by_name say who opened it
updated_at Last change, RFC 3339 in UTC
warnings What a command changed beyond the request: the import warnings of a create from a document (for example a notification whose recipient is not an email address, which then is not switched on, named with the notification and the value), or a duplicate whose default assignee had to be cleared; otherwise []. A repeated request repeats them
has_executable_markup true when a text of the form runs code on the storefront (see Markup that runs code); set by the single read only, null in the list
live_settings Filled only by create with activate: true: the document keys whose effect reaches beyond the form's page (captcha, registration, access and the like) and that work on the storefront from this moment

Listing forms​

GET /V1/webforms/forms takes Magento's standard searchCriteria query parameters, and at least one of them is required: a request without any is refused by Magento with 400 ("searchCriteria is required").

  • Filter and sort fields: form_id, code, name, is_active, created_at, updated_at. Any other field is refused with 400 INVALID_FILTER.
  • Conditions: eq (default), neq, like (text fields only), in, nin (1 to 50 values), gt, gteq, lt, lteq. At most 5 filter groups and 10 filters in all.
  • pageSize defaults to 20; a larger value than 100 is reduced to 100. currentPage may not exceed 1000.
  • Results are sorted by your sort orders, then by form_id ascending.

total_count counts every matching form, not just the page.

Reading a form's document​

GET /V1/webforms/forms/{formId}/document returns the whole form as one document: form settings, sections, fields, logic, and the notifications, confirmations and PDF documents attached to it. The response carries schema_version, schema_digest, revision and document_json (a JSON string). Add ?storeCode=<code> to read the values a store view sees; an unknown store code answers 404.

Creating a form​

POST /V1/webforms/forms creates a form from a document. Request keys:

Key Required Meaning
request_id yes Your idempotency key
document_json yes The form document as a JSON string. name is the only required member; form_id and schema_version are ignored. Fields and sections may omit ids
name no Overrides the document's name
code no Form code; must not be used by another form
activate no true creates the form switched on, which also needs forms_edit, and answers with live_settings. Default: switched off

The document is validated first; nothing is created when it fails. Settings of the write class none may not be set through the API, and markup that runs code needs forms_scripts.

POST /V1/webforms/forms/from-template creates a form from a starter template and needs both forms_create and forms_edit. Request keys: request_id, template_code, and optionally name and code. The form is always created switched off. An unknown template code answers 404. Template codes are listed by GET /V1/webforms/form-templates. Body: {"request": {"request_id": "erp-template-0001", "template_code": "<template-code>", "name": "Assembly Service Request", "code": "assembly_request"}}.

POST /V1/webforms/forms/{formId}/commands/duplicate copies a form with its notifications and PDF documents. Request keys: request_id, and optionally name and code; the copy is switched off. Body: {"request": {"request_id": "erp-duplicate-0001", "name": "Assembly Service Request (Trade)", "code": "assembly_request_trade"}}. When the source form's default assignee cannot see the copy, the assignee is cleared on the copy and warnings says so. A form whose texts run code is copied only with forms_scripts. A retry with the same request_id answers with the copy it already made, even when the source form is gone since.

Switching a form on or off​

POST /V1/webforms/forms/{formId}/commands/activate with request_id and activate: true or false. Setting the state the form already has changes nothing and still returns the summary. Switching on a form whose texts run code needs forms_scripts, for example a WebForms 3 form with a script in its success text; without it the call is refused with 403 ACTOR_NOT_ALLOWED and parts. Switch such a form on in the admin, or grant the permission. Switching off never needs it.

Confirmations​

A form's confirmations (what a visitor sees after sending) are live state: they are written at once, not through a draft. The confirmations/* routes below read and write one thing of them, the success message of a store view; the confirmation's page, rules and other content are edited in the admin, and a store view's own address and page stay as they are. The form settings success_text and redirect_url are written too, with update-form and a confirmation token (see Drafts). Written without a store view, they change the message and redirect address of the form's default confirmation.

GET /V1/webforms/forms/{formId}/confirmations/content/{storeCode} needs forms_view. It answers with store_code and contents_json: a JSON string with confirmations (per confirmation uuid, name, type, is_default and message, the store view's own success message or null when it has none), defaults (the storefront phrase the store view shows where a confirmation still shows the shipped message) and defaults_locale. An unknown store code answers 404.

POST /V1/webforms/forms/{formId}/confirmations/commands/set-content needs forms_edit. Request keys: request_id, confirmation_ref (the confirmation's uuid), store_code (required: this route doesn't edit the default content) and confirmation_json {"message": …}. Only message may be set. null gives the store view back the default message; a message that shows no text is refused with 400, as is a placeholder the message cannot fill. A change to the shown message needs a confirmation token from prepare-set-content with the same body: see Confirmations.

Authentication​

Requests must be signed with OAuth 1.0a (HMAC-SHA256) with an integration's credentials. Admin tokens are refused with 403 ACTOR_NOT_ALLOWED; unsigned requests are refused by Magento with 401. Create the integration with bin/magento webforms:api:connect and grant it the permissions listed for each operation. An integration limited to selected forms sees only those forms; any other form answers 404, as if it did not exist.

Operations​

Method Path Operation ACL resource
GET /V1/webforms/forms FormReadInterface_getList MageMe_WebForms::api_v1_forms_view
POST /V1/webforms/forms FormWriteInterface_create MageMe_WebForms::api_v1_forms_create
GET /V1/webforms/forms/{formId} FormReadInterface_get MageMe_WebForms::api_v1_forms_view
POST /V1/webforms/forms/{formId}/commands/activate Switching a form on needs Edit Form Scripts (MageMe_WebForms::api_v1_forms_scripts) when a text of the form runs code on the storefront: a switched-on HTML field in a switched-on section (or in none) printed as it is, or the description, success message or text under the form (a script, an event handler, a javascript: address, a directive other than var, if, depend and trans outside a tag in the form texts, and other than store url, store direct_url, view url and media url with no other parameter; in an HTML field any directive but store url, store direct_url and media url with no other parameter inside a quoted attribute value and trans with a phrase alone outside a tag): without it the answer is 403 ACTOR_NOT_ALLOWED with details {key, store_id, parts} and the form stays off; grant the permission or switch the form on in the admin. Switching a form off never needs it, so an integration without the permission can switch such a form off but not back on. A field or section that is off runs nothing until it is switched on, and switching it on in a draft, through restore-version or by publishing takes the permission. MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/forms/{formId}/commands/duplicate Copying a form needs Edit Form Scripts (MageMe_WebForms::api_v1_forms_scripts) when a text of the form runs code on the storefront, as for activate: without it the answer is 403 ACTOR_NOT_ALLOWED with details {key, store_id, parts} and no copy is made; grant the permission or copy the form in the admin. MageMe_WebForms::api_v1_forms_create
POST /V1/webforms/forms/{formId}/commands/restore-version DraftInterface_restoreVersion MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/forms/{formId}/confirmations/commands/{name} set-content changes the message a store view shows at once only when it does not change; a change answers 409 CONFIRMATION_REQUIRED with {changes: {changed, length {before, after}, links {added, removed}}} unless it carries the confirmation_token of prepare-set-content, which takes the same body, writes nothing and answers {confirmation_ref, store_code, requires_confirmation, confirmation_token, expires_at, changes}. MageMe_WebForms::api_v1_forms_edit
GET /V1/webforms/forms/{formId}/confirmations/content/{storeCode} ConfirmationContentManagementInterface_getContents MageMe_WebForms::api_v1_forms_view
GET /V1/webforms/forms/{formId}/document FormReadInterface_getDocument MageMe_WebForms::api_v1_forms_view
POST /V1/webforms/forms/{formId}/draft Opens the form's draft, or returns the one already open. 409 CONFLICT when another change to this form holds it: retry shortly, with the same request_id. MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/forms/{formId}/notifications/commands/{name} update, set-content, set-store-settings and set-conditions on a switched-on notification that change what it sends or to whom answer 409 CONFIRMATION_REQUIRED with {notification_id, changes} unless they carry the confirmation_token of the matching prepare-<command>; prepare-<command> takes the same body, writes nothing and answers {notification_id, command, requires_confirmation, confirmation_token, expires_at, changes}. 409 CONFIRMATION_INVALID for an unknown, malformed, spent or mismatched token. deactivate takes notification_ref and switches the notification off for All Store Views (the default scope), as POST /notifications/{notificationId}/deactivate does, and answers {notification_id, deactivated: true, still_sending_store_views: [store codes]}: the store views of the form whose own Status is On keep sending; switch them off with set-store-settings. changed is false when the default scope was already off. It takes no confirmation and stays open while the license does not cover the installed version. MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/forms/from-template FormWriteInterface_createFromTemplate MageMe_WebForms::api_v1_forms_create

draft and restore-version are described with drafts and versions (REST: Drafts, REST: Versions); the notification commands with notifications (REST: Notifications).

Errors​

Every WebForms error has the shape {"message": "...", "parameters": {"code": "...", "details_schema_version": "1", "details_json": "..."}}. Codes you meet on this resource:

Code HTTP When
VALIDATION_FAILED 400 The document is not valid (details_json.errors lists each problem), or the code is taken (errors: ["code"])
INVALID_FILTER 400 A list filter or sort on a field that is not allowed, or a condition that does not fit the field
ACTOR_NOT_ALLOWED 403 Not an integration, activate: true on create or a create from a template without forms_edit, or a form script or markup that runs code without forms_scripts (also when switching on or copying a form whose texts already run code; details_json {key, store_id, parts[]})
LICENSE_NOT_COVERED 403 The store's WebForms license does not cover this version; creating and duplicating are refused, switching off is not
NOT_FOUND 404 No such form, a form outside the integration's form scope, an unknown store code or template code
CONFIRMATION_REQUIRED 409 set-content of a confirmation without a token; see Confirmations
INDETERMINATE 409 With {saved: true, cache_cleared: false, form_id}: the form was saved (a create or copy names the new form) but the page cache could not be cleared; do not repeat the request
REQUEST_ID_REUSED 409 The request_id was already used with a different request

Examples​

Find a form by its code:

curl -G https://yourdomain.com/rest/all/V1/webforms/forms \
-H "Authorization: <signed-header>" \
--data-urlencode "searchCriteria[filterGroups][0][filters][0][field]=code" \
--data-urlencode "searchCriteria[filterGroups][0][filters][0][value]=assembly_request" \
--data-urlencode "searchCriteria[pageSize]=5"

<signed-header> stands for the OAuth 1.0a Authorization header computed for this request by your OAuth library; the query parameters are part of the signature.

{
"items": [
{"id": 995542, "code": "assembly_request", "name": "Assembly Service Request", "revision": 14, "is_active": false, "has_draft": false, "draft_started_by_type": "", "draft_started_by_name": "", "updated_at": "2026-10-05T20:23:10Z", "warnings": []}
],
"search_criteria": {"filter_groups": ["…"], "page_size": 5, "current_page": 1},
"total_count": 1
}

Create a form, switched off:

curl -X POST https://yourdomain.com/rest/all/V1/webforms/forms \
-H "Authorization: <signed-header>" \
-H "Content-Type: application/json" \
-d @create.json

create.json:

{
"request": {
"request_id": "erp-create-0001",
"code": "assembly_request",
"activate": false,
"document_json": "{\"name\":\"Assembly Service Request\",\"fields\":[{\"type\":\"name\",\"name\":\"Your name\",\"code\":\"customer_name\",\"is_required\":\"1\"},{\"type\":\"email\",\"name\":\"Email\",\"code\":\"email\",\"is_required\":\"1\"},{\"type\":\"textarea\",\"name\":\"What should we assemble?\",\"code\":\"items\"}]}"
}
}
{"id": 995542, "code": "assembly_request", "name": "Assembly Service Request", "revision": 4, "is_active": false, "has_draft": false, "draft_started_by_type": "", "draft_started_by_name": "", "updated_at": "2026-10-05T20:18:00Z", "warnings": []}

A document with an unknown field type:

{"message": "The document is not valid.", "parameters": {"code": "VALIDATION_FAILED", "details_schema_version": "1", "details_json": "{\"errors\":[\"fields[0]: unknown field type \\\"hologram\\\".\"]}"}}

Switch the form on:

curl -X POST https://yourdomain.com/rest/all/V1/webforms/forms/995542/commands/activate \
-H "Authorization: <signed-header>" \
-H "Content-Type: application/json" \
-d '{"request": {"request_id": "erp-activate-0001", "activate": true}}'

The response is the form summary with "is_active": true.

Applies to WebForms 4Last reviewed November 24, 2026