Validations allow you to enforce cell values of a column to meet specified conditions before the data is submitted. Any validations that fail for a cell will be shown to the user on the Review screen of the import where they’ll be able to edit the cell values.

Validations are defined as an array on a template column:

"validations": [
  {
    "validate": "regex",
    "options": "^[a-zA-Z0-9]*$",
    "message": "Cell can only contain letter or numbers"
  }
]
validate
string
required

The type of validation (see all options).

options
any

If the validation accepts additional options they can be configured here. The schema of options is dependent on the specific validation. For example, the regex validation expects this as a string which is the pattern to match.

message
string

The message to display to the user as a tooltip in the cell on the Review screen if the validation fails. If not provided, a default message will be generated depending on the validation.


Validate Options

Validations can either be allowed for all data types (universal) or only compatible with specific data types.

Universal

not_blank

The cell must contain a non-blank value. Blank is defined as either being empty or containing all unicode whitespace characters (' ', '\n', '\t', '\v', '\f', '\r', U+0085 (NEL), U+00A0 (NBSP)).

{
  "validate": "not_blank"
}

String

list

The cell must equal one of the values in the provided list. Comparisons are case-insensitive but the cell values will be formatted in the case of the list value.

{
  "validate": "list",
  "options": [
    "Small",
    "Medium",
    "Large"
  ]
}
email

The cell must be a valid email address.

{
  "validate": "email"
}
phone

The cell must be a valid phone number.

{
  "validate": "phone"
}
length

The length of the cell must be within the provided min and/or max options.

{
  "validate": "length",
  "options": {
    "min": 4,
    "max": 16
  }
}

Only one min or max option is required:

{
  "validate": "length",
  "options": {
    "min": 0
  }
}
regex

The cell must match the regex pattern provided.

{
  "validate": "regex",
  "options": "^[a-zA-Z0-9]*$"
}

Number

range

The value of the cell must be greater than or equal to the min and less than or equal to the max.

{
  "validate": "range",
  "options": {
    "min": 1900,
    "max": 2030
  }
}

Only one min or max option is required:

{
  "validate": "range",
  "options": {
    "min": 0
  }
}