GraphQL
Overview
WebForms answers on Magento's GraphQL endpoint, POST https://yourdomain.com/graphql, with two queries and four mutations. They are meant for headless and PWA storefronts: load a form, ask which fields its logic shows, upload files, submit, and show a customer their own submissions.
Send the Store header with a store view code to work in that store view: the form, its fields and their settings are read as that store view has them, and a submission is recorded there.
For an admin or integration token, webformsResults returns personal answers in full only when the role holds Disclose Personal Data, and writes a Personal Data Read entry to the audit log. Without it, each personal answer is replaced by the same stand-in the Management API sends (see Personal data masking) and the field carries masked: true. The submission's customer_ip reads [redacted] and customer_id is null; in submitted_from_serialized the page addresses keep only their origin and the page title reads [redacted]. Empty values stay empty. The value of a password field is never returned. A customer reading their own submissions gets the plain values.
Authentication
What a request may do depends on who sends it:
| Caller | How | What applies |
|---|---|---|
| Visitor | No Authorization header | The form must be switched on in the store view; a form limited to customer groups refuses visitors. No submissions can be read |
| Customer | Authorization: Bearer <customer token> | As a visitor, plus the customer's group must be allowed on a limited form. webformsResults returns only the customer's own submissions, and only when the form shows submissions in My Account to the customer's group with the View permission |
| Admin | Authorization: Bearer <admin token> | The admin role needs Manage Forms and access to the form (All Forms or the form itself). Reading a form needs View Forms and Schema, reading submissions View Submissions (Masked), submit and upload need Submit Forms and Upload Files (WebForms → API). A form the role cannot reach answers like a form that does not exist |
Two things that do not work as a caller identity:
- A request signed with an integration's OAuth credentials is handled as a visitor's:
webformsResultsbyform_idanswersThe current customer isn't authorized. - An integration's access token sent as a bearer token is refused with
401, unless the store allows OAuth access tokens as standalone bearer tokens (Allow OAuth Access Tokens to be used as standalone Bearer tokens in Stores → Configuration → Services → OAuth → Consumer Settings, off by default). GraphQL reads only a bearer token; it does not read the OAuth signature of an integration.
Operations
| Operation | Kind | Arguments | Returns |
|---|---|---|---|
webformsForm | query | form_id: Int! | WebformsForm: the live form with its groups of fields |
webformsResults | query | filter: {result_id: Int} or filter: {form_id: Int}; pageSize: Int, currentPage: Int | WebformsResults: items, a list of WebformsResult |
webformsLogicVisibility | mutation | form_id: Int!, formData: String! | WebFormsGetLogicVisibilityOutput: which groups and fields the form's logic shows for these answers |
webformsSubmitForm | mutation | form_id: Int!, formData: String!, captchaToken: String | WebformsFormOutput: success, errors, result, confirmation |
webformsUpload | mutation | field_id: Int!, filename: String!, content: String!, mimeType: String, captchaToken: String | String: the upload's hash |
webformsRecaptcha | mutation | form_id: Int; the reCAPTCHA response in the X-Recaptcha header | String: a CAPTCHA token, or Captcha Verified |
The schema is open to introspection; type and field names below are as it reports them.
Loading a form
webformsForm returns the form's settings (form_id, name, code, description, success_text, submit_button_text, is_active, is_survey, files_upload_limit, images_upload_limit, url_key, meta_title, meta_description, meta_keywords, below_text, redirect_url, is_url_parameters_accepted) and fieldsets. Each group has fieldset_id, is_below_sections, name, logic_visibility and fields; each field has field_id, code, type, name, is_required, position, logic_visibility, validation settings, layout settings, options and more. Type-specific settings come in type_attributes_serialized, a JSON string.
A field of the Terms type also carries terms: checkbox_label and text (HTML) to show exactly as given, because an acceptance records this wording; revision; token; and is_available (false when the wording is missing, and then token is null). Other fields have terms: null. A Contact field gives guests and customers the contact's name and the value the form sends, never the address behind it, in webformsForm, webformsResults and webformsLogicVisibility; only an admin token sees the address.
Fields outside any section are in a group with fieldset_id: 0 and no name. Fields shown below all sections, such as the submit button, come last in a group without a name, with fieldset_id: null and is_below_sections: true.
Checking the logic
webformsLogicVisibility takes formData, a JSON string holding the visitor's current answers as a field object keyed by field id: {"field": {"99193224": "Oak tables"}}. Numbers and booleans are read as the strings a form post would carry. The answer lists every group and field with logic_visibility set to visible or hidden for those answers.
Submitting
webformsSubmitForm takes formData, a JSON string with the same field object as above. For a file field, send the hash returned by webformsUpload. For a ticked Terms field, also send its terms.token in formData under terms_token, keyed by the field id, in the same store view.
submissionToken is a random token the client makes for one filled-in form and sends with every attempt to submit it (16 to 64 letters, digits or hyphens). A repeat with the same token and values is answered with the submission already stored, and no email goes out again. Make a new token after a successful submission. The mutation reads the answers only from formData: a result_id, or a token in the query string, is not read. Through /graphql a customer is known only by a customer bearer token; a remembered session without one counts as a visitor.
| Member | Meaning |
|---|---|
success | Whether the submission was saved |
errors | A JSON string: "[]" on success, otherwise a list of messages meant for the visitor |
result | Id of the saved submission, as a string; empty when nothing was saved |
confirmation | What to show next: type (message, redirect or page), message with the submission's values filled in, redirect_url (absolute) and is_message_shown (whether the message is meant to be shown after the redirect) |
Required fields, validation rules and unique values are checked as on the storefront; those problems come back in errors, not as GraphQL errors. An invalid captcha token also comes back in errors. The form's CAPTCHA is checked as on the storefront.
Uploading a file
webformsUpload uploads one file for a file field of a form the caller may submit. content is the file as a data URI (data:application/pdf;base64,...); mimeType can then be left out. Text without the data: prefix is not decoded: it is stored as the file's content as it is, and mimeType is required. The file is checked against the field's settings in the store view; a refusal answers with its reason. The returned hash goes into formData of the submit. A visitor must send the same submissionToken as the submit that follows: the upload counts only for a submission sent with that token, and a file hash uploaded for another token stops the submit. A customer or an admin may leave it out.
Reading submissions
webformsResults takes filter with exactly one of result_id or form_id. A visitor, or a customer asking by result_id for a submission that isn't theirs, gets Unable to find result with ID "…", the same answer as for an id that doesn't exist. With form_id, one page comes back, oldest first: 20 submissions without pageSize, at most 100 (currentPage from 1). The answer carries total_count (matches over every page) and page_info (page size, current page, number of pages).
Each WebformsResult has result_id, form_id, store_id, customer_id, approved, created_at, updated_at, submitted_from_serialized, referrer_page (the address of the page the visitor came from before the form), custom_status (id, code, label, color, changed_at, or null) and fields. Each field value has field_id, code, value and other_text (the visitor's text of an Other answer, or of a Product answer not in the catalog; null when there is none or it is masked); answers to fields deleted from the form also carry archived: true, label and display. In a Dynamic Grid answer, a Product cell of __other__ names a product not in the catalog, and the text sits under <column code>:other_text in the same row.
CAPTCHA
A form that asks for reCAPTCHA needs a solved challenge before the submit. Render the reCAPTCHA widget in your storefront with the form's site key, then send the response token to webformsRecaptcha in the X-Recaptcha header, with the form's id:
curl https://yourdomain.com/graphql \
-H "Content-Type: application/json" \
-H "X-Recaptcha: <response token from the widget>" \
-c cookies.txt -b cookies.txt \
-d '{"query": "mutation { webformsRecaptcha(form_id: 995656) }"}'
-c and -b keep the session cookie, so that the submit that follows (sent with the same cookie file) belongs to the same session.
The verification counts only for that form. Calling webformsRecaptcha without form_id is deprecated: it checks the store-wide reCAPTCHA keys and counts for any form. A form that does not use reCAPTCHA refuses the call with This form does not use reCAPTCHA.
What the mutation returns depends on Use JWT Tokens in Stores → Configuration → MageMe Extensions → WebForms → Integrations → GraphQL:
| Use JWT Tokens | Answer | What the client does next |
|---|---|---|
| No (default) | Captcha Verified | Nothing: the verification is kept in the visitor's session for one successful submission of that form (uploads before it do not use it up). Send the requests with the same session cookie; solve the CAPTCHA again for the next submission |
| Yes | A token | Send it as captchaToken with webformsSubmitForm and webformsUpload of the same form |
A token is good for one hour, and only for the form it was issued for (for any form when it was issued without form_id). The store keeps a record of each token it issued and accepts only those; a successful submit deletes the token, while uploads do not use it up, up to a limit set by the form's file fields. Tokens older than an hour are removed every 30 minutes.
Tokens are signed with the JWT Secret Key set next to Use JWT Tokens. When it is empty, WebForms signs with a built-in key that is the same in every installation, although the field's hint says "Leave empty to use default". Before you switch Use JWT Tokens on, enter a long random value of your own in JWT Secret Key, for example the output of openssl rand -base64 48.
Limits
- Visitor uploads and reCAPTCHA.
webformsUploadfrom a visitor or a customer asks for a solved CAPTCHA only when the form asks for one in the store view of the request, the same rule as its submit; a form with the CAPTCHA off takes files without one. On a form that uses reCAPTCHA, the upload is accepted only after a CAPTCHA verification (acaptchaToken, or a verification kept in the session); otherwise it answersPlease validate the reCAPTCHA first.. Without the CAPTCHA the same limits and checks apply as on the storefront. - A CAPTCHA without keys. When the form asks for a CAPTCHA in the store view of the request and the store has no keys for the CAPTCHA provider,
webformsUploadandwebformsSubmitFormare refused withCaptcha is not set up on this store. Please contact the store owner., with acaptchaTokenor without one. The upload answers it as agraphql-authorizationerror; the submit returnssuccess: falsewith the message inerrors, stores nothing and leaves the token unspent. Add the keys, or switch the form's CAPTCHA off. - Personal answers: masked for staff tokens without Disclose Personal Data; see Overview.
Errors
Refusals are GraphQL errors with a category in extensions.category:
| Category | When |
|---|---|
graphql-no-such-entity | No live form or submission with this id, or one the admin role cannot reach (Unable to find form with ID …) |
graphql-authorization | The form is switched off (Web-form is not active.), the customer group may not use it, a visitor asks for a form's submissions by form_id (The current customer isn't authorized.), an upload to a form that uses CAPTCHA without a verification, or with an invalid captcha token, or to a form whose CAPTCHA has no keys on the store (Captcha is not set up on this store. Please contact the store owner.), or an admin role without the needed permission |
graphql-input | A missing or invalid argument, formData that is not JSON, an upload the field or the file is refused for (the answer names the reason, for example Dropzone disabled on this field. or the file type the field does not take), or, on webformsRecaptcha, a reCAPTCHA response that is missing or wrong |
A submit that fails validation is not a GraphQL error: it returns success: false with the messages in errors.
Examples
Load a form:
{
webformsForm(form_id: 995656) {
form_id name submit_button_text success_text
fieldsets { name fields { field_id code type name is_required logic_visibility } }
}
}
{"data": {"webformsForm": {"form_id": 995656, "name": "Showroom Visit Request", "submit_button_text": "Submit", "success_text": "Thank you! Your submission has been received.",
"fieldsets": [
{"name": null, "fields": [
{"field_id": 99193222, "code": "visitor_name", "type": "text", "name": "Your name", "is_required": true, "logic_visibility": "visible"},
{"field_id": 99193223, "code": "email", "type": "email", "name": "Email", "is_required": true, "logic_visibility": "visible"},
{"field_id": 99193224, "code": "message", "type": "textarea", "name": "What would you like to see?", "is_required": false, "logic_visibility": "visible"},
{"field_id": 99193225, "code": "floor_plan", "type": "file", "name": "Floor plan", "is_required": false, "logic_visibility": "visible"}]},
{"name": "", "fields": [{"field_id": 99193226, "code": "submit", "type": "submit", "name": "Submit", "is_required": false, "logic_visibility": "visible"}]}]}}}
Submit as a visitor. The request body carries the mutation in query and the answers, as a JSON string, in variables:
curl https://yourdomain.com/graphql \
-H "Content-Type: application/json" \
-H "Store: default" \
-d '{"query": "mutation Submit($data: String!) { webformsSubmitForm(form_id: 995656, formData: $data) { success errors result confirmation { type message redirect_url is_message_shown } } }",
"variables": {"data": "{\"field\":{\"99193222\":\"Tomas Berg\",\"99193223\":\"tomas.berg@example.net\",\"99193224\":\"Corner sofas for a small living room.\"}}"}}'
{"data": {"webformsSubmitForm": {"success": true, "errors": "[]", "result": "1136015",
"confirmation": {"type": "message", "message": "Thank you! Your submission has been received.", "redirect_url": null, "is_message_shown": false}}}}
With the name and email missing:
{"data": {"webformsSubmitForm": {"success": false, "errors": "[\"Your name is required\",\"Email is required\"]", "result": "", "confirmation": null}}}
Read a submission with an admin token:
{ webformsResults(filter: {result_id: 1136015}) { items { result_id form_id created_at custom_status { code label } fields { code value } } } }
{"data": {"webformsResults": {"items": [{"result_id": 1136015, "form_id": 995656, "created_at": "2026-10-05 21:10:45", "custom_status": null,
"fields": [{"code": "visitor_name", "value": "Tomas Berg"}, {"code": "email", "value": "tomas.berg@example.net"}, {"code": "message", "value": "Corner sofas for a small living room."}, {"code": "floor_plan", "value": ""}, {"code": "submit", "value": null}]}]}}}