Complex Types and Validations

KEY VALIDATION RULES SUMMARY

Date/Time Validation:

  • receiveddate/receivedtime (delivery) must be after NRA submission time
  • receiveddate/receivedtime must be after transferdate/transfertime (if transloading applies)
  • receiveddate/receivedtime must be after transdate/transtime (if transhipment applies)
  • If transfer: transferdate/transfertime must be after NRA submission and before delivery date
  • If transhipment: transdate/transtime must be after NRA submission

Quantity Validation:

  • quantitynet must be > 0.00
  • quantitygross must be >= quantitynet
  • quantitytype: MANDATORY from 01.05.2025 for new goods codes (Order ZMF-237/31.03.2025)

Price Validation:

  • price is MANDATORY and must be > 0.00
  • Currency: BGN until 31.12.2025, EUR from 01.01.2026

Address Validation:

  • Either (street AND numb) OR localaddress must be provided
  • ekatte is ALWAYS REQUIRED

Vehicle Registration:

  • regvehicle: Only uppercase Latin letters (A-Z) and digits (0-9), no spaces
  • Maximum 15 characters

Conditional Requirements:

  • If istransfer = true: transferaddress, transferdate, transfertime, transcarrier become MANDATORY
  • If istranshipment = true: transporttype, transdate, transtime, transaddress become MANDATORY

Complex Types

1. Address Types (address / addressdetailed)

Field Type Required Validation Description (EN)
localaddressstringConditional*maxLength: 100Full local address string
streetstringConditional*maxLength: 100Street name
numbstringConditional*maxLength: 5Street number
ekattestringYESmaxLength: 5, pattern: [0-9]{1,5}EKATTE settlement code

*Conditional Rule: Either (street AND numb) OR localaddress must be provided.


2. Recipient (recipient)

Field Type Required Validation Description (EN)
identbulstatYESminLength: 9, pattern: [0-9]{1,13}Identification number
identtypeidenttypeYES1=Bulstat, 2=PIN, 3=FPN/PN, 5=NRAType of identification number

3. Carrier (carrier / transcarrier)

Must provide EITHER reprperson OR reprfirm (not both)

reprperson (Physical Person):

FieldTypeRequiredValidationDescription
ispersonbooleanYEStrueFlag - Individual person
namestringYESmaxLength: 200Name/Title
egnegnYESlength: 10, pattern: [0-9]{10}Identification number
identtypeegntypeYES2=PIN, 3=FPN/PN, 5=NRA, 6=OtherID type

reprfirm (Legal Entity):

FieldTypeRequiredValidationDescription
isfirmbooleanYEStrueFlag - legal entity
namestringYESmaxLength: 200Name/Title
bulstatvinYESmaxLength: 15, pattern: [A-Z0-9\+\*]{1,15}Identification number
identtypevintypeYES1=Bulstat, 5=NRA, 6=Other, 9=VINID type

3a. Transport Organizer (organizer)

Optional section for person organizing the transport. Must provide EITHER reprperson OR reprfirm (not both)

reprperson (Physical Person):

FieldTypeRequiredValidationDescription
ispersonbooleanYES*trueFlag - Individual person
egnstringYES*length: 10Identification number
namestringYES*maxLength: 200Name
identtypenumericYES*2=EGN, 3=LNCh, 5=NRA, 6=OtherID type

reprfirm (Legal Entity):

FieldTypeRequiredValidationDescription
isfirmbooleanYES*trueFlag - legal entity
bulstatstringYES*maxLength: 15, VIN cannot start with BGIdentification number
namestringYES*maxLength: 200Name
identtypenumericYES*1=EIK, 5=NRA, 6=Other, 9=VINID type

* Required only if organizer section is used


4. Sender/Supplier (cr/rowenum)

FieldTypeRequiredValidationDescription
cridentvinYESpattern: [A-Z0-9\+\*]{1,15}Sender/supplier ID/VIN
cridenttypevintypeYES1=Bulstat, 5=NRA, 6=Other, 9=VINID type
crnamestringYESmaxLength: 200Name/Title
tidentvinNOpattern: [A-Z0-9\+\*]{1,15}Third party ID (triangular)
tidenttypevintypeNO1=Bulstat, 5=NRA, 6=Other, 9=VINThird party ID type
tnamestringNOmaxLength: 200Third party name
countrycountryYESISO 3166-1 alpha-2, 2 charsOrigin country (EU Member State excluding Bulgaria)

5. Goods (goods/rowenum)

FieldTypeRequiredValidationDescription
codestringYESmaxLength: 20Combined Nomenclature commodity code
quantitytypeenumConditional*кг | м2 | брояUnit of measurement
quantitynetdecimalYESfractionDigits: 3, >0Net quantity
quantitygrossdecimalNOfractionDigits: 3, >=quantitynetGross quantity
pricedecimalYESfractionDigits: 2Value of goods in leva
purposeenumYES01-07Purpose code
purposeotherstringConditional*maxLength: 1000Other purpose description

*quantitytype: MANDATORY from 01.05.2025 for goods with new codes (Order ZMF-237)

*purposeother: MANDATORY when purpose = 02 (reclamation) or 06 (other)

Purpose Codes:

CodeDescriptionpurposeother Required
01Delivery of goods (доставка на стока)No
02Reclamation (рекламация на стока)Yes - include protocol number
03Donation (дарение на стока)No
04Processing (обработка на стоката)No
05Warehousing/call-off stock (режим складиране на стока до поискване)No
06Other (друго)Yes
07Transit with transloading (преминаване с претоварни операции)Yes - include UNP

6. Transhipment (transhipment)

FieldTypeRequiredValidationDescription
istranshipmentbooleanYES (in block)true/falseTranshipment flag
transporttypeenumConditional*1=Water, 2=Railway, 3=AirTransport type
transdatedateConditional*xs:dateTranshipment date
transtimestringConditional*maxLength: 5 (HH:MM)Transhipment time
transaddressaddressConditional*See address typeTranshipment address

*Conditional: All fields MANDATORY if istranshipment = true


XML Example

<?xml version="1.0" encoding="WINDOWS-1251"?>
<decHfrImport>
  <part1>
    <recipient>
      <ident>123456789</ident>
      <identtype>1</identtype>
    </recipient>
    <regvehicle>CA1234AB</regvehicle>
    <istransfer>false</istransfer>
    <cr>
      <rowenum>
        <crident>DE123456789</crident>
        <cridenttype>9</cridenttype>
        <crname>German Supplier GmbH</crname>
        <address>
          <rowenum>
            <receivedaddress>
              <localaddress>Industrial Zone</localaddress>
              <ekatte>68134</ekatte>
            </receivedaddress>
            <receiveddate>2026-01-20</receiveddate>
            <goods>
              <rowenum>
                <code>GOODS123</code>
                <quantitynet>100.000</quantitynet>
                <price>2500.00</price>
                <purpose>01</purpose>
              </rowenum>
            </goods>
          </rowenum>
        </address>
      </rowenum>
    </cr>
    <cname>Ivan Petrov</cname>
    <cphone>888123456</cphone>
    <cphonecode>+359</cphonecode>
    <cpemail>[email protected]</cpemail>
    <dname>Maria Ivanova</dname>
    <iscorrect>true</iscorrect>
  </part1>
</decHfrImport>

Document Information: