{
  "name": "edi.validate",
  "group": "edi",
  "summary": "Check an X12 document's envelope integrity and 856 HL hierarchy for the errors that cause rejections.",
  "description": "Runs the structural checks a trading partner runs before rejecting a file: control numbers matching between the ISA/IEA, GS/GE and ST/SE header and trailer pairs, declared counts matching actual counts, and - for an 856 - the HL hierarchy. HL faults are the usual cause of ASN rejections and chargebacks: a parent ID naming no existing node, a duplicate HL01, an unknown level code, a missing carton level. Every finding names the segment and states what the value should have been.",
  "keywords": [
    "edi validation",
    "856 rejected",
    "asn error",
    "hl segment",
    "chargeback",
    "control number mismatch",
    "x12 validator",
    "se01 count"
  ],
  "endpoint": "https://fluentedi.com/v1/edi/validate",
  "mcp_name": "edi_validate",
  "makes_network_request": false,
  "parameters": {
    "type": "object",
    "properties": {
      "input": {
        "description": "Raw X12 EDI text.",
        "type": "string",
        "maxLength": 2000000
      },
      "require_levels": {
        "description": "HL level codes that must be present in an 856, e.g. [\"S\",\"O\",\"P\",\"I\"] for a pack-level ASN.",
        "type": "array",
        "default": [],
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "input"
    ],
    "additionalProperties": false
  },
  "examples": [
    {
      "description": "Validate an ASN before sending it",
      "url": "https://fluentedi.com/v1/edi/validate?input=ST*856*0001~BSN*00*SHIP001*20260822*1200*0001~HL*1**S*1~HL*2*1*O*1~HL*3*2*P*1~MAN*GM*006141411234567890~HL*4*3*I~SN1**12*EA~CTT*4~SE*10*0001~",
      "args": {
        "input": "ST*856*0001~BSN*00*SHIP001*20260822*1200*0001~HL*1**S*1~HL*2*1*O*1~HL*3*2*P*1~MAN*GM*006141411234567890~HL*4*3*I~SN1**12*EA~CTT*4~SE*10*0001~"
      }
    },
    {
      "description": "Catch an orphaned HL parent",
      "url": "https://fluentedi.com/v1/edi/validate?input=ST*856*0001~BSN*00*S1*20260822*1200*0001~HL*1**S*1~HL*2*9*O~SE*5*0001~",
      "args": {
        "input": "ST*856*0001~BSN*00*S1*20260822*1200*0001~HL*1**S*1~HL*2*9*O~SE*5*0001~"
      }
    },
    {
      "description": "Require a carton level",
      "url": "https://fluentedi.com/v1/edi/validate?input=ST*856*0001~BSN*00*S1*20260822*1200*0001~HL*1**S*1~HL*2*1*O*1~HL*3*2*I~SE*6*0001~&require_levels=%5B%22S%22%2C%22O%22%2C%22P%22%2C%22I%22%5D",
      "args": {
        "input": "ST*856*0001~BSN*00*S1*20260822*1200*0001~HL*1**S*1~HL*2*1*O*1~HL*3*2*I~SE*6*0001~",
        "require_levels": [
          "S",
          "O",
          "P",
          "I"
        ]
      }
    }
  ],
  "suggestion": null
}