Skip to main content

REST: Notifications

Overview​

A form's email notifications are managed with commands on the form, outside its draft: each command changes the live form's notifications at once. A change to a switched-on notification needs a confirmation token first (see below). A new notification starts switched off. Switching one on is a two-step, reviewed operation: prepare shows what will be sent and returns a token, confirm with that token switches it on. Switching off is one call. In the admin the same steps are described in Test and activate.

Two ways to address a notification:

  • uuid (notification_ref) in the commands. It is unique within its form.
  • notification_id (a number) in the activation routes. It is unique on the store.

Both appear on each notification in the form's document (GET /V1/webforms/forms/{formId}/document, member notifications), and add and duplicate return both.

Commands​

POST /V1/webforms/forms/{formId}/notifications/commands/{name}. Every command takes request_id. notification_json is a JSON string. The answer has form_id, changed and payload_json.

Command Request keys Payload
add notification_json: a notification uuid, notification_id
update notification_ref, notification_json: the keys to change uuid, notification_id, revision_id
set-content notification_ref, notification_json: subject, preheader, body_html for one store view, or null to remove that store view's own text; optional store_code. Without it the default text is written (store_id 0), which store views without their own text use; their own texts stay. For a store view the call sets the store view's whole content: a text left out comes from the default as update
set-store-settings notification_ref, notification_json: the delivery settings of one store view (to, cc, bcc as recipient sources without role, an empty list for nobody in that role; sender_identity, reply_to_policy, enabled), or null to drop the store view's own settings so it follows the notification again; optional store_code. A key left out is inherited. Without store_code the default scope is written, which takes only enabled. A store view named only by its number comes back with a warning as update
set-conditions notification_ref, notification_json: condition_aggregation (all or any) and conditions (the complete list) as update
duplicate notification_ref uuid, notification_id of the copy, named "… Copy" and switched off
remove notification_ref removed. A switched-on notification is refused: switch it off first

Changing a switched-on notification. update, set-content, set-store-settings and set-conditions on a notification that is switched on are refused with 409 CONFIRMATION_REQUIRED (details_json {notification_id, changes}) until you send a confirmation_token. Get it from prepare-update, prepare-set-content, prepare-set-store-settings or prepare-set-conditions with the same body: the answer describes the change (who receives it, what it says, when it is sent) and carries the token. See Confirmations. A switched-off notification is changed at once.

The notification​

The same shape as in the form document. The keys you write:

Key Meaning
name Required. The name in the admin
trigger_code What sends it: submission, approval_changed, status_changed, assignment, reply_to_customer or customer_reply
envelope_policy Recipients: {"sources": [...]}, one entry per recipient source; see the table below
sender_identity The store email identity the message is sent from
contents Per store view: store_id (0 for all store views), subject, preheader, body_html. The body uses merge tags such as {{var field:customer_name}}
condition_aggregation, conditions When it is sent. Each condition has field_code, operator and values; the field must be on the form
content_mode managed (default) for authored content
wrapper_ref The email layout around the body, for example thread
reply_to_policy, attachment_policy, trigger_filter, sort_order, uuid, legacy_template_ref As in the form document

Recipient sources in envelope_policy.sources:

kind role Other keys Sends to
store_email to identity: general, sales, support … One of the store's email addresses
fixed to, cc or bcc addresses: a list Fixed addresses
contact to, cc or bcc field_code The department the visitor picked in a Contact field
field to field_code An address the visitor typed; the store must allow sending to typed addresses
submitter to none The person who filled in the form
payload to key An address the event carries, such as the submitter's or a reply's

notification_id, audience and is_active are read-only: audience (staff or submitter) follows from the recipients, and is_active changes only through activation. add ignores is_active and audience; update refuses is_active with 403. Reading an existing notification from the form document is the quickest way to see a complete one.

