> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/commands/processors.md).

# processors

Convert raw CSV, XML, and EDI text into JSON records and back again, render a Handlebars template, or run records through filter rules, without touching account state. Processors are parsers, generators, and evaluators: stateless calls where you send data plus a rule set or template, and the platform returns the result. `list`, `parse`, `generate`, `render`, and `filter` create and change nothing, so they work from a `read`-mode profile. `invoke` reaches any processor in the catalog, including `javascript`, whose hook's integrator-api calls write for real, so since celigo-cli 2026.10.2 it needs `operate` mode.

Use `parse edi` to validate a file definition before you build anything on it. Run a real partner file against the definition, and add `--edi-profile-id` to check the envelope against the partner's EDI profile too. A file that breaks the EDI standard, the definition's rules, or the profile fails the call with a `422` that names the segment, element, and value. A call that succeeds can still carry per-record failures in `recordLevelErrors`. That check costs one call and catches spec problems before an export, import, or flow depends on them.

Use `render` and `filter` the same way for a step's Handlebars template or filter rules: check them against sample data before you save them on the step.

**REST API**: [Parsers & Generators](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators)

```
celigo processors <subcommand> [args] [flags]
```

Supports all [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

***

## Subcommands

| Subcommand                          | Purpose                                                                                                                                        |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `list`                              | List the processor catalog — each processor's name with its input and output media types.                                                      |
| `invoke <name>`                     | Call any catalog processor by name with a full JSON request body (`--file <path>` or stdin). Needs `operate` mode.                             |
| `parse <csv\|edi\|xml> [dataFile]`  | Parse raw data into JSON records. Reads the file at `[dataFile]`, or stdin.                                                                    |
| `generate <csv\|edi> [recordsFile]` | Generate formatted text from a JSON array of records. Reads `[recordsFile]`, or stdin.                                                         |
| `render [dataFile]`                 | Render a Handlebars template against a JSON object. Reads `[dataFile]`, or stdin. Added in celigo-cli 2026.10.2.                               |
| `filter [recordsFile]`              | Run a JSON array of records through filter rules and print the ones that pass. Reads `[recordsFile]`, or stdin. Added in celigo-cli 2026.10.2. |

***

## `celigo processors list`

List the processor catalog. The API returns an object keyed by processor name. The CLI flattens it into a sorted array of rows, so `--format table` and `--jq` behave as they do on every other list command. Default table columns: `name`, `label`, `dataMediaType`, `resultMediaType`.

Use `list` to discover valid `invoke <name>` values.

**Signature**

```bash
celigo processors list
```

**Arguments**

None.

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo processors list --format table
```

**Corresponds to**: [`GET /v1/processors`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators)

***

## `celigo processors invoke`

Call any processor in the catalog by name, supplying the complete JSON request body yourself. Use `invoke` for processors that `parse`, `generate`, `render`, and `filter` do not wrap, or when you need exact control over `rules` and `options`.

The CLI passes `<name>` into the endpoint path verbatim and does not validate it against a fixed list, so any name from `processors list` works. The known names are the parsers and generators — `csvParser`, `csvDataGenerator`, `structuredFileParser`, `structuredFileGenerator`, and `xmlParser` — and `handlebars`, `filter`, `branchFilter`, `mapper`, `transform`, `transformTwoDotZero`, and `javascript`, matching what `processors list` returns.

Since celigo-cli 2026.10.2, `invoke` needs `operate` mode, whatever the name: the catalog's `javascript` processor runs a hook whose integrator-api calls act for real — lookup-cache and state writes, and a virtual export's request. A `read`-mode profile refuses the command before any request. In `read` mode, run the parsers and generators through `parse` and `generate`, a template through `render`, and filter rules through `filter`.

Since celigo-cli 2026.10.1, a blank `<name>`, or one holding a character that would change the request path (`/`, `?`, `#`, `\`, a tab or a line break), is refused before any request, and the body must be a JSON object (`The body must be a JSON object.` otherwise).

**Signature**

```bash
celigo processors invoke <name> --file <path>
celigo processors invoke <name> < body.json     # or pipe on stdin
```

**Arguments**

| Argument | Type   | Required | Description                                                                       |
| -------- | ------ | -------- | --------------------------------------------------------------------------------- |
| `<name>` | string | Yes      | Processor name from `processors list` (e.g. `csvParser`, `structuredFileParser`). |

**Flags**

| Flag                | Type   | Default | Description                                                                    |
| ------------------- | ------ | ------- | ------------------------------------------------------------------------------ |
| `-f, --file <path>` | string | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). |

**Request body**

A JSON object matching the processor's own request schema. Parsers take the raw text in `data` and the rule set in `rules`; generators take an array of records in `data`. An optional `options` object carries extras such as `includeEmptyValues` or an `ediProfile` envelope block. The `handlebars` and `filter` evaluators take the bodies that [`render`](#celigo-processors-render) and [`filter`](#celigo-processors-filter) send.

```json
{
  "data": "a,b\n1,2",
  "rules": { "columnDelimiter": ",", "hasHeaderRow": true }
}
```

**Example**

```bash
echo '{"data":"a,b\n1,2","rules":{"columnDelimiter":",","hasHeaderRow":true}}' \
  | celigo processors invoke csvParser
```

**Corresponds to**: [`POST /v1/processors/{name}`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators)

***

## `celigo processors parse`

Parse raw data into JSON records. The first positional argument is the format — `csv`, `edi`, or `xml` — and it selects which processor endpoint the CLI calls. The raw input comes from the `[dataFile]` path, or from stdin when you omit the path or pass `-`.

The CLI sends the input text unaltered and never trims it. Row delimiters and segment terminators carry meaning in EDI and fixed-width data. Since celigo-cli 2026.10.1 an empty data file is refused before any request (`No input received: the file '<path>' is empty.`), as empty stdin already was.

Since celigo-cli 2026.11.2, the input is read in its encoding: UTF-8, with or without a byte-order mark, or UTF-16 by its byte-order mark, which is what `>` and `Out-File` write in Windows PowerShell 5.1. The byte-order mark is not sent, so it is no longer part of a CSV's first header. Input in any other encoding is refused before any request. The error names the first line that is not UTF-8, or says that the input holds NUL bytes (UTF-16 without a byte-order mark, or not a text file):

```
The file 'orders.csv' cannot be read as text: line 2 holds bytes that are not UTF-8 — a file saved in another encoding, such as Windows-1252. Reopen it in the encoding it was saved in and save it as UTF-8 — a tool that opens it as UTF-8 and saves it again writes U+FFFD for each such byte, valid UTF-8.
```

`edi` covers everything the structured-file parser handles: X12, EDIFACT, custom delimited, and fixed-width. Use it to validate a partner file against a spec. A file that breaks the EDI standard, the definition's rules, or the `--edi-profile-id` profile fails the call with a `422` that names the segment, element, and value, and the command exits `1`; the violation is not an entry in `recordLevelErrors`. A `200` can still carry `recordLevelErrors`, so check them too. Without `--edi-profile-id`, the envelope isn't checked against a profile.

Since celigo-cli 2026.11.2, a blank `--edi-profile-id` or `--rules` (an unset shell variable) is refused before any request. A blank `--edi-profile-id` used to parse without a profile, and a blank `--rules` used to be read as the flag left out.

**Signature**

```bash
celigo processors parse <csv|edi|xml> [dataFile] [flags]
celigo processors parse <csv|edi|xml> < data.txt        # or pipe on stdin
```

**Arguments**

| Argument     | Type                    | Required | Description                                                              |
| ------------ | ----------------------- | -------- | ------------------------------------------------------------------------ |
| `<format>`   | `csv` \| `edi` \| `xml` | Yes      | Input format to parse into JSON records. Selects the processor endpoint. |
| `[dataFile]` | string                  | No       | Path to the raw input file. Omit it, or pass `-`, to read stdin.         |

