X12 271 Eligibility, Coverage or Benefit Information Last updated: 2026-09-29

The 271 (005010X279A1) is the payer's answer to a 270 eligibility inquiry. It tells the provider whether the patient has active coverage and what the plan covers.

Benefits are reported in EB segments: coverage status, service type, co-payments, co-insurance, deductibles and out-of-pocket amounts, often with time periods and network indicators.

At a glance

Standard
X12 HIPAA
Implementation guide
005010X279A1
Functional group
HB (GS01)
Sent by
Payer to provider
Responses
999 (batch)
ediFabric .NET template
TS271 in EdiFabric.Templates.Hipaa
OpenEDI definition
View 271 in the spec library

271 structure

The full X12 271 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 16 loops and 69 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.

Segment / loop Name Usage Max use
STTransaction Set HeaderRequired1
BHTBeginning of Hierarchical TransactionRequired1
Loop 2000AInformation Source LevelRequired>1
HLInformation Source LevelRequired1
AAARequest ValidationSituational9
Loop 2100AInformation Source NameRequired1
NM1Information Source NameRequired1
PERInformation Source Contact InformationSituational3
AAARequest ValidationSituational9
Loop 2000BInformation Receiver LevelSituational>1
HLInformation Receiver LevelRequired1
Loop 2100BInformation Receiver NameRequired1
NM1Information Receiver NameRequired1
REFInformation Receiver Additional IdentificationSituational9
N3Information Receiver AddressSituational1
N4Information Receiver City State ZIP CodeSituational1
AAAInformation Receiver Request ValidationSituational9
PRVInformation Receiver Provider InformationSituational1
Loop 2000CSubscriber LevelSituational>1
HLSubscriber LevelRequired1
TRNSubscriber Trace NumberSituational3
Loop 2100CSubscriber NameRequired1
NM1Subscriber NameRequired1
REFSubscriber Additional IdentificationSituational9
N3Subscriber AddressSituational1
N4Subscriber City State ZIP CodeSituational1
AAASubscriber Request ValidationSituational9
PRVProvider InformationSituational1
DMGSubscriber Demographic InformationSituational1
INSSubscriber RelationshipSituational1
HISubscriber Health Care Diagnosis CodeSituational1
DTPSubscriber DateSituational9
MPISubscriber Military Personnel InformationSituational1
Loop 2110CSubscriber Eligibilityor Benefit InformationSituational>1
EBSubscriber Eligibilityor Benefit InformationRequired1
HSDHealth Care Services DeliverySituational9
REFSubscriber Additional IdentificationSituational9
DTPSubscriber Eligibility Benefit DateSituational20
AAASubscriber Request ValidationSituational9
MSGMessage TextSituational10
Loop 2115CSubscriber Eligibilityor Benefit Additional InformationSituational10
IIISubscriber Eligibilityor Benefit Additional InformationRequired1
Loop LSHeaderSituational1
LSHeaderRequired1
Loop 2120CSubscriber Benefit Related Entity NameSituational23
NM1Subscriber Benefit Related Entity NameRequired1
N3Subscriber Benefit Related Entity AddressSituational1
N4Subscriber Benefit Related Entity City State ZIP CodeSituational1
PERSubscriber Benefit Related Entity Contact InformationSituational3
PRVSubscriber Benefit Related Provider InformationSituational1
LETrailerRequired1
Loop 2000DDependent LevelSituational>1
HLDependent LevelRequired1
TRNDependent Trace NumberSituational3
Loop 2100DDependent NameRequired1
NM1Dependent NameRequired1
REFDependent Additional IdentificationSituational9
N3Dependent AddressSituational1
N4Dependent City State ZIP CodeSituational1
AAADependent Request ValidationSituational9
PRVProvider InformationSituational1
DMGDependent Demographic InformationSituational1
INSDependent RelationshipSituational1
HIDependent Health Care Diagnosis CodeSituational1
DTPDependent DateSituational9
MPIDependent Military Personnel InformationSituational1
Loop 2110DDependent Eligibilityor Benefit InformationSituational>1
EBDependent Eligibilityor Benefit InformationRequired1
HSDHealth Care Services DeliverySituational9
REFDependent Additional IdentificationSituational9
DTPDependent Eligibility Benefit DateSituational20
AAADependent Request ValidationSituational9
MSGMessage TextSituational10
Loop 2115DDependent Eligibilityor Benefit Additional InformationSituational10
IIIDependent Eligibilityor Benefit Additional InformationRequired1
Loop LSHeaderSituational1
LSHeaderRequired1
Loop 2120DDependent Benefit Related Entity NameSituational23
NM1Dependent Benefit Related Entity NameRequired1
N3Dependent Benefit Related Entity AddressSituational1
N4Dependent Benefit Related Entity City State ZIP CodeSituational1
PERDependent Benefit Related Entity Contact InformationSituational3
PRVDependent Benefit Related Provider InformationSituational1
LETrailerRequired1
SETransaction Set TrailerRequired1

Sample 271 file

An eligibility response with active coverage and benefit details. Paste it into EdiNation to see every element named and validated.

