Skip to main content

Validation Rules Reference

Klervex validates shipments against 8 categories of deterministic business rules.

How Validation Works

Validation is:

  • Deterministic — Same data always produces the same result
  • Instant — Under 1 second
  • Explainable — Every failure includes a specific, actionable message
  • Based on lookup tables — HS codes, sanctions, port codes are real reference data

Categories

1. Required Fields

Checks that mandatory fields are present based on the requested document types.

RuleCheck
Exporter requiredName, address, country must be present
Importer requiredName, address, country must be present
Line items requiredAt least one line item
Route requiredOrigin, destination, transport mode
Currency requiredMust be a valid ISO 4217 code

2. HS Code Validation

Checks that HS codes exist in the destination country's tariff schedule.

RuleCheck
HS code existsCode found in destination country's lookup table
HS code lengthCorrect number of digits for the destination (US: 10, EU: 10, India: 8)
HS code formatProper formatting with dots

3. Sanctions Screening

Checks parties against sanctions lists.

RuleCheck
Exporter screeningNot on OFAC SDN list
Importer screeningNot on OFAC SDN list
Country screeningNeither origin nor destination is a comprehensively sanctioned country

4. Port Code Validation

Checks that port codes are valid UN/LOCODE entries.

RuleCheck
Port of loadingValid UN/LOCODE
Port of dischargeValid UN/LOCODE
Port in correct countryPort code matches the declared country

5. Incoterms Validation

Checks Incoterms compatibility.

RuleCheck
Valid IncotermOne of the 11 Incoterms 2020 codes
Transport mode matchSea-only terms (FAS, FOB, CFR, CIF) used only with sea transport

6. Value Consistency

Checks mathematical consistency.

RuleCheck
Total matches line itemsSum of (quantity x unit_price) equals total_value
Weights consistentTotal gross weight matches sum of package weights
Non-negative valuesNo negative quantities, prices, or weights

7. Country-Specific Rules

Rules that apply based on the destination country.

CountryRule
USHTS code must be 10 digits
EUEORI number required for importer
UKGB EORI required (not EU EORI)
IndiaIEC required for importer

8. Document-Specific Rules

Rules that apply based on the requested document types.

DocumentRule
Bill of LadingTransport mode must be sea
Air WaybillTransport mode must be air
Certificate of OriginOrigin country required per line item
Dangerous GoodsHazardous items must have proper classification