**Flags**

Each flag applies to specific formats only, named in bold at the start of its description. Passing a flag that does not apply to the chosen format is an error, not a no-op. See the gotchas below.

| Flag                        | Type    | Default | Description                                                                                                                                                                                                                                                                          |
| --------------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--rules <path>`            | string  | —       | **csv, xml** — full parsing-rules JSON file. Sent as `rules` verbatim, replacing the convenience flags below. Since celigo-cli 2026.10.1, naming one of those flags beside `--rules` is refused.                                                                                     |
| `--file-definition-id <id>` | string  | —       | **edi** — parse using a saved [file definition](https://developer.celigo.com/cli/commands/file-definitions.md) by ID. Sent as `rules._fileDefinitionId`.                                                                                                                             |
| `--file-definition <path>`  | string  | —       | **edi** — parse using an inline file definition JSON file. Sent as `rules.fileDefinition`.                                                                                                                                                                                           |
| `--resource-path <path>`    | string  | —       | **edi, xml** — for `xml`, the XPath to the repeating element (e.g. `/root/item`); for `edi`, a dot path selecting the segment to return. Sent as `rules.resourcePath`.                                                                                                               |
| `--edi-profile-id <id>`     | string  | —       | **edi** — the CLI fetches that [EDI profile](https://developer.celigo.com/cli/commands/edi-profiles.md) resource and sends it as `options.ediProfile` for ISA/GS envelope context, and the envelope is checked against it. Without it, the envelope isn't checked against a profile. |
| `--column-delimiter <char>` | string  | —       | **csv** — column delimiter. Since celigo-cli 2026.10.1, `\t`, `\r` and `\n` mean the character they spell: typed in a shell, `'\t'` is a backslash and a `t`, which earlier releases sent as is.                                                                                     |
| `--row-delimiter <char>`    | string  | —       | **csv** — row delimiter. Since celigo-cli 2026.10.1, `\r\n`, `\n` and `\t` mean the characters they spell.                                                                                                                                                                           |
| `--has-header-row`          | boolean | —       | **csv** — treat the first row as column headers. This is the platform's default: a header row is assumed unless `--no-has-header-row`.                                                                                                                                               |
| `--no-has-header-row`       | boolean | —       | **csv** — the first row is data: records are keyed `Column0`, `Column1`, …. Sent as `rules.hasHeaderRow: false`. Added in celigo-cli 2026.10.1.                                                                                                                                      |
| `--trim-spaces`             | boolean | —       | **csv** — trim leading and trailing spaces from values. This is the platform's default unless `--no-trim-spaces`.                                                                                                                                                                    |
| `--no-trim-spaces`          | boolean | —       | **csv** — keep leading and trailing spaces in values. Sent as `rules.trimSpaces: false`. Added in celigo-cli 2026.10.1.                                                                                                                                                              |
| `--rows-to-skip <n>`        | integer | —       | **csv** — number of rows to skip before parsing. Since celigo-cli 2026.10.1, a value that is not a whole number, 0 or more, is refused: `--rows-to-skip must be a whole number of rows, 0 or more (got '2.5').`                                                                      |
| `--include-empty-values`    | boolean | `false` | **csv** — return empty values as `null` instead of omitting the key. Sent as `options.includeEmptyValues`, not inside `rules`.                                                                                                                                                       |

Rule requirements differ by format. `csv` needs no rule flags: every rules field is optional, so `parse csv ./data.csv` parses with server defaults — the first row as column headers, and values trimmed of spaces. Before celigo-cli 2026.10.1 there was no way to ask for the opposite: `--has-header-row` and `--trim-spaces` sent what the platform does anyway, and a file without a header row lost its first row to the column names. Pass `--no-has-header-row` for such a file. `xml` requires either `--resource-path` or `--rules`. `edi` requires exactly one of `--file-definition-id` or `--file-definition`. Passing both, or neither, fails before any request is sent.

**Request body**

The CLI assembles the body: the raw input goes in `data` and the resolved rule set in `rules`. For `edi`, the definition is wrapped inside `rules`, as either `rules._fileDefinitionId` or `rules.fileDefinition`:

```json
{
  "data": "ISA*00*...~\nGS*PO*...~\nST*850*0001~\n...",
  "rules": { "_fileDefinitionId": "5f83a9b2c7d3e8f1a2b3c4d5" }
}
```

**Examples**

```bash
# CSV from a file, first row is headers
celigo processors parse csv ./orders.csv --column-delimiter , --has-header-row