Switching a notification on​

  1. POST /V1/webforms/notifications/{notificationId}/activation/prepare with request_id. The answer:

    Member Meaning
    confirmation_token Send it to confirm. It works once, for this integration and this notification
    expires_at When the token stops working, 10 minutes after prepare, in UTC (2026-10-05 20:54:49)
    first_activation true when the notification has never been switched on
    diff_json What switching on changes compared with the last time it was on: recipients (added, removed), audience, envelope, senders per store view, reply_to, attachments, content_mode, wrapper_ref, links, variables, and a content hash

    The token is not stored with the request: sending the same request_id again is answered with REPLAY_UNAVAILABLE. Call prepare again with a new request_id instead.

  2. POST /V1/webforms/notifications/{notificationId}/activation/confirm with request_id and confirmation_token. The answer is true. If the notification changed after prepare, or the token expired, confirm is refused with CONFIRMATION_REQUIRED: prepare again.

    When the answer to confirm is lost, send the identical request again with the same request_id: it returns the stored true. The token itself works once, so the same token with a new request_id is refused with CONFIRMATION_REQUIRED.

POST /V1/webforms/notifications/{notificationId}/deactivate with request_id switches it off and answers true, also when it was already off. It works like Deactivate in the admin: it switches off the default scope in a new revision, and is_active (which means "activated") stays 1, while the form document shows false. A store view with its own Status switched on keeps sending, and the answer doesn't name such store views. Emails already queued before the call are still delivered.

Whether mail actually goes out also depends on the store's delivery settings; see Test and activate.

Authentication​

