Import row schema
Overview
A bulk import of submissions reads a JSON Lines file: UTF-8, one JSON object per line, each line one past
submission. The shape of a line is published as a JSON Schema, draft 2020-12, in the WebForms module at
schema/import-row-1.0.json ($id https://mageme.com/schema/webforms/import-row-1.0.json). The REST schema
endpoint doesn't serve it: GET /V1/webforms/schema/import-row answers 404. The import calls themselves are on
REST: Imports; the store owner's side is on
Import submissions.
The checks that decide whether a line is imported run on the server, in
MageMe\WebForms\Model\Import\RowValidator, when the import is finalized. The schema describes the same contract,
with the differences listed under Schema and server.
Row keys
| Key | Required | Type | Rule |
|---|---|---|---|
source_system | Yes | string, 1 to 64 characters | Where the row comes from, for example the extension it was exported from |
source_key | Yes | string, 1 to 128 characters | The row's id in that system. The pair (source_system, source_key) identifies the row within the form: importing it again skips it |
created_at | Yes | string, ISO 8601 | When the submission happened, with an explicit offset: Z or ±HH:MM. Local time without an offset is refused. At most one day ahead of the server's clock |
store_code | Yes | string | The code of a store view of this store, for example default |
submitter_email | No | string, an email address | Fills the sender in the Inbox when the form has no email field of its own |
values | Yes | object | Field code (or field id) of the target form → value. A value is a string, number, boolean, null, or a list of those for fields with several answers |
Every value is checked against the field it lands in:
- The key must be a field of the form. A field answers to its code, and always to its id as well
(
MageMe\WebForms\Model\Import\FieldMap). - Select, Radio, Checkbox and Swatches fields take only the values of their options, unless the field offers "Other".
- Numbers and dates must be readable by the field's type.
- One value is at most 65,536 bytes; the whole line, encoded as JSON, at most 262,144 bytes.
Example
One line of an import file, shown on several lines here:
{
"source_system": "previous-contact-forms",
"source_key": "ah-1041",
"created_at": "2026-03-02T15:20:00Z",
"store_code": "default",
"submitter_email": "victor.dubois@example.com",
"values": {
"your_name": "Victor Dubois",
"email": "victor.dubois@example.com",
"product": "Harbor 3-seater sofa",
"question": "The legs came without the small metal plates shown in step 2. Can you send them?"
}
}
In the file each row is a single line.
Reason codes
A refused line is reported with one or more of these codes (MageMe\WebForms\Model\Import\RowErrors). The import's
status shows how many lines each code refused; see REST: Imports.
| Code | The line |
|---|---|
NOT_AN_OBJECT | Is not a JSON object |
ENCODING_INVALID | Holds text that is not valid UTF-8 |
ROW_TOO_LARGE | Is longer than 262,144 bytes as JSON |
SOURCE_SYSTEM_MISSING, SOURCE_KEY_MISSING | Has no source_system or source_key |
CREATED_AT_MISSING | Has no created_at |
CREATED_AT_NO_ZONE | Gives created_at without Z or an offset |
CREATED_AT_NOT_ISO | Gives a created_at that can't be read as a date |
CREATED_AT_IN_FUTURE | Gives a created_at more than one day ahead |
STORE_CODE_MISSING, STORE_UNKNOWN | Has no store_code, or one this store doesn't have |
SUBMITTER_EMAIL_INVALID | Gives a submitter_email that isn't an email address |
VALUES_MISSING, VALUES_NOT_AN_OBJECT | Has no values, or values is not an object |
FIELD_UNKNOWN | Names a field code or id the form doesn't have |
VALUE_NOT_SCALAR | Gives a value that is an object, or a list holding one |
VALUE_TOO_LONG | Gives a value longer than 65,536 bytes |
VALUE_NOT_PARSABLE | Gives a number or date the field can't read |
VALUE_NOT_AN_OPTION | Gives a value that isn't one of the field's options |
Schema and server
The schema describes one line on its own; the server also knows the form and the store. They differ in three places, and the server decides.
| Case | Schema | Server |
|---|---|---|
| A key besides the six above | Refused (additionalProperties: false) | Ignored |
submitter_email set to "" | Refused (format: email) | Accepted as no address |
A created_at more than one day ahead, a value outside a field's options, a field the form doesn't have | Not described: the schema doesn't know the form or the clock | Refused with its code |
To check a file before uploading it, validate each line with a JSON Schema validator that checks formats (for
example Ajv with ajv-formats), then let the import's finalize step report what the server refuses. On a test store,
the five lines of a sample file validated, and lines with a local time, an extra key, an empty
submitter_email and a nested value were refused by the schema.
What's next
- REST: Imports: upload the file, check it, commit it and read the reason counts.
- Import submissions: what the store owner does before and after an import.
- Form document schema: the field codes a form has.