> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/forms/form-field-validation-types.md).

# FormFieldValidationTypes

## Introduction

`FormFieldValidationTypes` define validation rules that can be attached to [FormFields](/api-reference/forms/form-fields.md).

## Model Definition

**Alias**

`formFieldValidationType`

**Attributes**

| Key              | Type     | Description                                                                                                                                                            |
| ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`             | `string` | Stable validation type ID used by `form_field_validation_type_id`.                                                                                                     |
| `default_config` | `object` | Source-defined starting `config` used when a validation of this type is created without an explicit configuration; required editor placeholders may still need values. |

## Available Form Field Validation Types

The following validation types are available in the current API version. Each entry combines the validation's meaning, complete source-defined default, and accepted configuration keys. The defaults are editor starting points and may contain required placeholders that must be replaced before submission. Dot notation identifies nested values; additional unlisted keys are not part of the public contract.

### `required` <a href="#form-field-validation-type-required" id="form-field-validation-type-required"></a>

**Default Config**

```json
{}
```

Requires a value. This validation accepts no configuration keys.

### `email` <a href="#form-field-validation-type-email" id="form-field-validation-type-email"></a>

**Default Config**

```json
{}
```

Requires a valid email address. This validation accepts no configuration keys.

### `phone` <a href="#form-field-validation-type-phone" id="form-field-validation-type-phone"></a>

**Default Config**

```json
{
  "fixed_line": true,
  "mobile": true,
  "country_codes": null,
  "default_country_code": "DE"
}
```

Requires an E.164-formatted phone number. The flags and country list further restrict the accepted phone-number categories.

**Configuration Keys**

| Key                    | Type              | Requirement | Description                                                     |
| ---------------------- | ----------------- | ----------- | --------------------------------------------------------------- |
| `fixed_line`           | `boolean`         | Optional    | Allow fixed-line numbers.                                       |
| `mobile`               | `boolean`         | Optional    | Allow mobile numbers.                                           |
| `country_codes`        | `array` \| `null` | Optional    | Restrict numbers to supported ISO 3166-1 alpha-2 country codes. |
| `country_codes.*`      | `string`          | Optional    | One supported country code.                                     |
| `default_country_code` | `string`          | Required    | Supported country code used as the default country.             |

### `url` <a href="#form-field-validation-type-url" id="form-field-validation-type-url"></a>

**Default Config**

```json
{}
```

Requires a valid URL. This validation accepts no configuration keys.

### `number` <a href="#form-field-validation-type-number" id="form-field-validation-type-number"></a>

**Default Config**

```json
{
  "type": "numeric"
}
```

Requires a numeric or integer value.

**Configuration Keys**

| Key    | Type     | Requirement | Description                           |
| ------ | -------- | ----------- | ------------------------------------- |
| `type` | `string` | Required    | Numeric rule: `numeric` or `integer`. |

### `digits_only` <a href="#form-field-validation-type-digits-only" id="form-field-validation-type-digits-only"></a>

**Default Config**

```json
{}
```

Allows ASCII digits only. This validation accepts no configuration keys.

### `minmax` <a href="#form-field-validation-type-minmax" id="form-field-validation-type-minmax"></a>

**Default Config**

```json
{
  "min": 0
}
```

Restricts a value or length to a minimum, maximum, or both. At least one of `min` and `max` is required.

**Configuration Keys**

| Key   | Type      | Requirement                    | Description                                                          |
| ----- | --------- | ------------------------------ | -------------------------------------------------------------------- |
| `min` | `integer` | Required when `max` is omitted | Minimum accepted value or length, depending on the field value type. |
| `max` | `integer` | Required when `min` is omitted | Maximum accepted value or length, depending on the field value type. |

### `items-count` <a href="#form-field-validation-type-items-count" id="form-field-validation-type-items-count"></a>

**Default Config**

```json
{
  "min": 0
}
```

Restricts the number of selected items. At least one of `min` and `max` is required.

**Configuration Keys**

| Key   | Type      | Requirement                    | Description                       |
| ----- | --------- | ------------------------------ | --------------------------------- |
| `min` | `integer` | Required when `max` is omitted | Minimum number of selected items. |
| `max` | `integer` | Required when `min` is omitted | Maximum number of selected items. |

### `boolean` <a href="#form-field-validation-type-boolean" id="form-field-validation-type-boolean"></a>

**Default Config**

```json
{}
```

Requires a boolean-compatible value. This validation accepts no configuration keys.

### `datetime` <a href="#form-field-validation-type-datetime" id="form-field-validation-type-datetime"></a>

**Default Config**

```json
{
  "format": "Y-m-d H:i:s"
}
```

Requires a date and time matching a server-side format.

**Configuration Keys**

| Key      | Type     | Requirement | Description                                                   |
| -------- | -------- | ----------- | ------------------------------------------------------------- |
| `format` | `string` | Required    | Server-side date format used to validate the submitted value. |

### `after-before` <a href="#form-field-validation-type-after-before" id="form-field-validation-type-after-before"></a>

**Default Config**

```json
{
  "after": "now"
}
```

Restricts a date to a lower bound, upper bound, or both. At least one of `after` and `before` is required.

**Configuration Keys**

| Key      | Type                  | Requirement                       | Description                                                                                         |
| -------- | --------------------- | --------------------------------- | --------------------------------------------------------------------------------------------------- |
| `after`  | `string` \| `integer` | Required when `before` is omitted | Relative or absolute date, such as `now`, or a Unix timestamp. The submitted value must be later.   |
| `before` | `string` \| `integer` | Required when `after` is omitted  | Relative or absolute date, such as `now`, or a Unix timestamp. The submitted value must be earlier. |

### `file` <a href="#form-field-validation-type-file" id="form-field-validation-type-file"></a>

**Default Config**

```json
{}
```

Requires an uploaded file. This validation accepts no configuration keys.

### `mimetypes` <a href="#form-field-validation-type-mimetypes" id="form-field-validation-type-mimetypes"></a>

**Default Config**

```json
{
  "allowed": [
    "image/gif",
    "image/jpeg",
    "image/png",
    "image/tiff"
  ]
}
```

Restricts an uploaded file to configured MIME types.

**Configuration Keys**

| Key         | Type     | Requirement                | Description                                                                                |
| ----------- | -------- | -------------------------- | ------------------------------------------------------------------------------------------ |
| `allowed`   | `array`  | Required                   | MIME type strings accepted for an uploaded file. An empty array applies no MIME-type rule. |
| `allowed.*` | `string` | Not individually validated | One MIME type consumed by the file validator.                                              |

### `last-modified` <a href="#form-field-validation-type-last-modified" id="form-field-validation-type-last-modified"></a>

**Default Config**

```json
{
  "before": "now"
}
```

Restricts a file's modification date to a lower bound, upper bound, or both. At least one of `after` and `before` is required. Clients evaluate this validation; the backend stores and validates the config but does not apply a server-side file-date rule.

**Configuration Keys**

| Key      | Type                  | Requirement                       | Description                                                                                              |
| -------- | --------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `after`  | `string` \| `integer` | Required when `before` is omitted | Relative or absolute date, such as `now`, or a Unix timestamp. The file must have been modified later.   |
| `before` | `string` \| `integer` | Required when `after` is omitted  | Relative or absolute date, such as `now`, or a Unix timestamp. The file must have been modified earlier. |

### `in` <a href="#form-field-validation-type-in" id="form-field-validation-type-in"></a>

**Default Config**

```json
{
  "values": []
}
```

Allows only configured values. The array must contain at least one item; the source-defined empty default is not a valid submitted config until populated.

**Configuration Keys**

| Key        | Type    | Requirement                | Description         |
| ---------- | ------- | -------------------------- | ------------------- |
| `values`   | `array` | Required                   | Allowed values.     |
| `values.*` | `mixed` | Not individually validated | One compared value. |

### `not-in` <a href="#form-field-validation-type-not-in" id="form-field-validation-type-not-in"></a>

**Default Config**

```json
{
  "values": []
}
```

Rejects configured values. The array must contain at least one item; the source-defined empty default is not a valid submitted config until populated.

**Configuration Keys**

| Key        | Type    | Requirement                | Description         |
| ---------- | ------- | -------------------------- | ------------------- |
| `values`   | `array` | Required                   | Rejected values.    |
| `values.*` | `mixed` | Not individually validated | One compared value. |

### `entity-selection` <a href="#form-field-validation-type-entity-selection" id="form-field-validation-type-entity-selection"></a>

**Default Config**

```json
{
  "multiple": false
}
```

Requires either a single-entity or multiple-entity selection.

**Configuration Keys**

| Key        | Type      | Requirement | Description                                                                     |
| ---------- | --------- | ----------- | ------------------------------------------------------------------------------- |
| `multiple` | `boolean` | Required    | Require a multiple-entity value when `true`; otherwise require a single entity. |

### `regex` <a href="#form-field-validation-type-regex" id="form-field-validation-type-regex"></a>

**Default Config**

```json
{
  "pattern": ""
}
```

Requires a value matching a valid regular expression. The source-defined empty default is not a valid submitted config until populated.

**Configuration Keys**

| Key       | Type     | Requirement | Description                                        |
| --------- | -------- | ----------- | -------------------------------------------------- |
| `pattern` | `string` | Required    | Regular expression applied to the submitted value. |

## List

List available `FormFieldValidationTypes`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/field-validation-types`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/forms/field-validation-types', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": "required",
    "default_config": {},
    "sort_number": 1
  },
  {
    "id": "minmax",
    "default_config": {
      "min": 0
    },
    "sort_number": 7
  }
]
```

## Show

Show one `FormFieldValidationType`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/forms/field-validation-types/{formFieldValidationType}`

**Route Parameters**

| Parameter                 | Type     | Description                                                                                              |
| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `formFieldValidationType` | `string` | Validation type ID from [Available Form Field Validation Types](#available-form-field-validation-types). |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/forms/field-validation-types/required', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": "required",
  "default_config": {},
  "sort_number": 1
}
```