ISA*00*          *00*          *ZZ*1234567        *ZZ*11111          *170508*1141*>*00501*000000101*1*P*:~
GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X279A1~
ST*271*4321*005010X279A1~
BHT*0022*11*10001234*20060501*1319~
HL*1**20*1~
NM1*PR*2*ABC COMPANY*****PI*842610001~
HL*2*1*21*1~
NM1*1P*2*BONE AND JOINT CLINIC*****SV*2000035~
HL*3*2*22*0~
TRN*2*93175-012547*9877281234~
NM1*IL*1*SMITH*JOHN****MI*123456789~
N3*15197 BROADWAY AVENUE*APT 215~
N4*KANSAS CITY*MO*64108~
DMG*D8*19630519*M~
DTP*346*D8*20060101~
EB*1**30**GOLD 123 PLAN~
EB*L~
EB*1**1>33>35>47>86>88>98>AL>MH>UC~
EB*B**1>33>35>47>86>88>98>AL>MH>UC*HM*GOLD 123 PLAN*27*10*****Y~
EB*B**1>33>35>47>86>88>98>AL>MH>UC*HM*GOLD 123 PLAN*27*30*****N~
LS*2120~
NM1*P3*1*JONES*MARCUS****SV*0202034~
LE*2120~
SE*22*4321~
GE*1*101~
IEA*1*000000101~

The same 271 as JSON

ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.

