Headless Forms

Field Schema

Each form has a configurable field schema that defines the expected fields, their types, and validation rules. Fields are defined in the dashboard when creating or editing a form.

Field Properties

Property Description
Name The field key in the submitted payload (e.g., email, full_name).
Label Human-readable label shown in the dashboard and notifications.
Type One of the 8 supported field types (see below).
Required Whether the field must be present in the submission.
Options Available choices for select fields.

Supported Field Types

Headless Forms supports 8 field types. Each type comes with automatic validation and type coercion.

Type Use Case
text Names, subjects, general text
email Email addresses
url Website URLs
number Quantities, ratings, prices
boolean Checkboxes, toggles, consent
date Birth dates, deadlines
datetime Appointments, timestamps
select Dropdowns, categories

How Validation Works

When a submission arrives, validation rules are built automatically from the field schema:

  1. The field's type determines what values are accepted (e.g., email fields must be valid email addresses).
  2. Required fields must be present and non-empty. Optional fields can be omitted or null.
  3. For select fields, the value must match one of the allowed options configured in the dashboard.

Boolean Values

Boolean fields accept multiple representations:

  • True: true, "true", "1", "yes", "on"
  • False: false, "false", "0", "no", "off"

Select Fields

When a field's type is select, you must define the allowed options in the dashboard. Submissions with values not in the options list will fail validation with a 422 error.