> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# SDK Types: Forms

**Published**: 2026-11-30
**Category**: Types

> **Related services:** **FormsService**: `lynkow.forms.getBySlug()`, `lynkow.forms.submit()`

## `Form`

*Interface*

An active form, as `forms.getBySlug()` returns it. Render `schema.fields`,
wire the submit button from `schema.settings`, and read the verification
policy before submitting.

With a request locale, it also carries `requestedLocale` and `isFallback`
from LocaleResolution: `isFallback` is `true` when the form is served
in another locale of the site.

Extends: `LocaleResolution`

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `description` | `string \| null` | No | Introductory text to show above the fields. `null` when not set. |
| `honeypotEnabled` | `boolean` | Yes | Whether the form rejects a filled honeypot. `forms.submit()` always sends<br>it empty. When you send the request yourself, send `honeypot: ''`. |
| `id` | `string` | No | Form ID (UUID). |
| `isFallback` | `boolean` | Yes | `true` when the record is served in another locale because `requestedLocale` has no translation.<br>Absent when the request carried no locale. Never `true` with `fallback: false`. |
| `locale` | `string` | Yes | Locale of the served translation, e.g. `'fr'`. Equals `requestedLocale`<br>unless `isFallback` is `true`. |
| `name` | `string` | No | Display name, e.g. `'Contact Us'`. At most 255 characters. |
| `recaptchaEnabled` | `boolean` | Yes | Whether submitting needs a reCAPTCHA token, passed as `recaptchaToken` to<br>`forms.submit()`. Site-wide reCAPTCHA, when on, applies instead of this form's. |
| `recaptchaSiteKey` | `string \| null` | Yes | Public reCAPTCHA site key, to render the challenge or mint a v3 token. |
| `recaptchaVersion` | `"v2" \| "v3"` | Yes | reCAPTCHA version of the form. A v3 token needs action `form_submit` and<br>a passing score. |
| `requestedLocale` | `string` | Yes | BCP 47 locale code the request asked for (e.g. `'de'`), as sent in the<br>`locale` request option or the client's configured locale.<br>Absent when the request carried no locale. |
| `schema` | `FormSchema` | No | Fields, pages, settings and conditional rules. See FormSchema. |
| `slug` | `string` | No | Slug, unique per site and locale, e.g. `'contact-us'`. Pass it to<br>`forms.getBySlug()` and `forms.submit()`. |
| `status` | `"active"` | No | Always `'active'`: the storefront serves no other form. |


---

## `FormCondition`

*Interface*

Conditional logic rule applied to a form field.

When the referenced `field` matches the operator/value combination, the
`action` is applied (show, hide, require, or skip to a target page).
Used for dynamic forms where some fields appear conditionally based on
earlier answers.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `action` | `"show" \| "hide" \| "require" \| "skip_to_page"` | No | Effect applied when the condition matches:<br>- `'show'` / `'hide'`: toggle visibility of the target field<br>- `'require'`: mark the target field required<br>- `'skip_to_page'`: jump to the page identified by `targetPage` |
| `field` | `string` | No | The `FormField.id` of the field whose value triggers this condition. |
| `operator` | `"equals" \| "not_equals" \| "contains" \| "not_contains" \| "greater_than" \| "less_than" \| "is_empty" \| "is_not_empty"` | No | Comparison operator applied to the referenced field's current value. |
| `targetPage` | `number` | Yes | Target page index for `skip_to_page` actions.<br>Ignored for other actions. |
| `value` | `unknown` | Yes | Value compared against the referenced field. Type depends on the field<br>type: string for text fields, number for number fields, boolean for<br>checkboxes. `undefined` for `is_empty` / `is_not_empty`. |


---

## `FormField`

*Interface*

One field of a form schema: its input type, label, validation and layout.
Render one input per field, in order.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `conditions` | `FormCondition[]` | Yes | Rules that show, hide or require this field from other fields' values.<br>Form-wide rules are in `FormSchema.conditions`. See FormCondition. |
| `defaultValue` | `string \| number \| boolean` | Yes | Value to pre-fill, typed like the field's submitted value. `undefined` means the field starts empty. |
| `description` | `string` | Yes | Help text to render below the input. At most 500 characters. |
| `id` | `string` | No | Field id, unique within the form, e.g. `'field_1764776796820'`. Submit the<br>field's value under this key in `FormSubmitData`. |
| `label` | `string` | No | Label to render with the input. At most 255 characters. |
| `options` | `FormFieldOption[]` | Yes | Choices for a `select`, `radio` or `checkbox` field. A `checkbox` without<br>options is a single boolean. See FormFieldOption. |
| `phoneOptions` | `FormFieldPhoneOptions` | Yes | Country-code settings of a `tel` field. |
| `placeholder` | `string` | Yes | Placeholder text for the empty input. At most 255 characters. |
| `required` | `boolean` | Yes | Whether the field needs a value. The API refuses an empty required field<br>with a 422. `undefined` means optional. |
| `type` | `FormFieldType` | No | Input type to render. See FormFieldType. |
| `validation` | `FormFieldValidation` | Yes | Validation rules beyond `required`. See FormFieldValidation. |
| `width` | `"full" \| "half" \| "third"` | Yes | Layout width: the full row, half of it or a third. `undefined` means `'full'`. |


---

## `FormFieldOption`

*Interface*

A selectable option for `select`, `radio`, and `checkbox` field types.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `label` | `string` | No | The text to display for this option, e.g. `'United States'`. |
| `value` | `string` | No | The value to submit when the visitor picks this option, e.g. `'US'`. |


