EDI Format Reference
Field mapping tables for all four LEX wire formats — JSON-EDI, XML-EDI, ASC X12 850, and EDIFACT ORDERS. Every format carries an identical data model; only the encoding changes.
Format Overview
LEX is format-agnostic. All four wire formats carry an identical data model — only the encoding differs. For new implementations, use JSON-EDI. X12 850 and EDIFACT ORDERS are legacy bridge formats: the LEX libraries parse them automatically and convert them into a native LEX message, letting existing VAN/DMS/OEM pipelines interop with LEX without rewriting their EDI stack.
JSON-EDI
Structured JSON with the lex root key. Native format for REST, webhook, and cloud-native integrations. Human-readable, direct library support.
Content-Type: application/json
XML-EDI
XML envelope with <lex> root element. Use for SOAP stacks, legacy middleware, and enterprise service buses.
Content-Type: application/xml
ASC X12 850
Supported as an input on-ramp for existing VAN/DMS pipelines. parseX12() converts it to a native LEX message automatically. Not recommended for new builds.
Transaction Set: ST*850
EDIFACT ORDERS
Supported as an input on-ramp for OEM/international EDI systems. parseEdifact() converts it to a native LEX message automatically. Not recommended for new builds.
Message: ALXLDE:D:96A:UN
JSON-EDI
Recommended format for REST, webhook, and cloud-native integrations.
Message Envelope
| JSON Path | Type | Required | Description |
|---|---|---|---|
| lex.version | string | Yes | Spec version — currently 1.0.0 |
| lex.header.messageId | UUID v4 | Yes | Globally unique message identifier. Used for idempotency and deduplication. |
| lex.header.messageType | enum | Yes | LEAD · ASSET · ACKNOWLEDGMENT · SUBSCRIPTION · LEAD_CLOSURE |
| lex.header.timestamp | ISO 8601 | Yes | UTC creation time. Must end with Z. Rejected if older than 7 days. |
| lex.header.senderId | string | Yes | Alphanumeric + hyphens. Identifies the originating organization or system. |
| lex.header.receiverId | string | Yes | Target organization. Use BROADCAST for all subscribers. |
| lex.header.correlationId | UUID v4 | No | References the messageId of a prior message — typically used in ACK and CLOSURE responses. |
LEAD Payload — lex.payload.lead.*
| Field | Type | Required | Notes |
|---|---|---|---|
| leadId | string | Yes | Max 50 chars. Recommended format: LEAD-YYYY-XXXXXX. Must be unique per sender. |
| status | enum | Yes | 15 values: CART · SHOPPING · EXPLORING · TRADE_IN · EXPRESSED_INTEREST · RESERVATION · APPOINTMENT_REQUEST · TEST_DRIVE_REQUESTED · TEST_DRIVE_COMPLETED · IN_NEGOTIATION · ORDER · ORDER_CONFIRMED · IN_DELIVERY · DELIVERED · ARCHIVED |
| source | enum | Yes | RETAILER_WEBSITE · RETAILER_CRM · MANUFACTURER_WEBSITE · THIRD_PARTY_PORTAL · DIRECT_CALL · SHOWROOM · SOCIAL_MEDIA · EMAIL_CAMPAIGN · REFERRAL · OTHER |
| customer.firstName | string | Yes | Max 50 chars. Hyphens and apostrophes allowed. |
| customer.lastName | string | Yes | Max 50 chars. |
| customer.email | string | Cond. | RFC 5322 format. Required unless phone is present. |
| customer.phone | string | Cond. | E.164 format preferred: +13125551234. Required unless email is present. |
| customer.address | object | Yes | Sub-fields: street1 (req) · street2 · city (req) · state · postalCode (req) · country ISO 3166-1 α-2 (req) |
| customer.dateOfBirth | date | No | ISO 8601 date: YYYY-MM-DD. PII — encrypted in transit. |
| customer.preferences | object | No | Contact prefs: preferredContactMethod · preferredContactTime · doNotCall · doNotEmail · doNotText |
| desiredProduct | object | Yes | Asset of interest. See Field Dictionary for asset-class-specific sub-fields. |
| tradeIn | object | No | year · make · model · vin · mileage · condition · estimatedValue · odometerStatus · titleStatus · payoffAmount · payoffCurrency · previousOwnerCount · accidentHistory · vehicleHistoryReport |
| financing | object | No | interestedInFinancing · preferredLoanTerm · downPaymentRange · creditTierPreference |
| customer.creditTier | enum | No | Pre-qualification credit tier. Values: SUPER_PRIME · PRIME · NEAR_PRIME · SUBPRIME · DEEP_SUBPRIME · UNKNOWN |
| customer.fleetBuyer | object | No | Fleet purchase context. Sub-fields: isFleet · fleetSize · unitsToOrder · fleetManagerName · fleetManagerEmail |
| desiredProduct.installedOptions | array | No | Dealer-installed or factory options requested. Each item: name (req) · source · partNumber · estimatedValue. Source enum: FACTORY · DEALER_INSTALLED · AFTERMARKET · OEM_ACCESSORY |
| desiredProduct.factoryOrderPreference | enum | No | Whether buyer prefers in-stock or factory-ordered unit. Values: IN_STOCK_ONLY · FACTORY_ORDER_PREFERRED · FACTORY_ORDER_ONLY · OEM_FACTORY · DEALER_STOCK_PREFERRED · EITHER |
| aviationLead | object | No | Aviation-specific lead context. Sub-fields: operatorCertificate · intendedUse · currentRegistryCountry · targetRegistryCountry. operatorCertificate enum: PART_91 · PART_121 · PART_135 · EASA_AOC · PRIVATE. |
| maritimeLead | object | No | Maritime-specific lead context. Sub-fields: charterType · intendedTradingArea · intendedCargoType. charterType enum: BARE_BOAT · TIME_CHARTER · VOYAGE_CHARTER · DEMISE · NONE. |
| heavyEquipmentLead | object | No | Heavy equipment-specific lead context. Sub-fields: attachmentCouplerStandard · jobSiteAltitude · exportLicenseRequired · exportDestinationCountry. Altitude in metres ASL — used for engine de-rating. |
| realEstateLead | object | No | Real estate-specific lead context. 26 sub-fields including: buyerRepresentationAgreementStatus · exchangeType · preApprovalAmount · contingencies[] · sellerConcessionsRequested · homeWarrantyCoveredBy · occupancyStatus · saleType · firstTimeBuyer · targetClosingDate · buyerAgentLicenseNumber |
| technologyLead | object | No | Technology device/solution-specific lead context. Sub-fields: securityCertificationRequirements[] · evergreenRefreshTrigger · evergreenRefreshThresholdMonths · sustainabilityRequirements[] · conflictMineralsComplianceRequired |
| metadata.expirationDate | ISO 8601 | No | UTC datetime. After this date the lead is auto-transitioned to ARCHIVED. |
| metadata.priority | enum | No | LOW · NORMAL · HIGH · URGENT |
| metadata.customFields | object | No | Freeform key-value map for implementation-specific data (e.g., salesRepId, campaignCode). |
| metadata.compliance | object | No | Global privacy consent records (GDPR, UK GDPR, CCPA, DPDPA, PIPL, LGPD, POPIA, APPI, PDPA-SG, PIPEDA, PIPA-K, PDPL, PDPA-TH, nFADP): consentRecord · gdpr · ukGdpr · ccpa · dpdp · pipl · lgpd · popia · pipeda · pdpaSg · appi · nfadp · pipaKr · pdplSa · pdpaTh |
Minimal Valid Example
{
"lex": {
"version": "1.0.0",
"header": {
"messageId": "550e8400-e29b-41d4-a716-446655440000",
"messageType": "LEAD",
"timestamp": "2026-03-23T14:30:00Z",
"senderId": "DEALER-001",
"receiverId": "MANUFACTURER-ABC"
},
"payload": {
"lead": {
"leadId": "LEAD-2026-001234",
"status": "EXPRESSED_INTEREST",
"source": "RETAILER_WEBSITE",
"customer": {
"firstName": "Jane",
"lastName": "Smith",
"email": "jane.smith@example.com",
"address": {
"street1": "123 Main Street",
"city": "Springfield",
"postalCode": "62701",
"country": "US"
}
},
"desiredProduct": {
"make": "Toyota",
"model": "Camry",
"year": 2026
}
}
}
}
}
XML-EDI
Compatible with SOAP stacks, enterprise service buses, and legacy middleware. Element names mirror JSON field names in PascalCase.
Element Mapping
| XML Element | JSON Equivalent | Required | Notes |
|---|---|---|---|
| <lex version="1.0.0"> | lex.version | Yes | Root element. Version is an XML attribute. |
| <Header><MessageId> | header.messageId | Yes | UUID v4 as text content. |
| <Header><MessageType> | header.messageType | Yes | Enum value as text content. |
| <Header><Timestamp> | header.timestamp | Yes | ISO 8601 UTC — 2026-03-23T14:30:00Z |
| <Header><SenderId> | header.senderId | Yes | |
| <Header><ReceiverId> | header.receiverId | Yes | |
| <Payload><Lead><LeadId> | payload.lead.leadId | Yes | |
| <Lead><Status> | payload.lead.status | Yes | Same enum values as JSON. |
| <Customer><FirstName> | customer.firstName | Yes | |
| <Customer><Email> | customer.email | Cond. | Required unless <Phone> present. Empty element <Email/> treated as absent. |
| <DesiredVehicle> | desiredProduct | Yes | Automotive variant. Use <DesiredAsset> for non-vehicle asset classes. |
| <CustomFields><Field name="…"> | metadata.customFields | No | Key is the name attribute; value is element text content. |
Minimal Valid Example
<?xml version="1.0" encoding="UTF-8"?>
<lex version="1.0.0" xmlns="https://lexstandard.org/schema/1.0">
<Header>
<MessageId>550e8400-e29b-41d4-a716-446655440000</MessageId>
<MessageType>LEAD</MessageType>
<Timestamp>2026-03-23T14:30:00Z</Timestamp>
<SenderId>DEALER-001</SenderId>
<ReceiverId>MANUFACTURER-ABC</ReceiverId>
</Header>
<Payload>
<Lead>
<LeadId>LEAD-2026-001234</LeadId>
<Status>EXPRESSED_INTEREST</Status>
<Source>RETAILER_WEBSITE</Source>
<Customer>
<FirstName>Jane</FirstName>
<LastName>Smith</LastName>
<Email>jane.smith@example.com</Email>
<Address>
<Street1>123 Main Street</Street1>
<City>Springfield</City>
<PostalCode>62701</PostalCode>
<Country>US</Country>
</Address>
</Customer>
<DesiredVehicle>
<Make>Toyota</Make>
<Model>Camry</Model>
<Year>2026</Year>
</DesiredVehicle>
</Lead>
</Payload>
</lex>
ASC X12 850 — Purchase Order
X12 transaction set 850 repurposed for lead exchange. Required for VAN-based EDI pipelines, legacy DMS integrations, and US-market automotive supply chains.
Interchange & Group Envelope
| Segment | Element | LEX Field | Notes |
|---|---|---|---|
| ISA | ISA06 | header.senderId | Left-padded to 15 chars with spaces. |
| ISA | ISA08 | header.receiverId | Left-padded to 15 chars with spaces. |
| ISA | ISA09 / ISA10 | header.timestamp | Date: YYMMDD · Time: HHMM |
| GS | GS01 | — (fixed) | Functional ID code: ALX for LEX messages. |
| ST | ST01 | — (fixed) | Transaction set: 850 |
| ST | ST03 | — (fixed) | Implementation convention: ALX001 |
Transaction Body Segments
| Segment | Qualifier / Element | LEX Field | Notes |
|---|---|---|---|
| BEG | BEG03 | lead.leadId | Purchase order number carries the lead ID. |
| BEG | BEG02 = LE | messageType = LEAD | Order type code LE designates a LEX LEAD message. |
| DTM*137 | DTM02 / DTM03 | header.timestamp | Date qualifier 137 = Creation date. Format 107 = CCYYMMDD:HHMMSS. |
| DTM*039 | DTM02 / DTM03 | metadata.expirationDate | Date qualifier 039 = Expiration date. |
| N1*01 | N102 | header.senderId | Entity code 01 = Sender. |
| N1*SH | N102 | header.receiverId | Entity code SH = Ship-from (receiver in LEX context). |
| NM1*IL | NM103 / NM104 | customer.lastName / firstName | Entity code IL = Individual. NM108=EM for email; NM109=email value. |
| NM1*IL | NM108=TE / NM109 | customer.phone | Communication qualifier TE = Telephone. |
| N3 | N301 / N302 | customer.address.street1 / street2 | Caret ^ separates street1 and street2 within N301. |
| N4 | N401–N404 | city / state / postalCode / country | In order: city, state (2-letter), ZIP, country ISO code. |
| IT1*VC | IT106=VC, IT107=year, IT108=model, IT109=trim | desiredProduct (vehicle) | Product/service qualifier VC = Vehicle. Multiple IT1 lines for multiple trims. |
| IT1*VT | IT106=VT, IT107=year, IT108=model | tradeIn vehicle | Product qualifier VT = Vehicle Trade-in. |
| PID | PID05 | desiredProduct features | Free-form product description per feature. One PID per feature. |
| PRI*01 | PRI02 | financing.downPaymentRange.minUSD | Price qualifier 01 = Minimum price. |
| PRI*02 | PRI02 | financing.downPaymentRange.maxUSD | Price qualifier 02 = Maximum price. |
| REF*LR | REF02 | lead.status | Reference qualifier LR = Lead Reference. Value is the status enum. |
| REF*LS | REF02 | lead.source | Reference qualifier LS = Lead Source. |
| REF*SR | REF02 | metadata.customFields.salesRepId | Reference qualifier SR = Sales Representative ID. |
| REF*PK | REF02 | metadata.customFields.campaignCode | Reference qualifier PK = Promotion / campaign code. |
| MEA*OT*LB | MEA03 | tradeIn.mileage | Measurement qualifier OT = Other, LB = trade-in mileage in this context. |
| SAC*C | SAC05 | financing incentives | Service/accessory code C = Credit. SAC15 carries description (e.g., HYBRID VEHICLE INCENTIVE). |
| CTT | CTT01 | — (control) | Line item count. Must match number of IT1 segments. |
Example Transmission
ISA*00* *00* *01*DEALER *01*MANUFACTURER*260323*143000*^*00001*000000001*0*P*:
GS*ALX*DEALER*MANUFACTURER*20260323*143000*1*X*001
ST*850*0001*ALX001
BEG*00*LE*LEAD-2026-001234**20260323
DTM*137*20260323*143000*107
DTM*039*20260423*143000*107
N1*01*DEALER-001
N1*SH*MANUFACTURER-ABC
NM1*IL*1*DOE*JOHN***JOHN.DOE@EXAMPLE.COM*TE*13125551234
N3*123 MAIN STREET^SUITE 100
N4*SPRINGFIELD*IL*62701*US
IT1**1*EA*0***VC*2026*CAMRY*LE
PID*F****HYBRID
PID*F****LEATHER INTERIOR
PRI*01*25000
PRI*02*35000
REF*LR*EXPRESSED_INTEREST
REF*LS*RETAILER_WEBSITE
REF*SR*SR-456
CTT*1
SE*19*0001
GE*1*1
IEA*1*000000001
EDIFACT ORDERS (ALXLDE)
UN/EDIFACT D:96A ORDERS message adapted for LEX. Required for EU integrations, IATA aviation supply chains, and maritime logistics.
Segment Reference
| Segment | Composite / Element | LEX Field | Notes |
|---|---|---|---|
| UNB | S002 / S003 | senderId / receiverId | Interchange header. Sender in S002.1, receiver in S003.1. |
| UNB | S004 | header.timestamp | Date YYMMDD in S004.1, time HHMM in S004.2. |
| UNH | 0062 | header.messageId | Message reference number — use UUID v4. |
| UNH | S009 | — (fixed) | Message identifier: ALXLDE:D:96A:UN |
| BGM | C002.1 / 1004 | messageType / leadId | Document/message name 350 = LEX LEAD. Document number carries leadId. |
| DTM+137 | C507.2 / C507.3 | header.timestamp | Date/time qualifier 137 = Document/message date/time. Format 102 = CCYYMMDD. |
| DTM+039 | C507.2 | metadata.expirationDate | Date/time qualifier 039 = Expiry date. |
| NAD+BY | C082.1 | header.senderId | Party qualifier BY = Buyer (sender in LEX context). |
| NAD+SH | C082.1 | header.receiverId | Party qualifier SH = Ship-from (receiver in LEX context). |
| NAD+DP | C080 / C059 / 3164 / 3229 / 3251 / 3207 | customer name + address | Party qualifier DP = Delivery party. Name in C080; street in C059; city in 3164; state in 3229; postal in 3251; country in 3207. |
| CTA+OC | C056.3056 | customer contact name | Contact function qualifier OC = Order contact. |
| COM+EM | C076.3148 | customer.email | Communication channel qualifier EM = Electronic mail. |
| COM+TE | C076.3148 | customer.phone | Communication channel qualifier TE = Telephone. |
| RFF+ST | C506.1154 | lead.status | Reference qualifier ST = Lead Status (LEX extension). Value is status enum. |
| RFF+LS | C506.1154 | lead.source | Reference qualifier LS = Lead Source (LEX extension). |
| LIN | C212 qualifier VC | desiredProduct (vehicle) | Line item. Qualifier VC = Vehicle, elements: year:make:model:trim. |
| LIN | C212 qualifier VT | tradeIn vehicle | Qualifier VT = Vehicle Trade-in. |
| IMD+F+*** | C273.7008 | desiredProduct features | Item description. Qualifier F = Free form text. Append :NEG to denote excluded feature. |
| PRI+INV | C509.5118 | priceRange.minUSD | Price qualifier INV = Invoice (minimum price). PRI+MAX for maximum price. |
| MEA+OT+94 | C174.6314 | tradeIn.mileage | Measurement qualifier OT = Other, value qualifier 94 = Kilometres (KT) or miles. |
Example Transmission
UNA:*+,? '
UNB+IATB:1+DEALER-001+MANUFACTURER-ABC+260323:143000+000000001'
UNH+550e8400-e29b-41d4-a716-446655440000+ALXLDE:D:96A:UN'
BGM+350+LEAD-2026-001234+9'
DTM+137:20260323:102'
DTM+039:20260423:102'
NAD+BY+DEALER-001++DEALER 001'
NAD+SH+MANUFACTURER-ABC++MANUFACTURER ABC'
NAD+DP+JANE SMITH+123 MAIN STREET,SUITE 100+SPRINGFIELD+IL+62701+US'
CTA+OC+JANE SMITH'
COM+JANE.SMITH@EXAMPLE.COM:EM'
COM++13125559876:TE'
RFF+ST:EXPRESSED_INTEREST'
RFF+LS:RETAILER_WEBSITE'
LIN+1++VC:2026:CAMRY:LE'
IMD+F+***HYBRID'
IMD+F+***LEATHER INTERIOR'
PRI+INV+25000'
PRI+MAX+35000'
UNT+17+550e8400-e29b-41d4-a716-446655440000'
UNZ+1+000000001'
Cross-Format Field Map
Quick-reference for mapping the same conceptual field across all four wire formats.
| LEX Field | JSON-EDI | XML-EDI | X12 850 | EDIFACT |
|---|---|---|---|---|
| Envelope | ||||
| Message ID | header.messageId | <MessageId> | ISA13 (control #) | UNH 0062 |
| Timestamp | header.timestamp | <Timestamp> | DTM*137 | DTM+137 |
| Sender | header.senderId | <SenderId> | ISA06 / N1*01 | UNB S002 / NAD+BY |
| Receiver | header.receiverId | <ReceiverId> | ISA08 / N1*SH | UNB S003 / NAD+SH |
| Lead Identity | ||||
| Lead ID | payload.lead.leadId | <LeadId> | BEG03 | BGM 1004 |
| Status | payload.lead.status | <Status> | REF*LR | RFF+ST |
| Source | payload.lead.source | <Source> | REF*LS | RFF+LS |
| Expiry | metadata.expirationDate | <ExpirationDate> | DTM*039 | DTM+039 |
| Customer | ||||
| First Name | customer.firstName | <FirstName> | NM1*IL NM104 | NAD+DP C080 |
| customer.email | <Email> | NM1 NM108=EM | COM+EM | |
| Phone | customer.phone | <Phone> | NM1 NM108=TE | COM+TE |
| Street | customer.address.street1 | <Street1> | N3 N301 | NAD+DP C059 |
| City | customer.address.city | <City> | N4 N401 | NAD+DP 3164 |
| Postal Code | customer.address.postalCode | <PostalCode> | N4 N403 | NAD+DP 3251 |
| Asset of Interest | ||||
| Make / Brand | desiredProduct.make | <Make> | IT1 IT107 (after VC) | LIN C212 element 2 |
| Model | desiredProduct.model | <Model> | IT1 IT108 | LIN C212 element 3 |
| Year | desiredProduct.year | <Year> | IT1 IT106 | LIN C212 element 1 |
| Features | desiredProduct.desiredFeatures[] | <Feature> (repeating) | PID*F (one per feature) | IMD+F+*** (one per feature) |
| Installed Options | desiredProduct.installedOptions[] | <InstalledOption> (repeating) | PID*F qualifier OI (one per option) | IMD+F+OI (one per option) |
| Factory Order Pref. | desiredProduct.factoryOrderPreference | <FactoryOrderPreference> | REF*FO | RFF+FO |
| Customer Extended | ||||
| Credit Tier | customer.creditTier | <CreditTier> | REF*CT | RFF+CT |
| Fleet Buyer | customer.fleetBuyer | <FleetBuyer> | REF*FB / QTY*001 (fleet size) | RFF+FB / QTY+1 (fleet size) |
| Trade-In Extended | ||||
| Odometer Status | tradeIn.odometerStatus | <OdometerStatus> | REF*OS | RFF+OS |
| Title Status | tradeIn.titleStatus | <TitleStatus> | REF*TS | RFF+TS |
| Payoff Amount | tradeIn.payoffAmount | <PayoffAmount> | PRI*PA | PRI+PA |
| Accident History | tradeIn.accidentHistory | <AccidentHistory> | REF*AH (count) + REF*AD (airbag) | RFF+AH (count) + RFF+AD (airbag) |
| Industry Context (JSON-EDI native; X12 & EDIFACT use REF/RFF segments with LEX-defined qualifiers) | ||||
| Aviation Context | aviationLead | <AviationLead> | REF*AV (operatorCert) + REF*IU (intendedUse) | RFF+AV · RFF+IU |
| Maritime Context | maritimeLead | <MaritimeLead> | REF*MC (charterType) + REF*TA (tradingArea) | RFF+MC · RFF+TA |
| Heavy Equip. Context | heavyEquipmentLead | <HeavyEquipmentLead> | REF*AC (couplerStd) + MEA*OT*ALT (altitude) | RFF+AC · MEA+OT+ALT |
| Real Estate Context | realEstateLead | <RealEstateLead> | REF*RA (repAgreement) + REF*EX (exchangeType) + REF*PA (preApproval) | RFF+RA · RFF+EX · RFF+PA |
| Technology Context | technologyLead | <TechnologyLead> | REF*SC (secCert) + REF*ER (evergreenTrigger) | RFF+SC · RFF+ER |
| Custom Fields | ||||
| Campaign Code | metadata.customFields.campaignCode | <Field name="campaignCode"> | REF*PK | RFF+CP |
| Sales Rep ID | metadata.customFields.salesRepId | <Field name="salesRepId"> | REF*SR | RFF+SR |
Related Resources
Industry Examples
Full end-to-end examples across automotive, aviation, maritime, heavy equipment, real estate, and technology.
examples.html →
Getting Started
Library installation, first message, validation, and sending — with code in JS, Python, Java, and C#.
getting-started.html →
OpenAPI 3.1
Machine-readable REST API definition — import into Postman, Swagger UI, or any OpenAPI tool.
api/lex-openapi.yaml ↗