---
title: "Action validate"
description: "Validates user input or constants by type or regex pattern."
---

# Action `validate`

> **System ID:** `action_validate`

## Description

Validates user text or constant values by type (`email`, `phone`, `number`, `text`, etc.) or by a custom regex (`pattern`). You can check several fields in one call — the config is an array of rules. Success only if all checks pass.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | All checks passed |
| **error** | At least one check failed, no parameters, or no value to validate |

## Parameters

The config is an **array** of objects (or a single object that the system converts to an array). Fields of each rule:

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `constant` | string | no | `null` | Constant name to validate; if omitted — the user's message text is validated |
| `type` | string | no* | `null` | Validation type: `email`, `phone`, `number`, `text`, etc. |
| `pattern` | string | no* | `null` | Custom regex; if set together with `type` — takes priority |

\* At least one of `type` or `pattern` is required.

## Configuration example

```json
[
  {
    "type": "email"
  },
  {
    "constant": "user_phone",
    "type": "phone"
  },
  {
    "constant": "order_code",
    "pattern": "^[A-Z0-9]{6}$"
  }
]
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