---

## `FormFieldPhoneOptions`

*Interface*

Phone field configuration.
Only relevant for fields of type `'tel'`.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `defaultCountryCode` | `string` | No | Default country code (e.g. `'+33'`, `'+1'`). |
| `showCountryCode` | `boolean` | No | Whether the country-code selector is rendered next to the phone input. |


---

## `FormFieldType`

*TypeAlias*

Input type of a form field. Most map to the HTML input type of the same name.
The others:

- `'textarea'`: multi-line text input.
- `'select'` and `'radio'`: one choice among `options`.
- `'checkbox'`: a group over `options`, or a single boolean without them.
- `'file'`: upload the file yourself and submit its reference as a string.
- `'rating'`: a numeric score.
- `'hidden'`: not shown to the visitor, for example a tracking value.

```typescript
type FormFieldType = "text" | "email" | "tel" | "textarea" | "number" | "date" | "datetime" | "time" | "select" | "radio" | "checkbox" | "file" | "rating" | "hidden"
```

---

## `FormFieldValidation`

*Interface*

Validation rules of a form field. The API checks `minLength`, `maxLength`,
`min`, `max` and `pattern` on submission and refuses a failing value with a
422. `accept` and `maxSize` are hints for your upload input.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `accept` | `string` | Yes | Accepted file types for a `file` field, as in the HTML `accept` attribute. The API does not check it. |
| `max` | `number` | Yes | Maximum numeric value, inclusive. |
| `maxLength` | `number` | Yes | Maximum length of a text value, in characters. |
| `maxSize` | `number` | Yes | Maximum file size in bytes for a `file` field. The API does not check it. |
| `message` | `string` | Yes | Always `undefined`: the API never returns a custom error message. |
| `min` | `number` | Yes | Minimum numeric value, inclusive. |
| `minLength` | `number` | Yes | Minimum length of a text value, in characters. |
| `pattern` | `string` | Yes | Regular expression the value must match, without delimiters, e.g. `'^[A-Z]{2}\\d{4}$'`. |


---

## `FormPage`

*Interface*

Page definition for multi-page forms.

Multi-page forms split fields across pages, identified by `fields` (a list
of `FormField.id` values that belong to the page). Single-page forms have
no `pages` entry on the schema.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `description` | `string` | Yes | Page description displayed below the title.<br>`undefined` if not configured. |
| `fields` | `string[]` | No | Ordered list of `FormField.id` values that belong to this page.<br>Each id must reference a field in `FormSchema.fields`. |
| `title` | `string` | Yes | Page title displayed at the top of the page.<br>`undefined` if not configured. |


---

## `FormSchema`

*Interface*

Full schema describing a form's fields, layout, behavior, and conditional logic.

Returned as the `schema` property of Form by `forms.getBySlug()`.
Render `fields` in order to build the form UI dynamically. Use `settings`
to wire the submit button and post-submission behavior. Use `conditions`
for cross-field rules (e.g. show field B when field A equals X).

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `conditions` | `FormCondition[]` | No | Cross-field conditional logic rules. Each rule references a field by id,<br>compares its value, and applies an action (show/hide/require/skip). |
| `fields` | `FormField[]` | No | Ordered array of field definitions that make up the form.<br>Render in order to build the form UI. |
| `pages` | `FormPage[]` | Yes | Page definitions for multi-page forms.<br>`undefined` for single-page forms. |
| `settings` | `FormSchemaSettings` | No | Behavior settings (submit label, success message, redirect, progress bar). |


---

## `FormSchemaSettings`

*Interface*

Behavior settings of a form, under `FormSchema.settings`: submit label,
success message, redirect and progress bar.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `closedMessage` | `string` | Yes | Message the API returns when the form stops accepting submissions, as the<br>error of `forms.submit()`. |
| `redirectUrl` | `string` | Yes | Absolute `http` or `https` URL to send the visitor to after submitting,<br>instead of showing `successMessage`. Check its protocol before navigating. |
| `requireAuth` | `boolean` | Yes | Whether only a signed-in customer can submit. Without a session, `forms.submit()`<br>throws `UNAUTHORIZED` with `apiCode` `CUSTOMER_AUTH_REQUIRED`. |
| `showProgressBar` | `boolean` | Yes | Whether to render a progress bar on a multi-page form. `undefined` means no. |
| `submitLabel` | `string` | Yes | Text for the submit button, e.g. `'Send'`. `undefined` means you choose the label. |
| `successMessage` | `string` | Yes | Message to show after a successful submission. `forms.submit()` returns it,<br>or a default one when `undefined`. |


---

## `FormSettings`

*TypeAlias*

Backwards-compatible alias for FormSchemaSettings.

```typescript
type FormSettings = FormSchemaSettings
```

---

## `FormSubmitData`

*TypeAlias*

The answers `forms.submit()` sends, keyed by `FormField.id` from
`forms.getBySlug()`. Field ids are generated, e.g. `'field_1764776796820'`.

Send a `number` for `number` and `rating` fields, a `boolean` for a single
checkbox, the option `value` for a choice, and a `string` otherwise. A
`checkbox` or `select` field also takes an array of option values, and a
`tel` field a `{ countryCode, number }` object. `null` counts as empty. For a
`file` field, upload the file first and send its reference: a `File` object
would arrive empty. Every `required` field needs a value. Keys the schema
does not declare are dropped.

```typescript
type FormSubmitData = Record<string, string | number | boolean | null | string | number | boolean | null[] | { countryCode: string; number: string | number }>
```