The 820 in HIPAA (005010X218) is the payroll deducted and other group premium payment for insurance products. Employers and plan sponsors use it to pay health plan premiums and to say which members and coverages the payment covers.
BPR carries the payment, TRN its trace number, and ENT loops break the remittance down by organization or individual with RMR segments per premium. Health insurance exchanges use a separate 820 (005010X306) for payments to issuers.
005010X218RA (GS01)TS820 in EdiFabric.Templates.HipaaThe full X12 820 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 15 loops and 41 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 |
|---|---|---|---|
ST | Transaction Set Header | Required | 1 |
BPR | Financial Information | Required | 1 |
TRN | Reassociation Trace Number | Required | 1 |
CUR | Foreign Currency Information | Situational | 1 |
REF | Premium Receivers Identification Key | Situational | >1 |
| Any order | The loops below can appear in any order | Situational | 1 |
DTM | Process Date | Situational | 1 |
DTM | Delivery Date | Situational | 1 |
DTM | Coverage Period | Situational | 1 |
DTM | Creation Date | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 1000A | Premium Receiver Name | Required | 1 |
N1 | Premium Receiver Name | Required | 1 |
N2 | Premium Receiver Additional Name | Situational | 1 |
N3 | Premium Receiver Address | Situational | 1 |
N4 | Premium Receiver City State ZIP Code | Situational | 1 |
RDM | Premium Receiver Remittance Delivery Method | Situational | 1 |
| Loop 1000B | Premium Payer Name | Required | 1 |
N1 | Premium Payer Name | Required | 1 |
N2 | Premium Payer Additional Name | Situational | 1 |
N3 | Premium Payer Address | Situational | 1 |
N4 | Premium Payer City State ZIP Code | Situational | 1 |
PER | Premium Payer Administrative Contact | Situational | >1 |
| Loop 1000C | Intermediary Bank Information | Situational | 14 |
N1 | Intermediary Bank Information | Required | 1 |
N2 | Intermediary Bank Additional Name | Situational | 1 |
N3 | Intermediary Bank Address | Situational | 1 |
N4 | Intermediary Bank City State ZIP Code | Situational | 1 |
PER | Intermediary Bank Administrative Contact | Situational | >1 |
| Any order | The loops below can appear in any order | Situational | 1 |
| Loop 2000A | Organization Summary Remittance | Situational | 1 |
ENT | Organization Summary Remittance | Required | 1 |
| Loop 2200A | Organization Summary Remittance Level Adjustmentfor Previous Payment | Situational | >1 |
ADX | Organization Summary Remittance Level Adjustmentfor Previous Payment | Required | 1 |
| Loop 2300A | Organization Summary Remittance Detail | Required | >1 |
RMR | Organization Summary Remittance Detail | Required | 1 |
REF | Reference Information | Situational | >1 |
DTM | Organizational Coverage Period | Situational | 1 |
| Loop 2310A | Summary Line Item | Situational | 1 |
IT1 | Summary Line Item | Required | 1 |
| Loop 2312A | Service Promotion Allowance Charge Information | Situational | 4 |
SAC | Service Promotion Allowance Charge Information | Required | 1 |
| Loop 2315A | Member Count | Situational | 3 |
SLN | Member Count | Required | 1 |
| Loop 2320A | Organization Summary Remittance Level Adjustmentfor Current Payment | Situational | >1 |
ADX | Organization Summary Remittance Level Adjustmentfor Current Payment | Required | 1 |
| Loop 2000B | Individual Remittance | Situational | 99999999 |
ENT | Individual Remittance | Required | 1 |
| Loop 2100B | Individual Name | Situational | >1 |
NM1 | Individual Name | Required | 1 |
| Loop 2200B | Individual Premium Adjustmentfor Previous Payment | Situational | >1 |
ADX | Individual Premium Adjustmentfor Previous Payment | Required | 1 |
| Loop 2300B | Individual Premium Remittance Detail | Required | >1 |
RMR | Individual Premium Remittance Detail | Required | 1 |
REF | Reference Information | Situational | >1 |
DTM | Individual Coverage Period | Situational | 1 |
| Loop 2320B | Individual Premium Adjustmentfor Current Payment | Situational | >1 |
ADX | Individual Premium Adjustmentfor Current Payment | Required | 1 |
SE | Transaction Set Trailer | Required | 1 |
Usage follows the 005010X218 implementation guide: Required segments must be sent, Situational ones only when the guide's condition applies. Trading partners often add their own rules in companion guides - ediFabric templates can be adjusted to match. Open the element-level definition in the EdiNation spec library.
A premium payment with remittance detail for the covered members. 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*005010X218~ ST*820*0001*005010X218~ BPR*C*19000*C*ACH*CTX*01*999999992*DA*12345678*1030449999**01*199999999*DA*98765*20070516~ TRN*1*12345*1030449999~ REF*14*12345~ N1*PE*DEF HEALTH CARE INC.*FI*012222222~ N1*PR*ABC PLASTICS*FI*123456789~ ENT*1*2L*FI*123456789~ RMR*IK*970501001*PI*16500~ IT1*1~ SLN*1**O*5*IE~ SLN*2**O*75*10~ RMR*IK*970501002*PI*250~ IT1*1~ SLN*1**O*25*IE~ SE*15*0001~ GE*1*101~ IEA*1*000000101~
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": "820",
"TransactionSetControlNumber_02": "0001",
"ImplementationConventionPreference_03": "005010X218"
},
"BPR_FinancialInformation": {
"TransactionHandlingCode_01": "C",
"TotalPremiumPaymentAmount_02": "19000",
"CreditorDebitFlagCode_03": "C",
"PaymentMethodCode_04": "ACH",
"PaymentFormatCode_05": "CTX",
"DepositoryFinancialInstitutionDFIIdentificationNumberQualifier_06": "01",
"OriginatingDepositoryFinancialInstitutionDFIIdentifier_07": "999999992",
"AccountNumberQualifier_08": "DA",
"SenderBankAccountNumber_09": "12345678",
"PayerIdentifier_10": "1030449999",
"DepositoryFinancialInstitutionDFIIdentificationNumberQualifier_12": "01",
"ReceivingDepositoryFinancialInstitutionDFIIdentifier_13": "199999999",
"AccountNumberQualifier_14": "DA",
"ReceiverBankAccountNumber_15": "98765",
"CheckIssueorEFTEffectiveDate_16": "20070516"
},
"TRN_ReassociationTraceNumber": {
"TraceTypeCode_01": "1",
"CurrentTransactionTraceNumber_02": "12345",
"OriginatingCompanyIdentifier_03": "1030449999"
},
"REF_PremiumReceiversIdentificationKey": [
{
"ReferenceIdentificationQualifier_01": "14",
"MemberGrouporPolicyNumber_02": "12345"
}
],
"AllN1": {
"Loop1000A": {
"N1_PremiumReceiver_Name": {
"EntityIdentifierCode_01": "PE",
"PremiumPayerName_02": "DEF HEALTH CARE INC.",
"IdentificationCodeQualifier_03": "FI",
"IntermediaryBankIdentifier_04": "012222222"
}
},
"Loop1000B": {
"N1_PremiumPayer_Name": {
"EntityIdentifierCode_01": "PR",
"PremiumPayerName_02": "ABC PLASTICS",
"IdentificationCodeQualifier_03": "FI",
"IntermediaryBankIdentifier_04": "123456789"
}
}
},
"AllENT": {
"Loop2000A": {
"ENT_OrganizationSummaryRemittance": {
"AssignedNumber_01": "1",
"EntityIdentifierCode_02": "2L",
"IdentificationCodeQualifier_03": "FI",
"ReceiversIndividualIdentifier_04": "123456789"
},
"Loop2300A": [
{
"RMR_OrganizationSummaryRemittanceDetail": {
"ReferenceIdentificationQualifier_01": "IK",
"InsuranceRemittanceReferenceNumber_02": "970501001",
"PaymentActionCode_03": "PI",
"DetailPremiumPaymentAmount_04": "16500"
},
"Loop2310A": {
"IT1_SummaryLineItem": {
"LineItemControlNumber_01": "1"
},
"Loop2315A": [
{
"SLN_MemberCount": {
"LineItemControlNumber_01": "1",
"InformationOnlyIndicator_03": "O",
"HeadCount_04": "5",
"CompositeUnitOfMeasure_05": {
"UnitorBasisforMeasurementCode_01": "IE"
}
}
},
{
"SLN_MemberCount": {
"LineItemControlNumber_01": "2",
"InformationOnlyIndicator_03": "O",
"HeadCount_04": "75",
"CompositeUnitOfMeasure_05": {
"UnitorBasisforMeasurementCode_01": "10"
}
}
}
]
}
},
{
"RMR_OrganizationSummaryRemittanceDetail": {
"ReferenceIdentificationQualifier_01": "IK",
"InsuranceRemittanceReferenceNumber_02": "970501002",
"PaymentActionCode_03": "PI",
"DetailPremiumPaymentAmount_04": "250"
},
"Loop2310A": {
"IT1_SummaryLineItem": {
"LineItemControlNumber_01": "1"
},
"Loop2315A": [
{
"SLN_MemberCount": {
"LineItemControlNumber_01": "1",
"InformationOnlyIndicator_03": "O",
"HeadCount_04": "25",
"CompositeUnitOfMeasure_05": {
"UnitorBasisforMeasurementCode_01": "IE"
}
}
}
]
}
}
]
}
},
"SE": {
"NumberofIncludedSegments_01": "15",
"TransactionSetControlNumber_02": "0001"
}
}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\PaymentOrder.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.Hipaa")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS820>()) { 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("PaymentOrder.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("PaymentOrder.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("PaymentOrder.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 '@PaymentOrder.txt'
Populate a TS820 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 820 file back.
using EdiFabric.Templates.Hipaa5010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS820(); // Beginning of an 820 transaction set, Control number = 0001. transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "820"; transaction.ST.TransactionSetControlNumber_02 = "0001"; transaction.ST.ImplementationConventionPreference_03 = "005010X218"; // ... 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", "005010X218")); 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("PaymentOrder.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("PaymentOrder.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("PaymentOrder.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 '@PaymentOrder.json' \ -o 'PaymentOrder.txt'
005010X218 is used by employers and sponsors to pay group premiums. 005010X306 is used between health insurance exchanges and issuers for exchange-related premium payments.
TRN02 is the trace number that also travels with the funds transfer, and BPR02 is the total amount.
Yes. The 834 enrolls the members, the 820 pays the premiums for them. Both usually come from the same employer or sponsor.
In .NET, install EdiFabric and EdiFabric.Templates.Hipaa, read the file with X12Reader into TS820 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 820 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.