OAuth 1.0a integration credentials, as described on REST API. The commands route and the three activation routes need forms_edit (Edit and Publish Forms). WebForms checks every notification command again on its side, and an integration holding forms_edit passes that check: no separate notification permission exists. The editor and full presets include forms_edit. An integration without it is refused by Magento with 401 (The consumer isn't authorized to access …), before WebForms sees the request. Each write of content_mode: "advanced" is written to the audit log.

Operations​

Method Path Operation ACL resource
POST /V1/webforms/notifications/{notificationId}/activation/confirm NotificationManagementInterface_confirmActivation MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/notifications/{notificationId}/activation/prepare NotificationManagementInterface_prepareActivation MageMe_WebForms::api_v1_forms_edit
POST /V1/webforms/notifications/{notificationId}/deactivate NotificationManagementInterface_deactivate MageMe_WebForms::api_v1_forms_edit

POST /V1/webforms/forms/{formId}/notifications/commands/{name} is listed with the form operations on REST: Forms.

Errors​

Code HTTP When
VALIDATION_FAILED 400 The notification is not valid (The notification is not valid: …, for example a condition on a field that is not on the form); notification_ref or confirmation_token is missing; an unknown store_code in set-content; remove on a switched-on notification
ACTOR_NOT_ALLOWED 403 is_active sent in update. Without forms_edit Magento refuses the route with 401
NOT_FOUND 404 No such form, notification id or uuid on this form; a form outside the integration's form scope; an unknown command name
CONFIRMATION_INVALID 409 confirm with a token prepared for another notification
CONFIRMATION_REQUIRED 409 confirm with a token that was used, expired, or prepared before the notification changed. Prepare again. Also update, set-content, set-store-settings or set-conditions on a switched-on notification without a token
REPLAY_UNAVAILABLE 409 prepare sent again with the same request_id
LICENSE_NOT_COVERED 403 The store's WebForms license does not cover this version; commands, prepare and confirm are refused, deactivate is not

The refusals every route shares are listed on REST API.

Examples​

One sequence on form 995589. Add a notification for the showroom team:

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

notification.json:

{
"request": {
"request_id": "erp-notify-0001",
"notification_json": "{\"name\":\"Showroom team copy\",\"trigger_code\":\"submission\",\"sender_identity\":\"general\",\"envelope_policy\":{\"sources\":[{\"kind\":\"store_email\",\"role\":\"to\",\"identity\":\"general\"}]},\"content_mode\":\"managed\",\"wrapper_ref\":\"thread\",\"contents\":[{\"store_id\":0,\"subject\":\"Showroom enquiry from {{var field:customer_name}}\",\"preheader\":\"\",\"body_html\":\"<p>A new showroom enquiry arrived.</p>{{var all_fields}}\"}]}"
}
}
{"form_id": 995589, "changed": true, "payload_json": "{\"uuid\":\"85955673-ed8c-4d96-b032-1bbf34089a24\",\"notification_id\":992426}"}

Rename it and send it to the store's Sales contact instead (update):

{"request": {"request_id": "erp-notify-0002", "notification_ref": "85955673-ed8c-4d96-b032-1bbf34089a24", "notification_json": "{\"name\":\"Showroom team\",\"envelope_policy\":{\"sources\":[{\"kind\":\"store_email\",\"role\":\"to\",\"identity\":\"sales\"}]}}"}}
{"form_id": 995589, "changed": true, "payload_json": "{\"uuid\":\"85955673-ed8c-4d96-b032-1bbf34089a24\",\"notification_id\":992426,\"revision_id\":992849}"}

German text for the store view de (set-content):

{"request": {"request_id": "erp-notify-0003", "notification_ref": "85955673-ed8c-4d96-b032-1bbf34089a24", "store_code": "de", "notification_json": "{\"subject\":\"Showroom-Anfrage von {{var field:customer_name}}\",\"preheader\":\"\",\"body_html\":\"<p>Eine neue Showroom-Anfrage.</p>{{var all_fields}}\"}"}}

Send it only for product questions (set-conditions):

{"request": {"request_id": "erp-notify-0004", "notification_ref": "85955673-ed8c-4d96-b032-1bbf34089a24", "notification_json": "{\"condition_aggregation\":\"all\",\"conditions\":[{\"field_code\":\"subject\",\"operator\":\"is\",\"values\":[\"product\"]}]}"}}

A condition on a field the form does not have:

{"message": "The notification is not valid: notification.conditions: Condition 1 refers to a field that is not on the form (budget).", "parameters": {"code": "VALIDATION_FAILED", "details_schema_version": "1", "details_json": "{}"}}

Prepare switching it on:

curl -X POST https://yourdomain.com/rest/all/V1/webforms/notifications/992426/activation/prepare \
-H "Authorization: <signed-header>" -H "Content-Type: application/json" \
-d '{"request": {"request_id": "erp-activate-0001"}}'
{
"confirmation_token": "<token>",
"expires_at": "2026-10-05 20:54:49",
"first_activation": true,
"diff_json": "{\"first_activation\":true,\"recipients\":{\"added\":[{\"role\":\"to\",\"source\":\"store_email\",\"dynamic\":\"the store's Sales contact email\"}],\"removed\":[]},\"audience\":{\"before\":null,\"after\":\"staff\"},\"envelope\":{\"before\":null,\"after\":\"one_shared\"},\"senders\":{\"before\":null,\"after\":{\"1\":{\"name\":\"Northstar Supply\",\"email\":\"service@northstar.example\"},\"…\":\"…\"}},\"variables\":{\"added\":[\"all_fields\",\"field:customer_name\"],\"removed\":[]},\"…\":\"…\"}"
}

Confirm with the token (the answer is true):

{"request": {"request_id": "erp-activate-0002", "confirmation_token": "<token>"}}

The same token once more, with a new request_id:

{"message": "This activation was already used or never existed. Review the notification again.", "parameters": {"code": "CONFIRMATION_REQUIRED", "details_schema_version": "1", "details_json": "{}"}}

Trying to switch it on through update:

{"message": "Activation is a separate operation; \"is_active\" cannot be changed here.", "parameters": {"code": "ACTOR_NOT_ALLOWED", "details_schema_version": "1", "details_json": "{}"}}

Switch it off again:

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

Applies to WebForms 4Last reviewed November 24, 2026