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.
| Rule | Check |
|---|---|
| Exporter required | Name, address, country must be present |
| Importer required | Name, address, country must be present |
| Line items required | At least one line item |
| Route required | Origin, destination, transport mode |
| Currency required | Must be a valid ISO 4217 code |
2. HS Code Validation
Checks that HS codes exist in the destination country's tariff schedule.
| Rule | Check |
|---|---|
| HS code exists | Code found in destination country's lookup table |
| HS code length | Correct number of digits for the destination (US: 10, EU: 10, India: 8) |
| HS code format | Proper formatting with dots |
3. Sanctions Screening
Checks parties against sanctions lists.
| Rule | Check |
|---|---|
| Exporter screening | Not on OFAC SDN list |
| Importer screening | Not on OFAC SDN list |
| Country screening | Neither origin nor destination is a comprehensively sanctioned country |
4. Port Code Validation
Checks that port codes are valid UN/LOCODE entries.
| Rule | Check |
|---|---|
| Port of loading | Valid UN/LOCODE |
| Port of discharge | Valid UN/LOCODE |
| Port in correct country | Port code matches the declared country |
5. Incoterms Validation
Checks Incoterms compatibility.
| Rule | Check |
|---|---|
| Valid Incoterm | One of the 11 Incoterms 2020 codes |
| Transport mode match | Sea-only terms (FAS, FOB, CFR, CIF) used only with sea transport |
6. Value Consistency
Checks mathematical consistency.
| Rule | Check |
|---|---|
| Total matches line items | Sum of (quantity x unit_price) equals total_value |
| Weights consistent | Total gross weight matches sum of package weights |
| Non-negative values | No negative quantities, prices, or weights |
7. Country-Specific Rules
Rules that apply based on the destination country.
| Country | Rule |
|---|---|
| US | HTS code must be 10 digits |
| EU | EORI number required for importer |
| UK | GB EORI required (not EU EORI) |
| India | IEC required for importer |
8. Document-Specific Rules
Rules that apply based on the requested document types.
| Document | Rule |
|---|---|
| Bill of Lading | Transport mode must be sea |
| Air Waybill | Transport mode must be air |
| Certificate of Origin | Origin country required per line item |
| Dangerous Goods | Hazardous items must have proper classification |