X12 837P Health Care Claim: Professional

The 837P is the HIPAA-mandated EDI transaction a physician, clinic or billing service sends to a payer to bill for professional services - the electronic equivalent of the CMS-1500 paper form.

The payer answers with a 999 acknowledgment for syntax, a 277CA claim acknowledgment for acceptance, and later an 835 remittance advice with the payment. Claims are organized in HL loops: billing provider, subscriber, then patient when the patient is not the subscriber.

At a glance

Standard
X12 HIPAA
Implementation guide
005010X222A1
Functional group
HC (GS01)
Sent by
Provider or billing service to payer or clearinghouse
Responses
999, 277CA, 835
ediFabric .NET template
TS837P in EdiFabric.Templates.Hipaa
OpenEDI definition
View 837P in the spec library

837P structure

The full X12 837P layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 65 loops and 381 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
Any orderThe loops below can appear in any orderRequired1
Loop 1000ASubmitter NameRequired1
NM1Submitter NameRequired1
PERSubmitter EDI Contact InformationRequired2
Loop 1000BReceiver NameRequired1
NM1Receiver NameRequired1
Loop 2000ABilling Provider Hierarchical LevelRequired>1
HLBilling Provider Hierarchical LevelRequired1
PRVBilling Provider Specialty InformationSituational1
CURForeign Currency InformationSituational1
Any orderThe loops below can appear in any orderRequired1
Loop 2010AABilling Provider NameRequired1
NM1Billing Provider NameRequired1
N3Billing Provider AddressRequired1
N4Billing Provider City State ZIP CodeRequired1
Any orderThe loops below can appear in any orderRequired1
REFBilling Provider Tax IdentificationRequired1
REFBilling Provider UPIN License InformationSituational2
PERBilling Provider Contact InformationSituational2
Loop 2010ABPay Address NameSituational1
NM1Pay Address NameRequired1
N3Pay to Address ADDRESSRequired1
N4Pay Address City State ZIP CodeRequired1
Loop 2010ACPay to Plan NameSituational1
NM1Pay to Plan NameRequired1
N3Pay to Plan AddressRequired1
N4Pay to Plan City State ZIP CodeRequired1
Any orderThe loops below can appear in any orderRequired1
REFPay to Plan Secondary IdentificationSituational1
REFPay to Plan Tax Identification NumberRequired1
Loop 2000BSubscriber Hierarchical LevelRequired>1
HLSubscriber Hierarchical LevelRequired1
SBRSubscriber InformationRequired1
PATPatient InformationSituational1
Any orderThe loops below can appear in any orderRequired1
Loop 2010BASubscriber NameRequired1
NM1Subscriber NameRequired1
N3Subscriber AddressSituational1
N4Subscriber City State ZIP CodeSituational1
DMGSubscriber Demographic InformationSituational1
Any orderThe loops below can appear in any orderSituational1
REFSubscriber Secondary IdentificationSituational1
REFPropertyand Casualty Claim NumberSituational1
PERPropertyand Casualty Subscriber Contact InformationSituational1
Loop 2010BBPayer NameRequired1
NM1Payer NameRequired1
N3Payer AddressSituational1
N4Payer City State ZIP CodeSituational1
Any orderThe loops below can appear in any orderSituational1
REFPayer Secondary IdentificationSituational3
REFBilling Provider Secondary IdentificationSituational2
Loop 2300Claim InformationSituational100
CLMClaim InformationRequired1
Any orderThe loops below can appear in any orderSituational1
DTPDate Onsetof Current Illnessor SymptomSituational1
DTPDate Initial Treatment DateSituational1
DTPDate Last Seen DateSituational1
DTPDate Acute ManifestationSituational1
DTPDate AccidentSituational1
DTPDate Last Menstrual PeriodSituational1
DTPDate Last X DateSituational1
DTPDate Hearingand Vision Prescription DateSituational1
DTPDate Disability DatesSituational1
DTPDate Last WorkedSituational1
DTPDate Authorized Returnto WorkSituational1
DTPDate AdmissionSituational1
DTPDate DischargeSituational1
DTPDate Assumedand Relinquished Care DatesSituational2
DTPPropertyand Casualty Dateof First ContactSituational1
DTPDate Repricer Received DateSituational1
PWKClaim Supplemental InformationSituational10
CN1Contract InformationSituational1
AMTPatient Amount PaidSituational1
Any orderThe loops below can appear in any orderSituational1
REFService Authorization Exception CodeSituational1
REFMandatory Medicare Section4081 Crossover IndicatorSituational1
REFMammography Certification NumberSituational1
REFReferral NumberSituational1
REFPrior AuthorizationSituational1
REFPayer Claim Control NumberSituational1
REFClinical Laboratory Improvement Amendment CLIA NumberSituational1
REFRepriced Claim NumberSituational1
REFAdjusted Repriced Claim NumberSituational1
REFInvestigational Device Exemption NumberSituational1
REFClaim Identifier for Transmission IntermediariesSituational1
REFMedical Record NumberSituational1
REFDemonstration Project IdentifierSituational1
REFCare Plan OversightSituational1
K3File InformationSituational10
NTEClaim NoteSituational1
CR1Ambulance Transport InformationSituational1
CR2Spinal Manipulation Service InformationSituational1
Any orderThe loops below can appear in any orderSituational1
CRCAmbulance CertificationSituational3
CRCPatient Condition Information VisionSituational3
CRCHomebound IndicatorSituational1
CRCEPSDT ReferralSituational1
Any orderThe loops below can appear in any orderRequired1
HIHealth Care Diagnosis CodeRequired1
HIAnesthesia Related ProcedureSituational1
HICondition InformationSituational2
HCPClaim Pricing Repricing InformationSituational1
Any orderThe loops below can appear in any orderSituational1
Loop 2310AReferring Provider NameSituational2
NM1Referring Provider NameRequired1
REFReferring Provider Secondary IdentificationSituational3
Loop 2310BRendering Provider NameSituational1
NM1Rendering Provider NameRequired1
PRVRendering Provider Specialty InformationSituational1
REFRendering Provider Secondary IdentificationSituational4
Loop 2310CService Facility Location NameSituational1
NM1Service Facility Location NameRequired1
N3Service Facility Location AddressRequired1
N4Service Facility Location City State ZIP CodeRequired1
REFService Facility Location Secondary IdentificationSituational3
PERService Facility Contact InformationSituational1
Loop 2310DSupervising Provider NameSituational1
NM1Supervising Provider NameRequired1
REFSupervising Provider Secondary IdentificationSituational4
Loop 2310EAmbulance Pick LocationSituational1
NM1Ambulance Pick LocationRequired1
N3Ambulance Pick Location AddressRequired1
N4Ambulance Pick Location City State Zip CodeRequired1
Loop 2310FAmbulance Drop LocationSituational1
NM1Ambulance Drop LocationRequired1
N3Ambulance Drop Location AddressRequired1
N4Ambulance Drop Location City State Zip CodeRequired1
Loop 2320Other Subscriber InformationSituational10
SBROther Subscriber InformationRequired1
CASClaim Level AdjustmentsSituational5
Any orderThe loops below can appear in any orderSituational1
AMTCoordinationof Benefits COB Payer Paid AmountSituational1
AMTCoordinationof Benefits COB Total Non AmountSituational1
AMTRemaining Patient LiabilitySituational1
OIOther Insurance Coverage InformationRequired1
MOAOutpatient Adjudication InformationSituational1
Any orderThe loops below can appear in any orderRequired1
Loop 2330AOther Subscriber NameRequired1
NM1Other Subscriber NameRequired1
N3Other Subscriber AddressSituational1
N4Other Subscriber City State ZIP CodeSituational1
REFOther Subscriber Secondary IdentificationSituational1
Loop 2330BOther Payer NameRequired1
NM1Other Payer NameRequired1
N3Other Payer AddressSituational1
N4Other Payer City State ZIP CodeSituational1
DTPClaim Checkor Remittance DateSituational1
Any orderThe loops below can appear in any orderSituational1
REFOther Payer Secondary IdentifierSituational2
REFOther Payer Prior Authorization NumberSituational1
REFOther Payer Referral NumberSituational1
REFOther Payer Claim Adjustment IndicatorSituational1
REFOther Payer Claim Control NumberSituational1
Loop 2330COther Payer Referring ProviderSituational2
NM1Other Payer Referring ProviderRequired1
REFOther Payer Referring Provider Secondary IdentificationRequired3
Loop 2330DOther Payer Rendering ProviderSituational1
NM1Other Payer Rendering ProviderRequired1
REFOther Payer Rendering Provider Secondary IdentificationRequired3
Loop 2330EOther Payer Service Facility LocationSituational1
NM1Other Payer Service Facility LocationRequired1
REFOther Payer Service Facility Location Secondary IdentificationRequired3
Loop 2330FOther Payer Supervising ProviderSituational1
NM1Other Payer Supervising ProviderRequired1
REFOther Payer Supervising Provider Secondary IdentificationRequired3
Loop 2330GOther Payer Billing ProviderSituational1
NM1Other Payer Billing ProviderRequired1
REFOther Payer Billing Provider Secondary IdentificationRequired2
Loop 2400Service Line NumberRequired50
LXService Line NumberRequired1
SV1Professional ServiceRequired1
SV5Durable Medical Equipment ServiceSituational1
Any orderThe loops below can appear in any orderSituational1
PWKLine Supplemental InformationSituational10
PWKDurable Medical Equipment Certificateof Medical Necessity IndicatorSituational1
CR1Ambulance Transport InformationSituational1
CR3Durable Medical Equipment CertificationSituational1
Any orderThe loops below can appear in any orderSituational1
CRCAmbulance CertificationSituational3
CRCHospice Employee IndicatorSituational1
CRCCondition Indicator Durable Medical EquipmentSituational1
Any orderThe loops below can appear in any orderRequired1
DTPDate Service DateRequired1
DTPDate Prescription DateSituational1
DTPDATE Certification Revision Recertification DateSituational1
DTPDate Begin Therapy DateSituational1
DTPDate Last Certification DateSituational1
DTPDate Last Seen DateSituational1
DTPDate Test DateSituational2
DTPDate Shipped DateSituational1
DTPDate Last X DateSituational1
DTPDate Initial Treatment DateSituational1
Any orderThe loops below can appear in any orderSituational1
QTYAmbulance Patient CountSituational1
QTYObstetric Anesthesia Additional UnitsSituational1
MEATest ResultSituational5
CN1Contract InformationSituational1
Any orderThe loops below can appear in any orderSituational1
REFRepriced Line Item Reference NumberSituational1
REFAdjusted Repriced Line Item Reference NumberSituational1
REFPrior AuthorizationSituational5
REFLine Item Control NumberSituational1
REFMammography Certification NumberSituational1
REFClinical Laboratory Improvement Amendment CLIA NumberSituational1
REFReferring Clinical Laboratory Improvement Amendment CLIA Facility IdentificationSituational1
REFImmunization Batch NumberSituational1
REFReferral NumberSituational5
Any orderThe loops below can appear in any orderSituational1
AMTSales Tax AmountSituational1
AMTPostage Claimed AmountSituational1
K3File InformationSituational10
Any orderThe loops below can appear in any orderSituational1
NTELine NoteSituational1
NTEThird Party Organization NotesSituational1
PS1Purchased Service InformationSituational1
HCPLine Pricing Repricing InformationSituational1
Loop 2410Drug IdentificationSituational1
LINDrug IdentificationRequired1
CTPDrug QuantityRequired1
REFPrescriptionor Compound Drug Association NumberSituational1
Any orderThe loops below can appear in any orderSituational1
Loop 2420ARendering Provider NameSituational1
NM1Rendering Provider NameRequired1
PRVRendering Provider Specialty InformationSituational1
REFRendering Provider Secondary IdentificationSituational20
Loop 2420BPurchased Service Provider NameSituational1
NM1Purchased Service Provider NameRequired1
REFPurchased Service Provider Secondary IdentificationSituational20
Loop 2420CService Facility LocationSituational1
NM1Service Facility LocationRequired1
N3Service Facility Location AddressRequired1
N4Service Facility Location City State ZIP CodeRequired1
REFService Facility Location Secondary IdentificationSituational3
Loop 2420DSupervising Provider NameSituational1
NM1Supervising Provider NameRequired1
REFSupervising Provider Secondary IdentificationSituational20
Loop 2420EOrdering Provider NameSituational1
NM1Ordering Provider NameRequired1
N3Ordering Provider AddressSituational1
N4Ordering Provider City State ZIP CodeSituational1
REFOrdering Provider Secondary IdentificationSituational20
PEROrdering Provider Contact InformationSituational1
Loop 2420FReferring Provider NameSituational2
NM1Referring Provider NameRequired1
REFReferring Provider Secondary IdentificationSituational20
Loop 2420GAmbulance Pick LocationSituational1
NM1Ambulance Pick LocationRequired1
N3Ambulance Pick Location AddressRequired1
N4Ambulance Pick Location City State Zip CodeRequired1
Loop 2420HAmbulance Drop LocationSituational1
NM1Ambulance Drop LocationRequired1
N3Ambulance Drop Location AddressRequired1
N4Ambulance Drop Location City State Zip CodeRequired1
Loop 2430Line Adjudication InformationSituational15
SVDLine Adjudication InformationRequired1
CASLine AdjustmentSituational5
DTPLine Checkor Remittance DateRequired1
AMTRemaining Patient LiabilitySituational1
Loop 2440Form Identification CodeSituational>1
LQForm Identification CodeRequired1
FRMSupporting DocumentationRequired99
Loop 2000CPatient Hierarchical LevelSituational>1
HLPatient Hierarchical LevelRequired1
PATPatient InformationRequired1
Loop 2010CAPatient NameRequired1
NM1Patient NameRequired1
N3Patient AddressRequired1
N4Patient City State ZIP CodeRequired1
DMGPatient Demographic InformationRequired1
Any orderThe loops below can appear in any orderSituational1
REFPropertyand Casualty Claim NumberSituational1
REFPropertyand Casualty Patient IdentifierSituational1
PERPropertyand Casualty Patient Contact InformationSituational1
Loop 2300Claim InformationRequired100
CLMClaim InformationRequired1
Any orderThe loops below can appear in any orderSituational1
DTPDate Onsetof Current Illnessor SymptomSituational1
DTPDate Initial Treatment DateSituational1
DTPDate Last Seen DateSituational1
DTPDate Acute ManifestationSituational1
DTPDate AccidentSituational1
DTPDate Last Menstrual PeriodSituational1
DTPDate Last X DateSituational1
DTPDate Hearingand Vision Prescription DateSituational1
DTPDate Disability DatesSituational1
DTPDate Last WorkedSituational1
DTPDate Authorized Returnto WorkSituational1
DTPDate AdmissionSituational1
DTPDate DischargeSituational1
DTPDate Assumedand Relinquished Care DatesSituational2
DTPPropertyand Casualty Dateof First ContactSituational1
DTPDate Repricer Received DateSituational1
PWKClaim Supplemental InformationSituational10
CN1Contract InformationSituational1
AMTPatient Amount PaidSituational1
Any orderThe loops below can appear in any orderSituational1
REFService Authorization Exception CodeSituational1
REFMandatory Medicare Section4081 Crossover IndicatorSituational1
REFMammography Certification NumberSituational1
REFReferral NumberSituational1
REFPrior AuthorizationSituational1
REFPayer Claim Control NumberSituational1
REFClinical Laboratory Improvement Amendment CLIA NumberSituational1
REFRepriced Claim NumberSituational1
REFAdjusted Repriced Claim NumberSituational1
REFInvestigational Device Exemption NumberSituational1
REFClaim Identifier for Transmission IntermediariesSituational1
REFMedical Record NumberSituational1
REFDemonstration Project IdentifierSituational1
REFCare Plan OversightSituational1
K3File InformationSituational10
NTEClaim NoteSituational1
CR1Ambulance Transport InformationSituational1
CR2Spinal Manipulation Service InformationSituational1
Any orderThe loops below can appear in any orderSituational1
CRCAmbulance CertificationSituational3
CRCPatient Condition Information VisionSituational3
CRCHomebound IndicatorSituational1
CRCEPSDT ReferralSituational1
Any orderThe loops below can appear in any orderRequired1
HIHealth Care Diagnosis CodeRequired1
HIAnesthesia Related ProcedureSituational1
HICondition InformationSituational2
HCPClaim Pricing Repricing InformationSituational1
Any orderThe loops below can appear in any orderSituational1
Loop 2310AReferring Provider NameSituational2
NM1Referring Provider NameRequired1
REFReferring Provider Secondary IdentificationSituational3
Loop 2310BRendering Provider NameSituational1
NM1Rendering Provider NameRequired1
PRVRendering Provider Specialty InformationSituational1
REFRendering Provider Secondary IdentificationSituational4
Loop 2310CService Facility Location NameSituational1
NM1Service Facility Location NameRequired1
N3Service Facility Location AddressRequired1
N4Service Facility Location City State ZIP CodeRequired1
REFService Facility Location Secondary IdentificationSituational3
PERService Facility Contact InformationSituational1
Loop 2310DSupervising Provider NameSituational1
NM1Supervising Provider NameRequired1
REFSupervising Provider Secondary IdentificationSituational4
Loop 2310EAmbulance Pick LocationSituational1
NM1Ambulance Pick LocationRequired1
N3Ambulance Pick Location AddressRequired1
N4Ambulance Pick Location City State Zip CodeRequired1
Loop 2310FAmbulance Drop LocationSituational1
NM1Ambulance Drop LocationRequired1
N3Ambulance Drop Location AddressRequired1
N4Ambulance Drop Location City State Zip CodeRequired1
Loop 2320Other Subscriber InformationSituational10
SBROther Subscriber InformationRequired1
CASClaim Level AdjustmentsSituational5
Any orderThe loops below can appear in any orderSituational1
AMTCoordinationof Benefits COB Payer Paid AmountSituational1
AMTCoordinationof Benefits COB Total Non AmountSituational1
AMTRemaining Patient LiabilitySituational1
OIOther Insurance Coverage InformationRequired1
MOAOutpatient Adjudication InformationSituational1
Any orderThe loops below can appear in any orderRequired1
Loop 2330AOther Subscriber NameRequired1
NM1Other Subscriber NameRequired1
N3Other Subscriber AddressSituational1
N4Other Subscriber City State ZIP CodeSituational1
REFOther Subscriber Secondary IdentificationSituational1
Loop 2330BOther Payer NameRequired1
NM1Other Payer NameRequired1
N3Other Payer AddressSituational1
N4Other Payer City State ZIP CodeSituational1
DTPClaim Checkor Remittance DateSituational1
Any orderThe loops below can appear in any orderSituational1
REFOther Payer Secondary IdentifierSituational2
REFOther Payer Prior Authorization NumberSituational1
REFOther Payer Referral NumberSituational1
REFOther Payer Claim Adjustment IndicatorSituational1
REFOther Payer Claim Control NumberSituational1
Loop 2330COther Payer Referring ProviderSituational2
NM1Other Payer Referring ProviderRequired1
REFOther Payer Referring Provider Secondary IdentificationRequired3
Loop 2330DOther Payer Rendering ProviderSituational1
NM1Other Payer Rendering ProviderRequired1
REFOther Payer Rendering Provider Secondary IdentificationRequired3
Loop 2330EOther Payer Service Facility LocationSituational1
NM1Other Payer Service Facility LocationRequired1
REFOther Payer Service Facility Location Secondary IdentificationRequired3
Loop 2330FOther Payer Supervising ProviderSituational1
NM1Other Payer Supervising ProviderRequired1
REFOther Payer Supervising Provider Secondary IdentificationRequired3
Loop 2330GOther Payer Billing ProviderSituational1
NM1Other Payer Billing ProviderRequired1
REFOther Payer Billing Provider Secondary IdentificationRequired2
Loop 2400Service Line NumberRequired50
LXService Line NumberRequired1
SV1Professional ServiceRequired1
SV5Durable Medical Equipment ServiceSituational1
Any orderThe loops below can appear in any orderSituational1
PWKLine Supplemental InformationSituational10
PWKDurable Medical Equipment Certificateof Medical Necessity IndicatorSituational1
CR1Ambulance Transport InformationSituational1
CR3Durable Medical Equipment CertificationSituational1
Any orderThe loops below can appear in any orderSituational1
CRCAmbulance CertificationSituational3
CRCHospice Employee IndicatorSituational1
CRCCondition Indicator Durable Medical EquipmentSituational1
Any orderThe loops below can appear in any orderRequired1
DTPDate Service DateRequired1
DTPDate Prescription DateSituational1
DTPDATE Certification Revision Recertification DateSituational1
DTPDate Begin Therapy DateSituational1
DTPDate Last Certification DateSituational1
DTPDate Last Seen DateSituational1
DTPDate Test DateSituational2
DTPDate Shipped DateSituational1
DTPDate Last X DateSituational1
DTPDate Initial Treatment DateSituational1
Any orderThe loops below can appear in any orderSituational1
QTYAmbulance Patient CountSituational1
QTYObstetric Anesthesia Additional UnitsSituational1
MEATest ResultSituational5
CN1Contract InformationSituational1
Any orderThe loops below can appear in any orderSituational1
REFRepriced Line Item Reference NumberSituational1
REFAdjusted Repriced Line Item Reference NumberSituational1
REFPrior AuthorizationSituational5
REFLine Item Control NumberSituational1
REFMammography Certification NumberSituational1
REFClinical Laboratory Improvement Amendment CLIA NumberSituational1
REFReferring Clinical Laboratory Improvement Amendment CLIA Facility IdentificationSituational1
REFImmunization Batch NumberSituational1
REFReferral NumberSituational5
Any orderThe loops below can appear in any orderSituational1
AMTSales Tax AmountSituational1
AMTPostage Claimed AmountSituational1
K3File InformationSituational10
Any orderThe loops below can appear in any orderSituational1
NTELine NoteSituational1
NTEThird Party Organization NotesSituational1
PS1Purchased Service InformationSituational1
HCPLine Pricing Repricing InformationSituational1
Loop 2410Drug IdentificationSituational1
LINDrug IdentificationRequired1
CTPDrug QuantityRequired1
REFPrescriptionor Compound Drug Association NumberSituational1
Any orderThe loops below can appear in any orderSituational1
Loop 2420ARendering Provider NameSituational1
NM1Rendering Provider NameRequired1
PRVRendering Provider Specialty InformationSituational1
REFRendering Provider Secondary IdentificationSituational20
Loop 2420BPurchased Service Provider NameSituational1
NM1Purchased Service Provider NameRequired1
REFPurchased Service Provider Secondary IdentificationSituational20
Loop 2420CService Facility LocationSituational1
NM1Service Facility LocationRequired1
N3Service Facility Location AddressRequired1
N4Service Facility Location City State ZIP CodeRequired1
REFService Facility Location Secondary IdentificationSituational3
Loop 2420DSupervising Provider NameSituational1
NM1Supervising Provider NameRequired1
REFSupervising Provider Secondary IdentificationSituational20
Loop 2420EOrdering Provider NameSituational1
NM1Ordering Provider NameRequired1
N3Ordering Provider AddressSituational1
N4Ordering Provider City State ZIP CodeSituational1
REFOrdering Provider Secondary IdentificationSituational20
PEROrdering Provider Contact InformationSituational1
Loop 2420FReferring Provider NameSituational2
NM1Referring Provider NameRequired1
REFReferring Provider Secondary IdentificationSituational20
Loop 2420GAmbulance Pick LocationSituational1
NM1Ambulance Pick LocationRequired1
N3Ambulance Pick Location AddressRequired1
N4Ambulance Pick Location City State Zip CodeRequired1
Loop 2420HAmbulance Drop LocationSituational1
NM1Ambulance Drop LocationRequired1
N3Ambulance Drop Location AddressRequired1
N4Ambulance Drop Location City State Zip CodeRequired1
Loop 2430Line Adjudication InformationSituational15
SVDLine Adjudication InformationRequired1
CASLine AdjustmentSituational5
DTPLine Checkor Remittance DateRequired1
AMTRemaining Patient LiabilitySituational1
Loop 2440Form Identification CodeSituational>1
LQForm Identification CodeRequired1
FRMSupporting DocumentationRequired99
SETransaction Set TrailerRequired1