# Tab-separated, no header row: records are keyed Column0, Column1, …
celigo processors parse csv ./orders.tsv --column-delimiter '\t' --no-has-header-row

# XML from stdin, one record per <item>
cat ./catalog.xml | celigo processors parse xml --resource-path /catalog/item

# Validate a real partner file against a saved X12 definition and the partner's EDI profile
# before building the flow: a violation fails with a 422 naming the segment, element, and
# value; a 200 can still carry recordLevelErrors
celigo processors parse edi ./po_850.edi \
  --file-definition-id 5f83a9b2c7d3e8f1a2b3c4d5 \
  --edi-profile-id 60a1b2c3d4e5f6a7b8c9d0e1 \
  --jq '.recordLevelErrors'

# Same check with a definition you haven't saved to the account yet
celigo processors parse edi ./po_850.edi --file-definition ./x12-850.json
```

**Corresponds to**: [`POST /v1/processors/csvParser`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators) for `csv`, [`POST /v1/processors/xmlParser`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators) for `xml`, and [`POST /v1/processors/structuredFileParser`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators) for `edi`. `--edi-profile-id` first issues an internal `GET /v1/ediprofiles/{_id}` to fetch the profile it embeds.

***

## `celigo processors generate`

Generate formatted output from JSON records — the reverse of `parse`. The first positional argument is the format, either `csv` or `edi`. The input is a JSON array read from `[recordsFile]` or stdin, and each element of the array is one document to generate. The CLI rejects a non-array input before any request is made.

The generated text arrives inside a JSON response. Pipe it through `--jq .data` to write the raw file.

**Signature**

```bash
celigo processors generate <csv|edi> [recordsFile] [flags]
celigo processors generate <csv|edi> < records.json     # or pipe on stdin
```

**Arguments**

| Argument        | Type           | Required | Description                                                           |
| --------------- | -------------- | -------- | --------------------------------------------------------------------- |
| `<format>`      | `csv` \| `edi` | Yes      | Output format to generate. Selects the processor endpoint.            |
| `[recordsFile]` | string         | No       | Path to a JSON array of records. Omit it, or pass `-`, to read stdin. |

**Flags**

| Flag                        | Type    | Default | Description                                                                                                                                                                                    |
| --------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--rules <path>`            | string  | —       | **csv** — full generation-rules JSON file. Sent as `rules` verbatim, replacing the convenience flags below. Since celigo-cli 2026.10.1, naming one of those flags beside `--rules` is refused. |
| `--file-definition <path>`  | string  | —       | **edi** — required. The generation rules JSON, sent **directly** as `rules` with no wrapper.                                                                                                   |
| `--edi-profile-id <id>`     | string  | —       | **edi** — the CLI fetches that [EDI profile](https://developer.celigo.com/cli/commands/edi-profiles.md) resource and sends it as `options.ediProfile` for ISA/GS envelope context.             |
| `--column-delimiter <char>` | string  | —       | **csv** — column delimiter. Since celigo-cli 2026.10.1, `\t`, `\r` and `\n` mean the character they spell.                                                                                     |
| `--row-delimiter <char>`    | string  | —       | **csv** — row delimiter. Since celigo-cli 2026.10.1, `\r\n`, `\n` and `\t` mean the characters they spell.                                                                                     |
| `--include-header`          | boolean | `false` | **csv** — emit a leading header row of column names.                                                                                                                                           |
| `--wrap-with-quotes`        | boolean | `false` | **csv** — wrap every value in double quotes.                                                                                                                                                   |

`generate` has no `--file-definition-id` and no `--resource-path`. EDI generation accepts an inline definition only.

Since celigo-cli 2026.11.2, a blank `--edi-profile-id` or `--rules` (an unset shell variable) is refused before any request. A blank `--edi-profile-id` used to generate without the profile, and a blank `--rules` used to be read as the flag left out.

**Request body**

The records array goes in `data` and the resolved rule set in `rules`. For `csv`, `rules` holds the delimiter and header settings. For `edi`, the file definition document is the `rules` object itself. There is no `fileDefinition` key, so the definition's own `format`, delimiter block, and nested `rules` array all sit one level up:

```json
{
  "data": [{ "orderId": "4500012345", "sku": "WIDGET-01", "qty": 10 }],
  "rules": {
    "format": "delimited",
    "delimited": { "rowDelimiter": "\n", "colDelimiter": "*" },
    "rules": []
  }
}
```

**Examples**

```bash
# CSV with a header row, written to a file
echo '[{"orderId":"4500012345","sku":"WIDGET-01","qty":10}]' \
  | celigo processors generate csv --include-header --jq .data > orders.csv

# X12 850 from records, enveloped with a saved partner profile
celigo processors generate edi ./records.json \
  --file-definition ./x12-850-generate.json \
  --edi-profile-id 60a1b2c3d4e5f6a7b8c9d0e1 \
  --jq .data > po_850.edi
```

**Corresponds to**: [`POST /v1/processors/csvDataGenerator`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators) for `csv` and [`POST /v1/processors/structuredFileGenerator`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators) for `edi`. `--edi-profile-id` first issues an internal `GET /v1/ediprofiles/{_id}` to fetch the profile it embeds.

***

## `celigo processors render`

Render a Handlebars template against a JSON object, as a step would render it, and print the result. The object is the template's root context, so send the record as the step's template sees it. Added in celigo-cli 2026.10.2.

* HTTP request URIs, headers, and bodies, mappings, filters, and SQL queries read `{{record.<field>}}`: put the record under `record` (a grouped record's rows under `rows`).
* A NetSuite lookup's criteria (`searchValue`) and a NetSuite import's lookup expressions read the record as the root, `{{<field>}}`: send the record itself.

A path the object lacks renders empty here, with no error, as it does in an HTTP body or a mapping. In an HTTP URI or header, NetSuite lookup criteria, and SQL queries, the same path fails the record. `--strict` fails the render on a missing path instead, with a `422`, as those steps do. Added in celigo-cli 2026.11.2.

Double braces HTML-escape a value, and triple braces insert it unchanged. An unknown helper is refused with a `422`. The platform evaluates the template as a preview, so `render` creates and changes nothing and works in `read` mode.

`{{lookup '<name>' <key>}}` renders a placeholder, unless `--import` names a saved HTTP import. The import's static lookups, the ones with a `map`, are then resolved for the import field that `--field-path` names: `http.body` by default, and `http.relativeURI` URI-encodes double-brace values. A template that also calls a dynamic lookup renders every lookup as a placeholder. No lookup is ever run. `--import` and `--field-path` were added in celigo-cli 2026.11.2; earlier releases rendered every lookup as a placeholder.

The rendered text arrives inside a JSON response. Pipe it through `--jq .data` to print the text itself.

**Signature**

```bash
celigo processors render [dataFile] --template <text> [--strict] [--import <id> [--field-path <path>]]
celigo processors render [dataFile] --template-file <path>
celigo processors render --template <text> < data.json     # or pipe on stdin
```

**Arguments**

| Argument     | Type   | Required | Description                                                                                |
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------------ |
| `[dataFile]` | string | No       | Path to the JSON object the template renders against. Omit it, or pass `-`, to read stdin. |

**Flags**

| Flag                     | Type    | Default     | Description                                                                                                                      |
| ------------------------ | ------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `--template <text>`      | string  | —           | The Handlebars template, as typed.                                                                                               |
| `--template-file <path>` | string  | —           | Read the template from a file instead, verbatim, line breaks included. Must be a real file path: stdin is reserved for the data. |
| `--strict`               | boolean | `false`     | Fail on a path the data does not carry, with a `422`, instead of rendering it empty. Added in celigo-cli 2026.11.2.              |
| `--import <id>`          | string  | —           | Resolve the template's static lookups from this saved HTTP import, which the CLI reads first. Added in celigo-cli 2026.11.2.     |
| `--field-path <path>`    | string  | `http.body` | With `--import`: the import field the template belongs to. Added in celigo-cli 2026.11.2.                                        |

Pass exactly one of the two. Both, or neither, is refused before any request:

```
Pass the template as --template <text> or --template-file <path>, one of the two.
```

An empty `--template` value or template file is refused too, and so is data that is not a JSON object: an array and, since celigo-cli 2026.11.2, `null`, a string, or a number.

`--field-path` without `--import` is refused before any request, and so is a blank `--field-path`. An `--import` that names an import with no `http` block is refused after the import is read: `Import <id> is not an HTTP import: static lookups are resolved only for an import whose connection is of type http.`

**Request body**

The CLI sends the template in `rules.template` and the JSON object in `data`:

```json
{
  "rules": { "template": "{{record.id}}" },
  "data": { "record": { "id": 7 } }
}
```

`--strict` adds `"strict": true` to `rules`. `--import` adds an `options` object that holds the saved import, the field path, and a connection of type `http`: `{"fieldPath": "http.body", "connection": {"type": "http"}, "import": {...}}`.

**Examples**

```bash
# Double braces HTML-escape the company name; triple braces insert the first name unchanged
echo '{"record": {"firstName": "Ada", "company": "R&D Labs"}}' \
  | celigo processors render --template 'Hello {{{record.firstName}}} from {{record.company}}' --jq .data

# Render a request body template kept in a file against a sample record
celigo processors render ./sample.json --template-file ./body.hbs --jq .data

# A NetSuite lookup's criteria read the record as the root: send the record itself
echo '{"po_number": "PO-1042"}' \
  | celigo processors render --template '{{po_number}}' --jq .data

# Fail on a path the data does not carry, as an HTTP URI does at run time
echo '{"record": {"id": 7}}' \
  | celigo processors render --template '/orders/{{record.orderId}}' --strict

# Resolve the static lookups of a request body template from a saved HTTP import
celigo processors render ./sample.json --template-file ./body.hbs \
  --import 5f83a9b2c7d3e8f1a2b3c4d5 --jq .data
```

**Corresponds to**: [`POST /v1/processors/handlebars`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators). `--import` first issues an internal `GET /v1/imports/{_id}` to read the import it sends.

***

## `celigo processors filter`

Run a JSON array of records through filter rules and print the records that pass. Use it to check a step's filter against sample records before you save it on the step. The platform evaluates the rules as a preview, so `filter` creates and changes nothing and works in `read` mode. Added in celigo-cli 2026.10.2.

`--rules` names a JSON file that holds a step's filter expression, `{"version": "1", "rules": [...]}`, or the step's whole filter, `{"type": "expression", "expression": {...}}`, whose expression the CLI sends. Two shapes are refused before any request:

```
--rules holds a bare rules array. Send the expression object: {"version": "1", "rules": [...]}.
--rules holds a script filter, which runs a hook: the filter processor evaluates expressions only.
```

Since celigo-cli 2026.11.2, a file that holds no JSON object, such as `null`, a string, or a number, is refused the same way: `--rules holds no object. Send the expression object: {"version": "1", "rules": [...]}.`

Send each record bare, as it reaches the step: a record wrapped as `{"record": {...}}` is judged as the wrapper. An unknown operator or a bare `extract` is refused with a `422`, as on a save.

**Signature**

```bash
celigo processors filter [recordsFile] --rules <path>
celigo processors filter --rules <path> < records.json     # or pipe on stdin
```

**Arguments**

| Argument        | Type   | Required | Description                                                           |
| --------------- | ------ | -------- | --------------------------------------------------------------------- |
| `[recordsFile]` | string | No       | Path to a JSON array of records. Omit it, or pass `-`, to read stdin. |

**Flags**

| Flag             | Type   | Default | Description                                                                                                                                                  |
| ---------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--rules <path>` | string | —       | Required. The filter rules JSON file: a filter expression, or a step's whole expression filter. Must be a real file path: stdin is reserved for the records. |

The records must be a JSON array. A bare object is refused before any request: `The records input must be a JSON array — each element is one record to evaluate.`

**Request body**

The CLI sends the expression in `rules` and the records in `data`:

```json
{
  "rules": { "version": "1", "rules": ["equals", ["string", ["extract", "status"]], "open"] },
  "data": [{ "status": "open" }, { "status": "closed" }]
}
```

**Examples**

```bash
# Keep the open records
echo '{"version": "1", "rules": ["equals", ["string", ["extract", "status"]], "open"]}' > open.json
echo '[{"status": "open"}, {"status": "closed"}]' \
  | celigo processors filter --rules open.json

# Check the filter an import holds against sample records
celigo imports get 5f83a9b2c7d3e8f1a2b3c4d5 --jq .filter > filter.json
celigo processors filter ./sample-records.json --rules filter.json
```

**Corresponds to**: [`POST /v1/processors/filter`](https://developer.celigo.com/api/api-reference/b2b-manager/parsers-and-generators)

***

## Gotchas

* **`parse`, `generate`, `render`, and `filter` work in a `read`-mode profile, even though the HTTP verb is `POST`.** A `read`-mode profile normally blocks `POST` before the request leaves your machine. The client's read-only allowlist names the seven processors these commands call — `csvParser`, `csvDataGenerator`, `xmlParser`, `structuredFileParser`, `structuredFileGenerator`, `handlebars`, and `filter` — because nothing on the account can be created, run, or changed through them. You can point these commands at a production account from a locked-down profile. Other read-only `POST` paths are allowlisted the same way, including export previews and connection pings — see [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).
* **`invoke` needs `operate` mode.** Before celigo-cli 2026.10.2 the allowlist held every `/v1/processors/*` path, so a `read`-mode profile could call the catalog's `javascript` processor, which runs a hook whose integrator-api calls write for real. Since celigo-cli 2026.10.2, `read` mode refuses `invoke` before any request, whatever the name. The other catalog processors — `branchFilter`, `mapper`, `transform`, `transformTwoDotZero`, and `javascript` — are reachable only through `invoke`.
* **`parse edi` fails on a violation, and a `200` can still carry `recordLevelErrors`.** A file that breaks the EDI standard, the definition's rules, or the `--edi-profile-id` profile fails the call with a `422` naming the segment, element, and value, and the command exits `1`. The violation is not an entry in `recordLevelErrors`. A call that succeeds can still return `recordLevelErrors` beside the records that parsed, with exit code `0`, so inspect them too, for example with `--jq '.recordLevelErrors'`. Without `--edi-profile-id`, the envelope isn't checked against a profile.
* **The parser wraps the definition; the generator does not.** `parse edi` nests the definition inside `rules`, as `rules._fileDefinitionId` for a saved definition or `rules.fileDefinition` for an inline one. `generate edi` sends the definition's fields as `rules` itself. The two request shapes are not interchangeable. A JSON file that works with one fails with the other.
* **`generate edi` requires an inline definition, even when that definition is saved on the account.** Generation has no `--file-definition-id`, because the API accepts an inline rule set only. Fetch the saved resource with `celigo file-definitions get <id>`, write the definition fields to a local file, then pass that file to `--file-definition`.
* **A flag for the wrong format is rejected, not ignored.** All format flags live on one command, so the CLI checks applicability before doing any work. It fails with `Option(s) not applicable to format '<format>': <flags>` and names each misapplied flag. `--has-header-row` on `parse edi` and `--edi-profile-id` on `generate csv` both stop the command.
* **`--rules` supersedes the individual rule flags.** On `parse` and `generate`, with `--rules <path>` present, the file becomes the entire `rules` object. Since celigo-cli 2026.10.1, naming a flag it replaces — `--column-delimiter`, `--row-delimiter`, `--has-header-row`, `--trim-spaces`, `--rows-to-skip`, `--resource-path`, `--include-header`, `--wrap-with-quotes` — beside it is refused, where earlier releases ignored the flag: `--rules is the complete rules file and replaces --has-header-row: put those settings in the file, or drop --rules.` `--include-empty-values` is the exception: it travels in `options` rather than `rules`, so it still applies. Since celigo-cli 2026.11.2, a blank `--rules` (an unset shell variable) is refused; it used to be read as the flag left out.
* **The CSV parser assumes a header row and trims spaces.** Leaving the flags out gets the platform's defaults; `--no-has-header-row` and `--no-trim-spaces` (celigo-cli 2026.10.1) are the only way to ask for the opposite. A headerless file parsed without `--no-has-header-row` loses its first row to the column names.
* **Use `--jq .data` to extract raw text.** Generated and rendered output arrives wrapped in JSON, so redirecting the default output writes a JSON document rather than a usable file. `--jq .data > out.edi` writes the generated text itself.
* **stdin carries the data, not the rules.** `--rules`, `--file-definition`, `--template-file`, and the other rule inputs require real file paths; passing `-` is rejected. Supply the payload as `[dataFile]` or `[recordsFile]` when you need stdin for something else. Only one input can come from stdin.
* **`generate` and `filter` require a JSON array; `render` requires an object.** A bare object is rejected by `generate` and `filter`, with a message stating what each array element is. Wrap a single record as `[{ … }]`. `render` rejects an array, because its data is the template's root context.
* **`render` and `filter` take a record in different shapes.** Most step templates read `{{record.<field>}}`, so `render` needs the record under `record`; a NetSuite lookup's criteria and a NetSuite import's lookup expressions read it as the root, so send that record bare. `filter` judges each record as it reaches the step, so send it bare: a record wrapped as `{"record": {...}}` is judged as the wrapper.
* **A missing path renders empty in `render`.** That matches an HTTP body or a mapping at run time, but an HTTP URI or header, NetSuite lookup criteria, and SQL queries fail the record on the same path. A template that renders here can still fail there. Since celigo-cli 2026.11.2, `--strict` fails the render on a missing path, as those steps do.
* **Input files are read in their encoding.** Since celigo-cli 2026.11.2, a data file, a template file, a rules file, and stdin are read as UTF-8, with or without a byte-order mark, or as UTF-16 by its byte-order mark. Input in any other encoding is refused before any request, and the error says what was found. Earlier releases read every file as UTF-8, so a byte-order mark became part of a CSV's first header.

## Related

* [file-definitions](https://developer.celigo.com/cli/commands/file-definitions.md) — the saved parsing and generation rules that `--file-definition-id` references and `--file-definition` inlines.
* [edi-profiles](https://developer.celigo.com/cli/commands/edi-profiles.md) — the trading partner envelope configuration that `--edi-profile-id` supplies for ISA/GS context.
* [exports](https://developer.celigo.com/cli/commands/exports.md) — where a validated parsing rule set runs in production, on file-based exports, and where a filter or template you checked with `filter` or `render` is saved on an export.
* [imports](https://developer.celigo.com/cli/commands/imports.md) — where a validated generation rule set runs in production, producing outbound files, and where a filter or template you checked with `filter` or `render` is saved on an import.
* [edi-transactions](https://developer.celigo.com/cli/commands/edi-transactions.md) — the transaction log for documents exchanged once the flow is live.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.celigo.com/cli/commands/processors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