{
  "ST": {
    "TransactionSetIdentifierCode_01": "271",
    "TransactionSetControlNumber_02": "4321",
    "ImplementationConventionPreference_03": "005010X279A1"
  },
  "BHT_BeginningOfHierarchicalTransaction": {
    "HierarchicalStructureCode_01": "0022",
    "TransactionSetPurposeCode_02": "11",
    "SubmitterTransactionIdentifier_03": "10001234",
    "TransactionSetCreationDate_04": "20060501",
    "TransactionSetCreationTime_05": "1319"
  },
  "Loop2000A": [
    {
      "HL_InformationSourceLevel": {
        "HierarchicalIDNumber_01": "1",
        "HierarchicalLevelCode_03": "20",
        "HierarchicalChildCode_04": "1"
      },
      "Loop2100A": {
        "NM1_InformationSourceName": {
          "EntityIdentifierCode_01": "PR",
          "EntityTypeQualifier_02": "2",
          "ResponseContactLastorOrganizationName_03": "ABC COMPANY",
          "IdentificationCodeQualifier_08": "PI",
          "ResponseContactIdentifier_09": "842610001"
        }
      },
      "Loop2000B": [
        {
          "HL_InformationReceiverLevel": {
            "HierarchicalIDNumber_01": "2",
            "HierarchicalParentIDNumber_02": "1",
            "HierarchicalLevelCode_03": "21",
            "HierarchicalChildCode_04": "1"
          },
          "Loop2100B": {
            "NM1_InformationReceiverName": {
              "EntityIdentifierCode_01": "1P",
              "EntityTypeQualifier_02": "2",
              "ResponseContactLastorOrganizationName_03": "BONE AND JOINT CLINIC",
              "IdentificationCodeQualifier_08": "SV",
              "ResponseContactIdentifier_09": "2000035"
            }
          },
          "Loop2000C": [
            {
              "HL_SubscriberLevel": {
                "HierarchicalIDNumber_01": "3",
                "HierarchicalParentIDNumber_02": "2",
                "HierarchicalLevelCode_03": "22",
                "HierarchicalChildCode_04": "0"
              },
              "TRN_SubscriberTraceNumber": [
                {
                  "TraceTypeCode_01": "2",
                  "CurrentTransactionTraceNumber_02": "93175-012547",
                  "OriginatingCompanyIdentifier_03": "9877281234"
                }
              ],
              "Loop2100C": {
                "NM1_SubscriberName": {
                  "EntityIdentifierCode_01": "IL",
                  "EntityTypeQualifier_02": "1",
                  "ResponseContactLastorOrganizationName_03": "SMITH",
                  "ResponseContactFirstName_04": "JOHN",
                  "IdentificationCodeQualifier_08": "MI",
                  "ResponseContactIdentifier_09": "123456789"
                },
                "N3_SubscriberAddress": {
                  "ResponseContactAddressLine_01": "15197 BROADWAY AVENUE",
                  "ResponseContactAddressLine_02": "APT 215"
                },
                "N4_SubscriberCity_State_ZIPCode": {
                  "AdditionalPatientInformationContactCityName_01": "KANSAS CITY",
                  "AdditionalPatientInformationContactStateCode_02": "MO",
                  "AdditionalPatientInformationContactPostalZoneorZIPCode_03": "64108"
                },
                "DMG_SubscriberDemographicInformation": {
                  "DateTimePeriodFormatQualifier_01": "D8",
                  "DependentBirthDate_02": "19630519",
                  "DependentGenderCode_03": "M"
                },
                "DTP_SubscriberDate": [
                  {
                    "DateTimeQualifier_01": "346",
                    "DateTimePeriodFormatQualifier_02": "D8",
                    "DateTimePeriod_03": "20060101"
                  }
                ],
                "Loop2110C": [
                  {
                    "EB_SubscriberEligibilityorBenefitInformation": {
                      "EligibilityorBenefitInformation_01": "1",
                      "ServiceTypeCode_03": [
                        "30"
                      ],
                      "PlanCoverageDescription_05": "GOLD 123 PLAN"
                    }
                  },
                  {
                    "EB_SubscriberEligibilityorBenefitInformation": {
                      "EligibilityorBenefitInformation_01": "L"
                    }
                  },
                  {
                    "EB_SubscriberEligibilityorBenefitInformation": {
                      "EligibilityorBenefitInformation_01": "1",
                      "ServiceTypeCode_03": [
                        "1",
                        "33",
                        "35",
                        "47",
                        "86",
                        "88",
                        "98",
                        "AL",
                        "MH",
                        "UC"
                      ]
                    }
                  },
                  {
                    "EB_SubscriberEligibilityorBenefitInformation": {
                      "EligibilityorBenefitInformation_01": "B",
                      "ServiceTypeCode_03": [
                        "1",
                        "33",
                        "35",
                        "47",
                        "86",
                        "88",
                        "98",
                        "AL",
                        "MH",
                        "UC"
                      ],
                      "InsuranceTypeCode_04": "HM",
                      "PlanCoverageDescription_05": "GOLD 123 PLAN",
                      "TimePeriodQualifier_06": "27",
                      "BenefitAmount_07": "10",
                      "InPlanNetworkIndicator_12": "Y"
                    }
                  },
                  {
                    "EB_SubscriberEligibilityorBenefitInformation": {
                      "EligibilityorBenefitInformation_01": "B",
                      "ServiceTypeCode_03": [
                        "1",
                        "33",
                        "35",
                        "47",
                        "86",
                        "88",
                        "98",
                        "AL",
                        "MH",
                        "UC"
                      ],
                      "InsuranceTypeCode_04": "HM",
                      "PlanCoverageDescription_05": "GOLD 123 PLAN",
                      "TimePeriodQualifier_06": "27",
                      "BenefitAmount_07": "30",
                      "InPlanNetworkIndicator_12": "N"
                    },
                    "LoopLS": {
                      "LS_Header": {
                        "LoopIdentifierCode_01": "2120"
                      },
                      "Loop2120C": [
                        {
                          "NM1_SubscriberBenefitRelatedEntityName": {
                            "EntityIdentifierCode_01": "P3",
                            "EntityTypeQualifier_02": "1",
                            "ResponseContactLastorOrganizationName_03": "JONES",
                            "ResponseContactFirstName_04": "MARCUS",
                            "IdentificationCodeQualifier_08": "SV",
                            "ResponseContactIdentifier_09": "0202034"
                          }
                        }
                      ],
                      "LE_Trailer": {
                        "LoopIdentifierCode_01": "2120"
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "SE": {
    "NumberofIncludedSegments_01": "22",
    "TransactionSetControlNumber_02": "4321"
  }
}

Parse and validate a 271 file

Read the file into typed objects with ediFabric .NET, convert it to JSON in process with the ediFabric Native bindings for Python, Java and C, or post it to the ediFabric Cloud REST API from any language.

using EdiFabric.Templates.Hipaa5010;

License.SetSerial("YOUR_SERIAL_KEY");

using (var stream = File.OpenRead(@"C:\edi\GenericResponse.txt"))
using (var reader = new X12Reader(stream, "EdiFabric.Templates.Hipaa"))
{
    var items = await reader.ReadToEndAsync();
    foreach (var transaction in items.OfType<TS271>())
    {
        if (transaction.IsValid(out MessageErrorContext errors))
            Console.WriteLine($"{transaction.ST.TransactionSetControlNumber_02} is valid");
        else
            Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten()));
    }
}
import json
import edifabric_x12 as ef

serial = "YOUR_SERIAL_KEY"
ef.load_library()
ef.set_serial(serial)
ef.set_map(json.dumps({"default": serial, "maps": {}}))

edi = open("GenericResponse.txt", "rb").read()
output, offset = ef.parse(edi, ef.ParseMode.JSON_VALIDATE)
transactions = output[:offset]
report = json.loads(output[offset:])
print(report["errors_count"])
import com.edifabric.nativex12.EdiFabricX12;
import com.edifabric.nativex12.ParseMode;
import com.edifabric.nativex12.ParseResult;

String serial = "YOUR_SERIAL_KEY";
EdiFabricX12.loadLibrary();
EdiFabricX12.setSerial(serial);
EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}");

String edi = Files.readString(Path.of("GenericResponse.txt"));
ParseResult result = EdiFabricX12.parse(edi, ParseMode.JSON_VALIDATE);
System.out.println(result.getTransactions());
System.out.println(result.getReport());
#include "edifabric_x12.h"

const char *serial = "YOUR_SERIAL_KEY";
ef_parse_result result;

if (ef_load_library(NULL) != 0)
    return 1;
ef_set_serial(serial);
ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}");

char *edi = read_file("GenericResponse.txt", NULL);   /* helper in example_all_functions.c */
if (ef_parse(edi, EF_PARSE_JSON_VALIDATE, NULL, &result) == 0) {
    /* transactions = output[0 .. offset), report = output[offset .. length) */
    fwrite(result.output.data, 1, (size_t)result.output.length, stdout);
    ef_free(result.output.data);
}
curl -X POST 'https://api.edination.com/v2/x12/read' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@GenericResponse.txt'

Generate a 271 file

Populate a TS271 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 271 file back.

using EdiFabric.Templates.Hipaa5010;

License.SetSerial("YOUR_SERIAL_KEY");

var transaction = new TS271();

//  Transaction Set ID Code = 271 (Eligibility, Coverage or Benefit Information)
//  Transaction Set Control Number = 4321
//  Implementation Convention Reference = 005010X279A1
transaction.ST = new ST();
transaction.ST.TransactionSetIdentifierCode_01 = "271";
transaction.ST.TransactionSetControlNumber_02 = "0001";
transaction.ST.ImplementationConventionPreference_03 = "005010X279A1";

//  Hierarchical Structure Code = 0022 (Information Source, Information Receiver, Subscriber, Dependent)
//  Transaction Set Purpose Code = 11(Response) Identification
//  Reference Identification = 10001234
//  Date = 20060501(May 1, 2006)
//  Time = 1:19 PM
transaction.BHT_BeginningOfHierarchicalTransaction = new BHT_BeginningOfHierarchicalTransaction_2();
transaction.BHT_BeginningOfHierarchicalTransaction.HierarchicalStructureCode_01 = "0022";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetPurposeCode_02 = "11";
transaction.BHT_BeginningOfHierarchicalTransaction.SubmitterTransactionIdentifier_03 = "10001234";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationDate_04 = "20060501";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationTime_05 = "1319";

// ... set the remaining loops and segments the same way

// SegmentBuilders is in the Common project of the example repository
using (var stream = new MemoryStream())
{
    using (var writer = new X12Writer(stream))
    {
        writer.Write(SegmentBuilders.BuildIsa("1"));
        writer.Write(SegmentBuilders.BuildGs("1", "SENDER1", "RECEIVER1", "005010X279A1"));
        writer.Write(transaction);
    }
    Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
}
import json
import edifabric_x12 as ef

serial = "YOUR_SERIAL_KEY"
ef.load_library()
ef.set_serial(serial)
ef.set_map(json.dumps({"default": serial, "maps": {}}))

# the transactions JSON returned by ef.parse, edited or produced by your application
transactions = open("GenericResponse.json", "rb").read()
edi = ef.build(transactions, postfix="\r\n")
print(edi)
import com.edifabric.nativex12.EdiFabricX12;

String serial = "YOUR_SERIAL_KEY";
EdiFabricX12.loadLibrary();
EdiFabricX12.setSerial(serial);
EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}");

// the transactions JSON returned by parse, edited or produced by your application
String transactions = Files.readString(Path.of("GenericResponse.json"));
String edi = EdiFabricX12.build(transactions, "\r\n");
System.out.println(edi);
#include "edifabric_x12.h"

ef_buffer edi;

if (ef_load_library(NULL) != 0)
    return 1;
ef_set_serial("YOUR_SERIAL_KEY");
ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}");

/* the transactions JSON returned by ef_parse, edited or produced by your application */
char *transactions = read_file("GenericResponse.json", NULL);
if (ef_build(transactions, "\r\n", &edi) == 0) {
    fwrite(edi.data, 1, (size_t)edi.length, stdout);
    ef_free(edi.data);
}
# the JSON returned by /read, edited or produced by your application
curl -X POST 'https://api.edination.com/v2/x12/write' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/json' \
--data-binary '@GenericResponse.json' \
-o 'GenericResponse.txt'

Complete ediFabric .NET example

A complete C# program for the X12 271, built on TS271 in EdiFabric.Templates.Hipaa. The same code is in the ediFabric .NET examples on GitHub.

using EdiFabric.Framework.Readers;
using EdiFabric.Framework.Writers;
using EdiFabric.Templates.Hipaa5010;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using EdiFabric.Core.Model.Edi;
using EdiFabric.Core.Model.Edi.X12;
using EdiFabric.Examples.X12.Common;

namespace EdiFabric.Examples.X12.T271
{
    class Program
    {
        static void Main(string[] args)
        {
            SerialKey.Set(Common.SerialKey.Get());
            Read();
            Write();
        }

        ///
        /// Read Generic Response
        ///
        static void Read()
        {
            var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\Hipaa\GenericResponse.txt");

            List ediItems;
            using (var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.Hipaa"))
                ediItems = ediReader.ReadToEnd().ToList();

            var transactions = ediItems.OfType();

            foreach (var transaction in transactions)
            {
                if (transaction.HasErrors)
                {
                    //  partially parsed
                    var errors = transaction.ErrorContext.Flatten();
                }
            }
        }

        ///
        /// Write Generic Response
        ///
        static void Write()
        {
            var transaction = BuildGenericResponse("4321");

            using (var stream = new MemoryStream())
            {
                using (var writer = new X12Writer(stream))
                {
                    writer.Write(SegmentBuilders.BuildIsa("1"));
                    writer.Write(SegmentBuilders.BuildGs("1", "SENDER1", "RECEIVER1", "005010X279A1"));
                    writer.Write(transaction);
                }

                var ediString = stream.LoadToString();
            }
        }

        ///
        /// Builds generic response.
        /// Original from http://www.x12.org/examples/005010X279/subscriber-who-is-also-the-patient/response-to-generic-request-by-clinic-for-patient-(subscriber)-eligibility/
        ///
        static TS271 BuildGenericResponse(string controlNumber)
        {
            var result = new TS271();

            //  Transaction Set ID Code = 271 (Eligibility, Coverage or Benefit Information)
            //  Transaction Set Control Number = 4321
            //  Implementation Convention Reference = 005010X279A1
            result.ST = new ST();
            result.ST.TransactionSetIdentifierCode_01 = "271";
            result.ST.TransactionSetControlNumber_02 = controlNumber.PadLeft(9, '0');
            result.ST.ImplementationConventionPreference_03 = "005010X279A1";

            //  Hierarchical Structure Code = 0022 (Information Source, Information Receiver, Subscriber, Dependent)
            //  Transaction Set Purpose Code = 11(Response) Identification
            //  Reference Identification = 10001234
            //  Date = 20060501(May 1, 2006)
            //  Time = 1:19 PM
            result.BHT_BeginningOfHierarchicalTransaction = new BHT_BeginningOfHierarchicalTransaction_2();
            result.BHT_BeginningOfHierarchicalTransaction.HierarchicalStructureCode_01 = "0022";
            result.BHT_BeginningOfHierarchicalTransaction.TransactionSetPurposeCode_02 = "11";
            result.BHT_BeginningOfHierarchicalTransaction.SubmitterTransactionIdentifier_03 = "10001234";
            result.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationDate_04 = "20060501";
            result.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationTime_05 = "1319";

            //  Repeating 2000A Loops
            result.Loop2000A = new List();

            //  Begin 2000A Loop
            var loop2000A = new Loop_2000A_271();

            //  Hierarchical ID Number = 1
            //  Hierarchical Parent ID Number = *not used
            //  Hierarchical Level Code = 20(Information Source)
            //  Hierarchical Child Code = 1
            loop2000A.HL_InformationSourceLevel = new HL_InformationSourceLevel();
            loop2000A.HL_InformationSourceLevel.HierarchicalIDNumber_01 = "1";
            loop2000A.HL_InformationSourceLevel.HierarchicalLevelCode_03 = "20";
            loop2000A.HL_InformationSourceLevel.HierarchicalChildCode_04 = "1";

            //  Begin 2100A Loop
            loop2000A.Loop2100A = new Loop_2100A_271();

            //  Entity Identifier Code = PR (Payer)
            //  Entity Type Qualifier = 2(Non - person)
            //  Last Name = ABC Company
            //  First Name = *not used
            //  Middle Name = *not used
            //  Name Prefix = *not used
            //  Name Suffix = *not used
            //  Identification Code Qualifier = PI(Payer Identification)
            //  Identification Code = 842610001
            loop2000A.Loop2100A.NM1_InformationSourceName = new NM1_InformationSourceName();
            loop2000A.Loop2100A.NM1_InformationSourceName.EntityIdentifierCode_01 = "PR";
            loop2000A.Loop2100A.NM1_InformationSourceName.EntityTypeQualifier_02 = "2";
            loop2000A.Loop2100A.NM1_InformationSourceName.ResponseContactLastorOrganizationName_03 = "ABC COMPANY";
            loop2000A.Loop2100A.NM1_InformationSourceName.IdentificationCodeQualifier_08 = "PI";
            loop2000A.Loop2100A.NM1_InformationSourceName.ResponseContactIdentifier_09 = "842610001";

            //  End 2100A Loop

            //  Repeating 2000B Loops
            loop2000A.Loop2000B = new List();

            //  Begin 2000B Loop
            var loop2000B = new Loop_2000B_271();

            //  Hierarchical ID Number = 2
            //  Hierarchical Parent ID Number = 1
            //  Hierarchical Level Code = 21(Information Receiver)
            //  Hierarchical Child Code = 1
            loop2000B.HL_InformationReceiverLevel = new HL_InformationReceiverLevel_2();
            loop2000B.HL_InformationReceiverLevel.HierarchicalIDNumber_01 = "2";
            loop2000B.HL_InformationReceiverLevel.HierarchicalParentIDNumber_02 = "1";
            loop2000B.HL_InformationReceiverLevel.HierarchicalLevelCode_03 = "21";
            loop2000B.HL_InformationReceiverLevel.HierarchicalChildCode_04 = "1";

            //  Begin 2100B Loop
            loop2000B.Loop2100B = new Loop_2100B_271();

            //  Entity Identifier Code = 1P (Provider)
            //  Entity Type Qualifier = 2(Non - Person Entity)
            //  Last Name = Bone and Joint Clinic
            //  First Name = *not used
            //  Middle Name = *not used
            //  Name Prefix = *not used
            //  Name Suffix = *not used
            //  Identification Code Qualifier = SV(Service Provider Number)
            //  Identification Code = 2000035
            loop2000B.Loop2100B.NM1_InformationReceiverName = new NM1_InformationReceiverName_2();
            loop2000B.Loop2100B.NM1_InformationReceiverName.EntityIdentifierCode_01 = "1P";
            loop2000B.Loop2100B.NM1_InformationReceiverName.EntityTypeQualifier_02 = "2";
            loop2000B.Loop2100B.NM1_InformationReceiverName.ResponseContactLastorOrganizationName_03 = "BONE AND JOINT CLINIC";
            loop2000B.Loop2100B.NM1_InformationReceiverName.IdentificationCodeQualifier_08 = "SV";
            loop2000B.Loop2100B.NM1_InformationReceiverName.ResponseContactIdentifier_09 = "2000035";

            //  End 2100B Loop

            //  Repeating 2000C Loops
            loop2000B.Loop2000C = new List();

            //  Begin 2000C Loop 1
            var loop2000C1 = new Loop_2000C_271();

            //  Hierarchical ID Number = 3
            //  Hierarchical Parent ID Number = 2
            //  Hierarchical Level Code = 22(Subscriber)
            //  Hierarchical Child Code = 0
            loop2000C1.HL_SubscriberLevel = new HL_SubscriberHierarchicalLevel();
            loop2000C1.HL_SubscriberLevel.HierarchicalIDNumber_01 = "3";
            loop2000C1.HL_SubscriberLevel.HierarchicalParentIDNumber_02 = "2";
            loop2000C1.HL_SubscriberLevel.HierarchicalLevelCode_03 = "22";
            loop2000C1.HL_SubscriberLevel.HierarchicalChildCode_04 = "0";

            //  Repeating TRN
            loop2000C1.TRN_SubscriberTraceNumber = new List();

            //  Trace Type Code = 2 (Referenced Transaction Trace Number)
            //  Reference Identification = 93175 - 012547
            //  Originating Company Identifier = 9877281234
            //  Reference Identification = *not used
            var trn = new TRN_DependentTraceNumber_2();
            trn.TraceTypeCode_01 = "2";
            trn.CurrentTransactionTraceNumber_02 = "93175-012547";
            trn.OriginatingCompanyIdentifier_03 = "9877281234";
            loop2000C1.TRN_SubscriberTraceNumber.Add(trn);

            //  Begin 2100C Loop
            loop2000C1.Loop2100C = new Loop_2100C_271();

            //  Entity Identifier Code = IL (Insured or Subscriber)
            //  Entity Type Qualifier = 1(Person)
            //  Last Name = Smith
            //  First Name = John
            //  Middle Name = *not used
            //  Name Prefix = *not used
            //  Name Suffix = *not used
            //  Identification Code Qualifier = MI(Member Identification)
            //  Identification Code = 123456789
            loop2000C1.Loop2100C.NM1_SubscriberName = new NM1_SubscriberName();
            loop2000C1.Loop2100C.NM1_SubscriberName.EntityIdentifierCode_01 = "IL";
            loop2000C1.Loop2100C.NM1_SubscriberName.EntityTypeQualifier_02 = "1";
            loop2000C1.Loop2100C.NM1_SubscriberName.ResponseContactLastorOrganizationName_03 = "SMITH";
            loop2000C1.Loop2100C.NM1_SubscriberName.ResponseContactFirstName_04 = "JOHN";
            loop2000C1.Loop2100C.NM1_SubscriberName.IdentificationCodeQualifier_08 = "MI";
            loop2000C1.Loop2100C.NM1_SubscriberName.ResponseContactIdentifier_09 = "123456789";

            //  Address Information = 15197 BROADWAY AVENUE
            //  Address Information = APT 215
            loop2000C1.Loop2100C.N3_SubscriberAddress = new N3_AdditionalPatientInformationContactAddress();
            loop2000C1.Loop2100C.N3_SubscriberAddress.ResponseContactAddressLine_01 = "15197 BROADWAY AVENUE";
            loop2000C1.Loop2100C.N3_SubscriberAddress.ResponseContactAddressLine_02 = "APT 215";

            //  City = KANSAS CITY
            //  State or Prov Code = MO
            //  Postal Code = 64108
            loop2000C1.Loop2100C.N4_SubscriberCity_State_ZIPCode = new N4_AdditionalPatientInformationContactCity();
            loop2000C1.Loop2100C.N4_SubscriberCity_State_ZIPCode.AdditionalPatientInformationContactCityName_01 = "KANSAS CITY";
            loop2000C1.Loop2100C.N4_SubscriberCity_State_ZIPCode.AdditionalPatientInformationContactStateCode_02 = "MO";
            loop2000C1.Loop2100C.N4_SubscriberCity_State_ZIPCode.AdditionalPatientInformationContactPostalZoneorZIPCode_03 = "64108";

            //  Date Time Period Format = D8 (Date Expressed in Format CCYYMMDD)
            //  Date Time Period = 19630519
            //  Gender Code = M(Male)
            loop2000C1.Loop2100C.DMG_SubscriberDemographicInformation = new DMG_DependentDemographicInformation_2();
            loop2000C1.Loop2100C.DMG_SubscriberDemographicInformation.DateTimePeriodFormatQualifier_01 = "D8";
            loop2000C1.Loop2100C.DMG_SubscriberDemographicInformation.DependentBirthDate_02 = "19630519";
            loop2000C1.Loop2100C.DMG_SubscriberDemographicInformation.DependentGenderCode_03 = "M";

            //  Repeating DTP
            loop2000C1.Loop2100C.DTP_SubscriberDate = new List();

            //  Date/Time Qualifier = 346 (Plan Begin)
            //  Date Time Period Format Qualifier D8(Dates Expressed in Format CCYYMMDD)
            //  Date Time Period = 20060101(January 1, 2006)
            var dtp = new DTP_EligibilityOrBenefitDate();
            dtp.DateTimeQualifier_01 = "346";
            dtp.DateTimePeriodFormatQualifier_02 = "D8";
            dtp.DateTimePeriod_03 = "20060101";
            loop2000C1.Loop2100C.DTP_SubscriberDate.Add(dtp);

            //  Repeating 2110C Loops
            loop2000C1.Loop2100C.Loop2110C = new List();

            //  Begin 2110C Loop 1
            var loop2110C1 = new Loop_2110C_271();

            //  Eligibility or Benefit Information Code = 1 (Active Coverage)
            //  Coverage Level Code = *not used
            //  Service Type Code = 30(Health Benefit Plan Coverage)
            //  Insurance Type Code = *not used
            //  Plan Coverage Description = Gold 123 Plan
            loop2110C1.EB_SubscriberEligibilityorBenefitInformation = new EB_SubscriberEligibilityorBenefitInformation();
            loop2110C1.EB_SubscriberEligibilityorBenefitInformation.EligibilityorBenefitInformation_01 = "1";
            loop2110C1.EB_SubscriberEligibilityorBenefitInformation.ServiceTypeCode_03 = new List { "30" };
            loop2110C1.EB_SubscriberEligibilityorBenefitInformation.PlanCoverageDescription_05 = "GOLD 123 PLAN";

            //  End 2110C Loop 1
            loop2000C1.Loop2100C.Loop2110C.Add(loop2110C1);

            //  Begin 2110C Loop 2
            var loop2110C2 = new Loop_2110C_271();

            //  Eligibility or Benefit Information Code = L (Primary Care Provider)
            loop2110C2.EB_SubscriberEligibilityorBenefitInformation = new EB_SubscriberEligibilityorBenefitInformation();
            loop2110C2.EB_SubscriberEligibilityorBenefitInformation.EligibilityorBenefitInformation_01 = "L";

            //  End 2110C Loop 2
            loop2000C1.Loop2100C.Loop2110C.Add(loop2110C2);

            //  Begin 2110C Loop 3
            var loop2110C3 = new Loop_2110C_271();

            //  Eligibility or Benefit Information Code = 1 (Active Coverage)
            //  Coverage Level Code = *not used
            //  Service Type Code = 1(Medical Care)
            //  Service Type Code = 33(Chiropractic)
            //  Service Type Code = 35(Dental Care)
            //  Service Type Code = 47(Hospital)
            //  Service Type Code = 86(Emergency Services)
            //  Service Type Code = 88(Pharmacy)
            //  Service Type Code = 98(Professional(Physician) Visit - Office)
            //  Service Type Code = AL(Vision(Optometry))
            //  Service Type Code = MH(Mental Health)
            //  Service Type Code = UC(Urgent Care)
            loop2110C3.EB_SubscriberEligibilityorBenefitInformation = new EB_SubscriberEligibilityorBenefitInformation();
            loop2110C3.EB_SubscriberEligibilityorBenefitInformation.EligibilityorBenefitInformation_01 = "1";
            loop2110C3.EB_SubscriberEligibilityorBenefitInformation.ServiceTypeCode_03 = new List { "1", "33", "35", "47", "86", "88", "98", "AL", "MH", "UC" };

            //  End 2110C Loop 3
            loop2000C1.Loop2100C.Loop2110C.Add(loop2110C3);

            //  Begin 2110C Loop 4
            var loop2110C4 = new Loop_2110C_271();

            //  Eligibility or Benefit Information Code = B (Co-Payment)
            //  Coverage Level Code = *not used
            //  Service Type Code = 1(Medical Care)
            //  Service Type Code = 33(Chiropractic)
            //  Service Type Code = 35(Dental Care)
            //  Service Type Code = 47(Hospital)
            //  Service Type Code = 86(Emergency Services)
            //  Service Type Code = 88(Pharmacy)
            //  Service Type Code = 98(Professional(Physician) Visit - Office)
            //  Service Type Code = AL(Vision(Optometry))
            //  Service Type Code = MH(Mental Health)
            //  Service Type Code = UC(Urgent Care)
            //  Insurance Type Code = HM (Health Management Organization (HMO))
            //  Plan Coverage Description = GOLD 123 PLAN
            //  Time Period Qualifier = 27(Visit)
            //  Monetary Value = 10(Dollar)
            //  Percent = *not used
            //  Quantity Qualifier = *not used
            //  Quantity = *not used
            //  Yes / No Condition Or Response Code(Certification/ Authorization Indicator) = *not used
            //  Yes / No Condition Or Response Code(In Plan Network Indicator) = Y(Yes – In Network)
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation = new EB_SubscriberEligibilityorBenefitInformation();
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.EligibilityorBenefitInformation_01 = "B";
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.ServiceTypeCode_03 = new List { "1", "33", "35", "47", "86", "88", "98", "AL", "MH", "UC" };
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.InsuranceTypeCode_04 = "HM";
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.PlanCoverageDescription_05 = "GOLD 123 PLAN";
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.TimePeriodQualifier_06 = "27";
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.BenefitAmount_07 = "10";
            loop2110C4.EB_SubscriberEligibilityorBenefitInformation.InPlanNetworkIndicator_12 = "Y";

            //  End 2110C Loop 4
            loop2000C1.Loop2100C.Loop2110C.Add(loop2110C4);

            //  Begin 2110C Loop 5
            var loop2110C5 = new Loop_2110C_271();

            //  Eligibility or Benefit Information Code = B (Co-Payment)
            //  Coverage Level Code = *not used
            //  Service Type Code = 1(Medical Care)
            //  Service Type Code = 33(Chiropractic)
            //  Service Type Code = 35(Dental Care)
            //  Service Type Code = 47(Hospital)
            //  Service Type Code = 86(Emergency Services)
            //  Service Type Code = 88(Pharmacy)
            //  Service Type Code = 98(Professional(Physician) Visit - Office)
            //  Service Type Code = AL(Vision(Optometry))
            //  Service Type Code = MH(Mental Health)
            //  Service Type Code = UC(Urgent Care)
            //  Insurance Type Code = HM (Health Management Organization (HMO))
            //  Plan Coverage Description = GOLD 123 PLAN
            //  Time Period Qualifier = 27(Visit)
            //  Monetary Value = 30(Dollar)
            //  Percent = *not used
            //  Quantity Qualifier = *not used
            //  Quantity = *not used
            //  Yes/No Condition Or Response Code (Certification/Authorization Indicator) = * not used
            //  Yes / No Condition Or Response Code(In Plan Network Indicator) = N(No – Out of Network)
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation = new EB_SubscriberEligibilityorBenefitInformation();
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.EligibilityorBenefitInformation_01 = "B";
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.ServiceTypeCode_03 = new List { "1", "33", "35", "47", "86", "88", "98", "AL", "MH", "UC" };
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.InsuranceTypeCode_04 = "HM";
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.PlanCoverageDescription_05 = "GOLD 123 PLAN";
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.TimePeriodQualifier_06 = "27";
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.BenefitAmount_07 = "30";
            loop2110C5.EB_SubscriberEligibilityorBenefitInformation.InPlanNetworkIndicator_12 = "N";

            //  Begin LS Loop
            loop2110C5.LoopLS = new Loop_LS_271_2();

            //  Loop Identifier Code = 2120
            loop2110C5.LoopLS.LS_Header = new LS_AdditionalReportingCategories();
            loop2110C5.LoopLS.LS_Header.LoopIdentifierCode_01 = "2120";

            //  Repeating 2120C Loops
            loop2110C5.LoopLS.Loop2120C = new List();

            //  Begin 2110C Loop
            var loop2120C = new Loop_2120C_271();

            //  Entity Identifier Code = P3 (Primary Care Provider)
            //  Entity Type Qualifier = 1(Person)
            //  Last Name = Jones
            //  First Name = Marcus
            //  Middle Name = *not used
            //  Name Prefix = *not used
            //  Name Suffix = *not used
            //  Identification Code Qualifier = SV Service Provider Number
            //  Identification Code = 0202034
            loop2120C.NM1_SubscriberBenefitRelatedEntityName = new NM1_DependentBenefitRelatedEntityName();
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.EntityIdentifierCode_01 = "P3";
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.EntityTypeQualifier_02 = "1";
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.ResponseContactLastorOrganizationName_03 = "JONES";
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.ResponseContactFirstName_04 = "MARCUS";
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.IdentificationCodeQualifier_08 = "SV";
            loop2120C.NM1_SubscriberBenefitRelatedEntityName.ResponseContactIdentifier_09 = "0202034";

            //  End 2110C Loop
            loop2110C5.LoopLS.Loop2120C.Add(loop2120C);

            //  Loop Identifier Code = 2120
            loop2110C5.LoopLS.LE_Trailer = new LE_AdditionalReportingCategoriesTermination();
            loop2110C5.LoopLS.LE_Trailer.LoopIdentifierCode_01 = "2120";

            //  End LS Loop

            //  End 2110C Loop 5
            loop2000C1.Loop2100C.Loop2110C.Add(loop2110C5);

            //  End 2100C Loop

            //  End 2000C Loop 1
            loop2000B.Loop2000C.Add(loop2000C1);

            //  End 2000B Loop
            loop2000A.Loop2000B.Add(loop2000B);

            //  End 2000A Loop
            result.Loop2000A.Add(loop2000A);

            return result;
        }
    }
}

More operations in ediFabric .NET

271 questions

How do I read an EB segment?

EB01 is the eligibility or benefit code (1 active coverage, 6 inactive, A co-insurance, B co-payment, C deductible), EB03 the service type code, EB06 the time period and EB07 or EB08 the amount or percent.

Is the 270/271 real time?

Mostly. Eligibility checks usually run as real-time request and response pairs, though batch 270/271 files are also supported.

What if the patient is not found?

The payer returns AAA segments with a reject reason, such as 72 invalid member ID or 75 subscriber not found, instead of EB segments.

How do I parse and generate X12 271 files in .NET, Python, Java and C?

In .NET, install EdiFabric and EdiFabric.Templates.Hipaa, read the file with X12Reader into TS271 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 271 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.

Resources

Parse your first X12 271 in five minutes

The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud with one serial key.

Sign up free Validate EDI files free