Use from the command line Last updated: 2026-12-02

edifabric is a command for X12 and HIPAA files: validate them, convert them to JSON and back, generate 999 and 997 acknowledgments, split them by transaction set or by a repeating loop, and merge the parts back. It runs ediFabric Native on your machine, so your files stay there, and it works the same in a terminal, a script or a CI pipeline.

It comes with the ediFabric MCP server, from version 1.2.0, and has the same operations as its tools, with the same license, models and settings. It needs Node.js 18 or later, on Windows x64, Linux x64 and arm64, or macOS on Apple silicon.

Install

Install it once, or run it without installing:

npm install -g @edifabric/mcp
edifabric status

# or, without installing
npx -y -p @edifabric/mcp edifabric status

status shows the license and how it's checked, where models come from and the native library. Without a serial, the command uses the demo serial, which has a small daily quota: set EDIFABRIC_SERIAL to your own, copied from Your account. The free Community plan works.

Commands

CommandWhat it does
edifabric validate <files>Validates EDI, up to HIPAA SNIP level 4 with --snip 4. --report prints text, json, junit or sarif
edifabric parse <files>Converts EDI to JSON, saved next to each file, or printed with -o -
edifabric build <file or folder>Converts JSON to EDI, or merges a folder of parts from split
edifabric ack <files>Saves the 999, or the 997 with --type 997, and the TA1 when the interchange asks for one
edifabric split <file>Splits by transaction set or by a repeating loop into JSON parts. --edi saves each transaction set as an EDI file instead
edifabric spec <transaction> <version>Describes a transaction, one segment with --segment, or prints a JSON skeleton to fill in with --skeleton
edifabric statusShows the license, where models come from and the native library

The commands take files, folders (--recursive for their subfolders), patterns such as inbound/*.837, or - for standard input. --json prints the result as JSON, and --force replaces output files that exist. edifabric help <command> lists a command's options.

Validate files

edifabric validate inbound/ --snip 4

Each file is reported as valid, or with each error and the segment it is in:

837p-claim-error.txt: 1 error
  segment 9, element 2, component 1: Invalid EDI code
    PRV*BI*PX*203BF0100Y
837p-claim.txt: valid (1 transaction set, 46 segments)

The command exits with 1 when a file has errors, so a script can stop or move the file. --snip sets the HIPAA SNIP level: 1 syntax, 2 limits and codes (the default), 3 balancing, 4 situational rules.

Split and merge

split uses ediFabric Native's splitter, which reads the file one part at a time, so large files use little memory. Without a splitter, it splits by transaction set. To split by a repeating loop, such as the claims of an 837 or the members of an 834, give the splitter of the loop's first segment: load one of your files in EdiNation, select the segment in the Structure tab, and copy its Splitter.

# Split an 837P by claim, with the claims under the subscriber (loop 2000B)
edifabric split claims.837 --split '{"segment_id":"CLM","segment_depth":4,"loop_id":"2300"}' -o claims

# or the same splitter in parts
edifabric split claims.837 --segment CLM --depth 4 --loop 2300 -o claims

A loop can be at more than one depth: in an 837P, claims are at depth 4 under the subscriber and at depth 5 under a patient (loop 2000C). A splitter that matches nothing in the file is refused, with exit code 2.

The folder holds part-000001.json and on, one claim each, in the JSON of parse, with envelope.json for the rest of the file and split.json listing where each part goes back. Edit the parts, or delete the ones you don't want, then build the folder:

edifabric build claims -o claims-out.837
edifabric validate claims-out.837

build puts each part listed in split.json back where it came from, in that order, leaves out the deleted ones, and sets the trailer counts (SE01, GE01 and IEA01) to match. Validate the result, as deleting a part can leave a transaction without a loop it needs.

In CI pipelines

--report sarif writes the errors as SARIF, which GitHub code scanning and editors show at the file and line. --report junit writes a test report for CI dashboards. With GitHub Actions:

- run: npx -y -p @edifabric/mcp edifabric validate edi/ --recursive --snip 4 --report sarif -o edi.sarif
  env:
    EDIFABRIC_SERIAL: ${{ secrets.EDIFABRIC_SERIAL }}
- uses: github/codeql-action/upload-sarif@v3
  if: always()
  with:
    sarif_file: edi.sarif

Keep the serial in a secret, not in the pipeline file. Build machines are often new on every run, and each new machine takes one of the plan's machines for the day. On Developer, keep the token cache between runs by pointing EDIFABRIC_TOKEN_CACHE at a cached folder. On Enterprise, set EDIFABRIC_TOKEN to an offline token, which makes no license calls. See Licensing.

Settings

The command reads the same environment variables as the MCP server, listed in its Configuration, and takes three of them as options too:

OptionVariableWhat it does
--serialEDIFABRIC_SERIALYour ediFabric serial. The default is the demo serial
--mapEDIFABRIC_MAPA map.json with local or custom models, such as ones from the EDI Spec Builder. See Models
--offlineEDIFABRIC_OFFLINEUse only the models in the map, without downloading any

Models that aren't in the map are downloaded with your serial, which sends the transaction type and version, never the contents of your files.

Exit codes

CodeMeaning
0Done, and every file is valid
1validate found errors, or ack rejected a transaction set
2Wrong command or options, or a splitter that matches nothing in the file
3A license problem: the serial, token, plan or quota
4No model for a transaction, or the spec wasn't found
5A file wasn't found, already exists (add --force) or is too large
6Anything else

The command is open source under the MIT license, in the edifabric-mcp repository. ediFabric Native is licensed under the ediFabric EULA.