Usage follows the 005010X222A1 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.

Sample 837P file

One claim with four service lines for a patient who is a dependent of the subscriber. 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*005010X222A1~
ST*837*0021*005010X222A1~
BHT*0019*00*244579*20061015*1023*CH~
NM1*41*2*PREMIER BILLING SERVICE*****46*TGJ23~
PER*IC*JERRY*TE*3055552222*EX*231~
NM1*40*2*KEY INSURANCE COMPANY*****46*66783JJT~
HL*1**20*1~
PRV*BI*PXC*203BF0100Y~
NM1*85*2*BEN KILDARE SERVICE*****XX*9876543210~
N3*234 SEAWAY ST~
N4*MIAMI*FL*33111~
REF*EI*587654321~
NM1*87*2*Kildare Associates~
N3*2345 OCEAN BLVD~
N4*MIAMI*FL*33111~
HL*2*1*22*1~
SBR*P**2222-SJ******CI~
NM1*IL*1*SMITH*JANE****MI*JS00111223333~
DMG*D8*19430501*F~
NM1*PR*2*KEY INSURANCE COMPANY*****PI*999996666~
REF*G2*KA6663~
HL*3*2*23*0~
PAT*19~
NM1*QC*1*SMITH*TED~
N3*236 N MAIN ST~
N4*MIAMI*FL*33413~
DMG*D8*19730501*M~
CLM*26463774*100***11:B:1*Y*A*Y*I~
REF*D9*17312345600006351~
HI*BK:0340*BF:V7389~
LX*1~
SV1*HC:99213*40*UN*1***1~
DTP*472*D8*20061003~
LX*2~
SV1*HC:87070*15*UN*1***1~
DTP*472*D8*20061003~
LX*3~
SV1*HC:99214*35*UN*1***2~
DTP*472*D8*20061010~
LX*4~
SV1*HC:86663*10*UN*1***2~
DTP*472*D8*20061010~
SE*42*0021~
GE*1*101~
IEA*1*000000101~

