> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Validation

> Validate whether specific strings are present in or absent from data

The Command Validation command (Command Type: 1) validates whether specific strings are present in or absent from the provided data. It throws an error when the configured condition is not met.

## Overview

The Command Validation command provides functionality for:

* Validating that required strings exist in the data (`include` mode)
* Validating that specific strings are absent from the data (`exclude` mode)
* Combining multiple values with `OR` logic (any match required) or `AND` logic (all matches required)

## Command Type

**Command Type ID:** 1

## Parameters

| Parameter        | Type            | Description                                                                                                                                   | Required |
| ---------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| **values**       | Array of string | An array of strings to check for in the data                                                                                                  | Yes      |
| **matchMode**    | string          | Whether to validate that values are included in or excluded from the data. Possible values: `"include"`, `"exclude"`. Defaults to `"include"` | Yes      |
| **combineLogic** | string          | How multiple values are combined: `"or"` requires any match, `"and"` requires all matches. Defaults to `"or"`                                 | Yes      |

### matchMode Values

| Value       | Description                                                     |
| ----------- | --------------------------------------------------------------- |
| `"include"` | Throws an error if **none** of the values are found in the data |
| `"exclude"` | Throws an error if **any** of the values are found in the data  |

### combineLogic Values

| Value   | Description                                                     |
| ------- | --------------------------------------------------------------- |
| `"or"`  | Condition is met if **any** of the configured values match      |
| `"and"` | Condition is met only if **all** of the configured values match |

## Usage Examples

### Validate String is Present (include / or)

```json theme={null}
{
  "command": "command-validation",
  "params": {
    "values": ["success"],
    "matchMode": "include",
    "combineLogic": "or"
  }
}
```

### Validate All Required Strings Exist (include / and)

```json theme={null}
{
  "command": "command-validation",
  "params": {
    "values": ["eventId", "marketId", "odds"],
    "matchMode": "include",
    "combineLogic": "and"
  }
}
```

### Validate No Error Strings are Present (exclude / or)

```json theme={null}
{
  "command": "command-validation",
  "params": {
    "values": ["error", "unauthorized", "forbidden"],
    "matchMode": "exclude",
    "combineLogic": "or"
  }
}
```

### Validate None of Multiple Strings are Present (exclude / and)

```json theme={null}
{
  "command": "command-validation",
  "params": {
    "values": ["error", "timeout"],
    "matchMode": "exclude",
    "combineLogic": "and"
  }
}
```

## Common Use Cases

* **Response Guard**: Ensure a success indicator is present in an HTTP or WebSocket response before processing
* **Error Detection**: Throw early if an error string is found in the data
* **Completeness Check**: Verify all required field names are present in the raw data
* **Blocklist Check**: Reject data that contains any forbidden string

## Related Commands

* [JSON Parse](/stream/commands/parse/json-parse) - Parse data before validating
* [Http Request](/stream/commands/http/http-request) - Validate HTTP response content
* [Filter](/stream/commands/parse/filter) - Filter data by field values after validation
