When a segment is used in a transaction set, the X12 standard specifies two types of segment requirements: Mandatory and Optional.

  • Mandatory: Segments marked as mandatory (M) must be present in the EDI transaction.
  • Optional: Segments marked as optional (O) may be present in the EDI transaction.

For each transaction set, the X12 standard defines a base specification, which denotes the requirements of each segment. All segments marked as M (mandatory) in the base specification must be present in the EDI file sent between two trading partners. On the other hand, all segments marked as O (optional) in the base specification can either be optional or mandatory, depending on the implementation guide that you and your trading partner agree to.

The requirement of a segment is always defined in the context of the transaction set and the position it is used in. For example, a REF segment might have different requirement parameters if it is used in an 850 Purchase Order vs. a 270 Eligibility, Coverage, or Benefit inquiry. Furthermore, the same segment might be used multiple times in different places in the same transaction set. For example, a DTM Date/Time Reference segment could be optional in the Heading but mandatory in the Detail.

As with all things in X12 EDI, trading partners will create a specification to suit their business needs. For example, your trading partners may decide that some segments — even optional as per the standard — must be present in the data (i.e., are mandatory). On the other hand, according to the X12 standard, you cannot mark segments that are mandatory in the base X12 specification as optional in your guide. In practice, some businesses break the X12 standard and you’ll have to conform to their specification nonetheless.

Most X12 implementation guides used in the industry were built using a tool called SpecBuilder, which creates a standard PDF format. We will use SpecBuilder PDFs and their terminology to explain segment requirements below, but your trading partner might send these requirements in different formats (e.g. CSV, Word, custom PDF).

In these implementation guides, the segment requirements given by X12 are found in the requirement column (Req for short). The Req column will show which segments are mandatory (M) or optional (O). Trading partners that deviate from the base specification will often indicate which fields are optional or mandatory in a column called Usage or Attributes, and they typically use a different syntax, such as Must use (mandatory) and Used (optional).

Additionally, the segment requirements are also usually found on the segment detail page near the description or header. In these areas, the requirements are also indicated as either mandatory or optional. For trading partner specific requirements, look for the User Option or Usage label and the Must use or Used syntax.

X12 types

Mandatory

Mandatory segments are marked with an M or Mandatory in most implementation guides. If a segment is defined as mandatory in a transaction set, then you cannot send X12 data without it. In most cases, transactions that are missing mandatory segments will either be stopped by the sender, or rejected by the recipient.

For example, the BIG (Beginning Segment for Invoice) segment used in all X12 810 Invoices is mandatory. It contains vital invoice information, such as the invoice number and date. You cannot send an invoice without these values.

Optional

Optional segments are marked with an O or Optional in most implementation guides.

If a segment is marked as optional, it can be omitted in the data and the transaction would still be valid. Often, PDF specifications will explain when to use optional segments in a notes section.

For example, the CUR (Currency) segment used in X12 810 Invoices is optional. Trading partners might agree that the default currency is US Dollars and use CUR only when the invoice currency is different from US Dollars.

If you want to see the segment requirements for a specific transaction set, see EDI Reference.