The same 837P 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": "837",
    "TransactionSetControlNumber_02": "0021",
    "ImplementationConventionPreference_03": "005010X222A1"
  },
  "BHT_BeginningOfHierarchicalTransaction": {
    "HierarchicalStructureCode_01": "0019",
    "TransactionSetPurposeCode_02": "00",
    "SubmitterTransactionIdentifier_03": "244579",
    "TransactionSetCreationDate_04": "20061015",
    "TransactionSetCreationTime_05": "1023",
    "TransactionTypeCode_06": "CH"
  },
  "AllNM1": {
    "Loop1000A": {
      "NM1_SubmitterName": {
        "EntityIdentifierCode_01": "41",
        "EntityTypeQualifier_02": "2",
        "ResponseContactLastorOrganizationName_03": "PREMIER BILLING SERVICE",
        "IdentificationCodeQualifier_08": "46",
        "ResponseContactIdentifier_09": "TGJ23"
      },
      "PER_SubmitterEDIContactInformation": [
        {
          "ContactFunctionCode_01": "IC",
          "ResponseContactName_02": "JERRY",
          "CommunicationNumberQualifier_03": "TE",
          "ResponseContactCommunicationNumber_04": "3055552222",
          "CommunicationNumberQualifier_05": "EX",
          "ResponseContactCommunicationNumber_06": "231"
        }
      ]
    },
    "Loop1000B": {
      "NM1_ReceiverName": {
        "EntityIdentifierCode_01": "40",
        "EntityTypeQualifier_02": "2",
        "ResponseContactLastorOrganizationName_03": "KEY INSURANCE COMPANY",
        "IdentificationCodeQualifier_08": "46",
        "ResponseContactIdentifier_09": "66783JJT"
      }
    }
  },
  "Loop2000A": [
    {
      "HL_BillingProviderHierarchicalLevel": {
        "HierarchicalIDNumber_01": "1",
        "HierarchicalLevelCode_03": "20",
        "HierarchicalChildCode_04": "1"
      },
      "PRV_BillingProviderSpecialtyInformation": {
        "ProviderCode_01": "BI",
        "ReferenceIdentificationQualifier_02": "PXC",
        "ProviderTaxonomyCode_03": "203BF0100Y"
      },
      "AllNM1": {
        "Loop2010AA": {
          "NM1_BillingProviderName": {
            "EntityIdentifierCode_01": "85",
            "EntityTypeQualifier_02": "2",
            "ResponseContactLastorOrganizationName_03": "BEN KILDARE SERVICE",
            "IdentificationCodeQualifier_08": "XX",
            "ResponseContactIdentifier_09": "9876543210"
          },
          "N3_BillingProviderAddress": {
            "ResponseContactAddressLine_01": "234 SEAWAY ST"
          },
          "N4_BillingProviderCity_State_ZIPCode": {
            "AdditionalPatientInformationContactCityName_01": "MIAMI",
            "AdditionalPatientInformationContactStateCode_02": "FL",
            "AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33111"
          },
          "AllREF": {
            "REF_BillingProviderTaxIdentification": {
              "ReferenceIdentificationQualifier_01": "EI",
              "MemberGrouporPolicyNumber_02": "587654321"
            }
          }
        },
        "Loop2010AB": {
          "NM1_Pay_AddressName": {
            "EntityIdentifierCode_01": "87",
            "EntityTypeQualifier_02": "2",
            "ResponseContactLastorOrganizationName_03": "Kildare Associates"
          },
          "N3_Pay_ToAddress_ADDRESS": {
            "ResponseContactAddressLine_01": "2345 OCEAN BLVD"
          },
          "N4_Pay_AddressCity_State_ZIPCode": {
            "AdditionalPatientInformationContactCityName_01": "MIAMI",
            "AdditionalPatientInformationContactStateCode_02": "FL",
            "AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33111"
          }
        }
      },
      "Loop2000B": [
        {
          "HL_SubscriberHierarchicalLevel": {
            "HierarchicalIDNumber_01": "2",
            "HierarchicalParentIDNumber_02": "1",
            "HierarchicalLevelCode_03": "22",
            "HierarchicalChildCode_04": "1"
          },
          "SBR_SubscriberInformation": {
            "PayerResponsibilitySequenceNumberCode_01": "P",
            "InsuredGrouporPolicyNumber_03": "2222-SJ",
            "ClaimFilingIndicatorCode_09": "CI"
          },
          "AllNM1": {
            "Loop2010BA": {
              "NM1_SubscriberName": {
                "EntityIdentifierCode_01": "IL",
                "EntityTypeQualifier_02": "1",
                "ResponseContactLastorOrganizationName_03": "SMITH",
                "ResponseContactFirstName_04": "JANE",
                "IdentificationCodeQualifier_08": "MI",
                "ResponseContactIdentifier_09": "JS00111223333"
              },
              "DMG_SubscriberDemographicInformation": {
                "DateTimePeriodFormatQualifier_01": "D8",
                "DependentBirthDate_02": "19430501",
                "DependentGenderCode_03": "F"
              }
            },
            "Loop2010BB": {
              "NM1_PayerName": {
                "EntityIdentifierCode_01": "PR",
                "EntityTypeQualifier_02": "2",
                "ResponseContactLastorOrganizationName_03": "KEY INSURANCE COMPANY",
                "IdentificationCodeQualifier_08": "PI",
                "ResponseContactIdentifier_09": "999996666"
              },
              "AllREF": {
                "REF_BillingProviderSecondaryIdentification": [
                  {
                    "ReferenceIdentificationQualifier_01": "G2",
                    "MemberGrouporPolicyNumber_02": "KA6663"
                  }
                ]
              }
            }
          },
          "Loop2000C": [
            {
              "HL_PatientHierarchicalLevel": {
                "HierarchicalIDNumber_01": "3",
                "HierarchicalParentIDNumber_02": "2",
                "HierarchicalLevelCode_03": "23",
                "HierarchicalChildCode_04": "0"
              },
              "PAT_PatientInformation": {
                "IndividualRelationshipCode_01": "19"
              },
              "Loop2010CA": {
                "NM1_PatientName": {
                  "EntityIdentifierCode_01": "QC",
                  "EntityTypeQualifier_02": "1",
                  "ResponseContactLastorOrganizationName_03": "SMITH",
                  "ResponseContactFirstName_04": "TED"
                },
                "N3_PatientAddress": {
                  "ResponseContactAddressLine_01": "236 N MAIN ST"
                },
                "N4_PatientCity_State_ZIPCode": {
                  "AdditionalPatientInformationContactCityName_01": "MIAMI",
                  "AdditionalPatientInformationContactStateCode_02": "FL",
                  "AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33413"
                },
                "DMG_PatientDemographicInformation": {
                  "DateTimePeriodFormatQualifier_01": "D8",
                  "DependentBirthDate_02": "19730501",
                  "DependentGenderCode_03": "M"
                }
              },
              "Loop2300": [
                {
                  "CLM_ClaimInformation": {
                    "PatientControlNumber_01": "26463774",
                    "TotalClaimChargeAmount_02": "100",
                    "HealthCareServiceLocationInformation_05": {
                      "FacilityTypeCode_01": "11",
                      "FacilityCodeQualifier_02": "B",
                      "ClaimFrequencyTypeCode_03": "1"
                    },
                    "ProviderorSupplierSignatureIndicator_06": "Y",
                    "AssignmentorPlanParticipationCode_07": "A",
                    "BenefitsAssignmentCertificationIndicator_08": "Y",
                    "ReleaseofInformationCode_09": "I"
                  },
                  "AllREF": {
                    "REF_ClaimIdentifierForTransmissionIntermediaries": {
                      "ReferenceIdentificationQualifier_01": "D9",
                      "MemberGrouporPolicyNumber_02": "17312345600006351"
                    }
                  },
                  "AllHI": {
                    "HI_HealthCareDiagnosisCode": {
                      "HealthCareCodeInformation_01": {
                        "CodeListQualifierCode_01": "BK",
                        "IndustryCode_02": "0340"
                      },
                      "HealthCareCodeInformation_02": {
                        "CodeListQualifierCode_01": "BF",
                        "IndustryCode_02": "V7389"
                      }
                    }
                  },
                  "Loop2400": [
                    {
                      "LX_ServiceLineNumber": {
                        "AssignedNumber_01": "1"
                      },
                      "SV1_ProfessionalService": {
                        "CompositeMedicalProcedureIdentifier_01": {
                          "ProductorServiceIDQualifier_01": "HC",
                          "ProcedureCode_02": "99213"
                        },
                        "LineItemChargeAmount_02": "40",
                        "UnitorBasisforMeasurementCode_03": "UN",
                        "ServiceUnitCount_04": "1",
                        "CompositeDiagnosisCodePointer_07": {
                          "DiagnosisCodePointer_01": "1"
                        }
                      },
                      "AllDTP": {
                        "DTP_Date_ServiceDate": {
                          "DateTimeQualifier_01": "472",
                          "DateTimePeriodFormatQualifier_02": "D8",
                          "DateTimePeriod_03": "20061003"
                        }
                      }
                    },
                    {
                      "LX_ServiceLineNumber": {
                        "AssignedNumber_01": "2"
                      },
                      "SV1_ProfessionalService": {
                        "CompositeMedicalProcedureIdentifier_01": {
                          "ProductorServiceIDQualifier_01": "HC",
                          "ProcedureCode_02": "87070"
                        },
                        "LineItemChargeAmount_02": "15",
                        "UnitorBasisforMeasurementCode_03": "UN",
                        "ServiceUnitCount_04": "1",
                        "CompositeDiagnosisCodePointer_07": {
                          "DiagnosisCodePointer_01": "1"
                        }
                      },
                      "AllDTP": {
                        "DTP_Date_ServiceDate": {
                          "DateTimeQualifier_01": "472",
                          "DateTimePeriodFormatQualifier_02": "D8",
                          "DateTimePeriod_03": "20061003"
                        }
                      }
                    },
                    {
                      "LX_ServiceLineNumber": {
                        "AssignedNumber_01": "3"
                      },
                      "SV1_ProfessionalService": {
                        "CompositeMedicalProcedureIdentifier_01": {
                          "ProductorServiceIDQualifier_01": "HC",
                          "ProcedureCode_02": "99214"
                        },
                        "LineItemChargeAmount_02": "35",
                        "UnitorBasisforMeasurementCode_03": "UN",
                        "ServiceUnitCount_04": "1",
                        "CompositeDiagnosisCodePointer_07": {
                          "DiagnosisCodePointer_01": "2"
                        }
                      },
                      "AllDTP": {
                        "DTP_Date_ServiceDate": {
                          "DateTimeQualifier_01": "472",
                          "DateTimePeriodFormatQualifier_02": "D8",
                          "DateTimePeriod_03": "20061010"
                        }
                      }
                    },
                    {
                      "LX_ServiceLineNumber": {
                        "AssignedNumber_01": "4"
                      },
                      "SV1_ProfessionalService": {
                        "CompositeMedicalProcedureIdentifier_01": {
                          "ProductorServiceIDQualifier_01": "HC",
                          "ProcedureCode_02": "86663"
                        },
                        "LineItemChargeAmount_02": "10",
                        "UnitorBasisforMeasurementCode_03": "UN",
                        "ServiceUnitCount_04": "1",
                        "CompositeDiagnosisCodePointer_07": {
                          "DiagnosisCodePointer_01": "2"
                        }
                      },
                      "AllDTP": {
                        "DTP_Date_ServiceDate": {
                          "DateTimeQualifier_01": "472",
                          "DateTimePeriodFormatQualifier_02": "D8",
                          "DateTimePeriod_03": "20061010"
                        }
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "SE": {
    "NumberofIncludedSegments_01": "42",
    "TransactionSetControlNumber_02": "0021"
  }
}

Parse and validate an 837P 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\ClaimPayment.txt"))
using (var reader = new X12Reader(stream, "EdiFabric.Templates.Hipaa"))
{
    var items = await reader.ReadToEndAsync();
    foreach (var transaction in items.OfType<TS837P>())
    {
        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("ClaimPayment.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("ClaimPayment.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("ClaimPayment.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 '@ClaimPayment.txt'

Generate an 837P file

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

using EdiFabric.Templates.Hipaa5010;

License.SetSerial("YOUR_SERIAL_KEY");

var transaction = new TS837P();

//  Indicates the start of a claim transaction set and assigns a control number.
transaction.ST = new ST();
transaction.ST.TransactionSetIdentifierCode_01 = "837";
transaction.ST.TransactionSetControlNumber_02 = "0001";
transaction.ST.ImplementationConventionPreference_03 = "005010X222A1";

//  Indicates the claim was created on October 15, 2006 and submitter is identified with 244579. 
transaction.BHT_BeginningOfHierarchicalTransaction = new BHT_BeginningOfHierarchicalTransaction_8();
transaction.BHT_BeginningOfHierarchicalTransaction.HierarchicalStructureCode_01 = "0019";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetPurposeCode_02 = "00";
transaction.BHT_BeginningOfHierarchicalTransaction.SubmitterTransactionIdentifier_03 = "244579";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationDate_04 = "20061015";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationTime_05 = "1023";
transaction.BHT_BeginningOfHierarchicalTransaction.TransactionTypeCode_06 = "CH";

//  Occurrence of NM1 Loops in any order
transaction.AllNM1 = new All_NM1_837P_6();

//  Begin 1000A Loop SUBMITTER
transaction.AllNM1.Loop1000A = new Loop_1000A_837P();

// ... 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", "005010X222A1"));
        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("ClaimPayment.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("ClaimPayment.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("ClaimPayment.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 '@ClaimPayment.json' \
-o 'ClaimPayment.txt'

837P questions

What is the difference between the 837P, 837I and 837D?

All three are X12 837 health care claims. The 837P (005010X222A1) bills professional services and replaces the CMS-1500 form. The 837I (005010X223A2) bills institutional services such as hospital stays and replaces the UB-04. The 837D (005010X224A2) bills dental services.

What response does a payer send for an 837P?

A 999 implementation acknowledgment that reports whether the file is syntactically valid, then a 277CA claim acknowledgment that accepts or rejects each claim. Paid and denied claims are reported later in an 835 remittance advice.

How many service lines can one 837P claim have?

Up to 50 service lines (loop 2400) per claim, and up to 12 diagnosis codes in the HI segment. Larger encounters are split into multiple claims.

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

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

Related transactions

Parse your first 837P in five minutes

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