EDI Envelopes (ISA/GS/ST) and Control Numbers: Stopping Duplicates
For edi and integration analysts, it leads at shippers, 3pls and carriers · Compare approaches

EDI Envelopes (ISA/GS/ST) and Control Numbers: Stopping Duplicates: Illustrative TMS–ERP order and invoice handoff review beside a warehouse floor; not a client facility.
Quick answer: edi isa gs envelope control numbers
X12 envelope control numbers stop duplicates at three levels: ISA13 per trading partner pair, GS06 per functional group and ST02 within each group. Key the interchange check on ISA05 to ISA08, ISA15 and ISA13 over a written window, then hold any document whose business number and body hash match an accepted one, because retries often arrive re-wrapped.
TL;DR — what you’ll learn
- X12.5 section 5.1.2 bars reusing an interchange control number between a partner pair within an agreed window, so the window in days belongs in the trading partner agreement.
- Without an agreed window, X12's RFI 1646 says a receiver may not reject a group solely because GS06 repeats; ST02 needs only be unique inside its group.
- Retry jobs that re-run the map send identical content under new ISA13 and GS06 values, which an envelope-only check accepts; a business number plus SHA-256 body hash catches them.
- In the illustrative case, a business-key layer saves a US shipper $34,589 a year on 96,000 freight invoices and an Indian 3PL ₹9,98,400 on 52,000 shipping orders.
Topics: edi isa gs envelope control numbers · control-number sequencing · edi duplicate detection · isa interchange id qualifiers · isa13 interchange control number
All quantities, amounts, product codes and events are illustrative teaching examples.
A carrier's AS2 server misses an acknowledgment at two in the morning, re-runs its translator and sends the same freight invoice again under a fresh interchange number. The shipper's duplicate check looks only at that number, finds nothing wrong, and freight payment settles the bill twice. Nobody notices until the carrier statement shows a credit balance six weeks later.
Envelope control numbers can stop most of that, but only if both sides agree what each counter means, how long it must stay unique and which business key sits behind it. Set up correctly, the ISA, GS and ST counters reject true replays at the translator, and a second key on invoice, order or shipment number catches resends that arrive in new envelopes.
- What follows: the three counters and their scope, the qualifiers that define whose counter is checked, X12's own interpretations on uniqueness, the routes duplicates take, and what each one breaks downstream.
- Build material: a resent 210 interchange next to a ledger table that rejects it, a worked loss and payback in USD ($) and INR (₹), and a go-live checklist for control-number hygiene.
Three envelopes, three counters: ISA13, GS06 and ST02 in practice
Each X12 envelope level carries its own control number, and each answers a different question. ISA13 identifies the whole interchange between two parties, GS06 identifies one functional group of like documents, and ST02 identifies a single document inside that group.
The trailer repeats each header's number so a receiver can prove the envelope arrived whole: IEA02 echoes ISA13, GE02 echoes GS06 and SE02 echoes ST02. Counts travel in the trailers too. IEA01 states how many groups the interchange holds, GE01 how many transaction sets the group holds, and SE01 how many segments the set holds, counting ST and SE themselves.
Scroll horizontally to see all columns.
| Envelope level | Header number | Trailer echo | Trailer count | Size in a published retail spec |
|---|---|---|---|---|
| Interchange (ISA to IEA) | ISA13 | IEA02 | IEA01, number of functional groups | Nine digits, fixed |
| Functional group (GS to GE) | GS06 | GE02 | GE01, number of transaction sets | One to nine digits |
| Transaction set (ST to SE) | ST02 | SE02 | SE01, segments from ST to SE | Four to nine characters |
Sizes in the table come from a large US grocer's published envelope specification, which mirrors the X12 dictionary. The interchange header also carries ISA14, set to 1 when the sender wants a TA1 interchange acknowledgment, and ISA15, which marks the file as test (T) or production (P). Both matter for duplicates, as the later sections show.
Sender and receiver qualifiers decide whose counter is checked
An interchange number means nothing on its own; it is unique only within a pair of trading partners. The pair is defined by ISA05 and ISA06 for the sender and ISA07 and ISA08 for the receiver, so a change to any of those four fields quietly starts a new counter history.
ISA05 and ISA07 are qualifiers that say what kind of identifier follows. Common values include 01 for a DUNS number, 08 for a UCC EDI Communications ID, 12 for a telephone number and ZZ for a mutually defined code. ISA06 and ISA08 are fixed at fifteen characters, padded with trailing spaces.
- Qualifier change at migration: a partner moving from ZZ to 01 after a VAN switch looks like a brand-new sender, so every old ISA13 becomes acceptable again.
- Trimmed padding: a mapping tool that trims ISA06 to eleven characters creates a second key for the same partner in some translators.
- Shared receiver IDs: a shipper using one ISA08 for several business units must decide whether duplicates are checked per unit or across the whole ID.
- Test and production overlap: if ISA15 is not part of the duplicate key, a test file numbered 000000341 blocks the production file with the same number.
What X12 says about how long a control number stays unique
X12 sets the scope of uniqueness but leaves the time window to the trading partners. The window must therefore be written into the trading partner agreement, or a receiver has weak grounds to reject on a repeated number.
X12's published interpretations are explicit. RFI 2532, citing section 5.1.2 of the Interchange Control Structure standard X12.5, says an interchange control number shall not be reused between a trading partner pair within a mutually agreed time frame. RFI 1646, quoting section 3.9.1 of X12.6, requires GS01, GS02, GS03 and GS06 together to be unique within a time frame defined by trading partner agreement.
X12 envelope duplicate checks must key on the sender and receiver qualifier-ID pair plus ISA13, because X12.5 section 5.1.2 bars reuse of an interchange control number between a trading partner pair within an agreed window; a 90-day window covers most carrier invoice dispute cycles without exhausting a nine-digit counter.
The same RFI 1646 answer adds a limit that surprises many receivers: without an agreed window, a receiver may not reject a functional group solely because GS06 repeats. For transaction sets, RFI 1139 confirms that X12 requires ST02 to be unique only within its functional group, while some implementation guides choose a wider scope.
- ISA13 scope: unique per trading partner pair, for the window in the agreement.
- GS06 scope: unique for the combination of functional ID, sender code and receiver code, for the agreed window.
- ST02 scope: unique inside the group; repeating 0001 in every group is legal X12.
- Agreement clause: state the window in days, the key fields and the response, such as reject with a TA1 or hold for review.
The RFI 2532 scenario is worth reading closely. A partner split a multi-document file into several files and copied the original ISA header onto each, so every split file carried the same ISA13. X12's answer treats that as reuse. A receiver that dropped the second file as a duplicate was enforcing the standard, and the data loss belonged to the splitter.
How duplicates get in: resends, splitters and restored counters
True duplicates arrive by two routes: the same bytes delivered twice, or the same business document wrapped in a new envelope. Envelope keys catch the first route; only a business key catches the second, which is the more common and more expensive one.
- Transport redelivery: a VAN mailbox recovery or an AS2 retry resends identical bytes; ISA13 repeats and the envelope check works.
- Re-translation on retry: the sender's job reruns the map after a timeout, so the content repeats under a new ISA13 and GS06.
- Header-copying splitter: the RFI 2532 pattern, where distinct content shares one ISA13 and good data is rejected.
- Counter restored from backup: the sender's control store rolls back a week, so new documents reuse numbers the receiver has already accepted.
- Manual resend from a portal: an analyst re-uploads last month's file to "fix" a missing invoice, inside or outside the window.
The trace below follows the second route through a shipper's freight payment flow. Times, numbers and amounts are illustrative; the failure pattern is common wherever duplicate checking stops at the envelope.
- 02:14 first send: the carrier transmits interchange 000418277 holding one 210 for PRO 7734-2210 at $4,862.50; the shipper's AS2 endpoint stores it and returns an MDN.
- 02:19 timeout: the MDN reaches the carrier after its 300-second wait expired, so the carrier marks the send failed.
- 02:20 re-translation: the carrier's retry job re-runs the map instead of resending the stored file, producing interchange 000418278, group 418278 and the same invoice body.
- 02:21 accepted twice: the shipper's translator checks sender plus ISA13, finds both new, and routes them to freight payment batches FP-1112-031 and FP-1112-032.
- 09:30 paid twice: automated audit approves both within tolerance, and payment run PR-2026-1114 pays $9,725.00 for one shipment.
With a business key in place, the second 210 is held at step 4. The rule matches carrier SCAC, invoice number and amount against open and paid invoices, and a hash of the transaction body, computed without the envelope, proves the content is identical. The duplicate is rejected and reported to the carrier the same morning.
What a duplicate does in the warehouse, freight audit and tax ledger
The same envelope fault lands differently in each function. A warehouse ships twice, freight audit pays twice, and the ledger carries two liabilities or, in India, two tax invoices. Knowing the downstream effect tells you where the business-key check must sit.
Scroll horizontally to see all columns.
| Envelope fault | What the translator sees | Warehouse effect | Freight audit effect | Ledger and tax effect |
|---|---|---|---|---|
| Same content, new ISA13 and GS06 | Two valid interchanges | Second 940 creates a second pick wave | Second 210 paid unless held | Duplicate payable or second tax invoice |
| New content, reused ISA13 | Duplicate interchange; second rejected | Orders in the second file never released | Valid invoices missing; carrier chases payment | Accrual without matching invoice at close |
| Test file (ISA15 = T) sent to production | Valid unless ISA15 is checked | Phantom orders on the pick list | Test invoices queued for payment | Postings that need reversal |
| Qualifier changed in ISA05 or ISA07 | New partner key; history reset | Old orders can re-enter as new | Old invoices can re-enter as new | Duplicates escape the envelope check |
| ST02 repeated inside one group | Invalid under X12; set rejected in the 997 | One order missing from the wave | One invoice missing from the batch | Late posting; possible late-payment terms |
| SE01 or GE01 count wrong | Structural error | Whole group can be rejected | Whole batch can be rejected | Period cutoff at risk |
For the related problem of a carrier issuing a revised invoice rather than a resend, see duplicate freight invoice detection, which separates legitimate revisions from repeats using shipment scope and credit history. That article starts after the document is accepted; this one is about the gate in front of it.
Layered duplicate checks: envelope keys first, business keys second
Run two checks in sequence. The translator rejects a repeated ISA13 for the same partner pair and usage indicator inside the agreed window, then middleware holds any transaction whose business key and content hash match one already accepted, whatever its envelope numbers say.
The block below shows the resent interchange from the trace and a ledger design that would have stopped it. Identifiers are padded to fifteen characters as the ISA requires; the invoice detail segments are omitted for space. The SQL is generic and should be adapted to your database.
-- Interchange as first received (210 detail segments not shown)
ISA*00* *00* *ZZ*CARRIERX210 *ZZ*SHIPPERFAP *261112*0214*U*00401*000418277*1*P*>~
GS*IM*CARRIERX210*SHIPPERFAP*20261112*0214*418277*X*004010~
ST*210*0001~
SE*14*0001~
GE*1*418277~
IEA*1*000418277~
-- Same invoice after the carrier's retry job re-ran the map
ISA*00* *00* *ZZ*CARRIERX210 *ZZ*SHIPPERFAP *261112*0220*U*00401*000418278*1*P*>~
GS*IM*CARRIERX210*SHIPPERFAP*20261112*0220*418278*X*004010~
-- Layer 1: envelope ledger, unique per partner pair, usage and ISA13
CREATE TABLE edi_interchange_ledger (
sender_qual CHAR(2) NOT NULL,
sender_id CHAR(15) NOT NULL,
receiver_qual CHAR(2) NOT NULL,
receiver_id CHAR(15) NOT NULL,
usage_ind CHAR(1) NOT NULL, -- ISA15: T or P
isa13 CHAR(9) NOT NULL,
received_at TIMESTAMP NOT NULL,
PRIMARY KEY (sender_qual, sender_id, receiver_qual, receiver_id, usage_ind, isa13)
);
-- Layer 2: business-key ledger, independent of envelope numbers
CREATE TABLE edi_document_ledger (
partner_key VARCHAR(40) NOT NULL, -- e.g. carrier SCAC
set_id CHAR(3) NOT NULL, -- 210, 940, 810
business_doc_no VARCHAR(30) NOT NULL, -- invoice, order or shipment number
body_sha256 CHAR(64) NOT NULL, -- hash of ST..SE without envelope
amount_minor BIGINT, -- 486250 for $4,862.50
status VARCHAR(12) NOT NULL, -- ACCEPTED, HELD, REJECTED
UNIQUE (partner_key, set_id, business_doc_no, body_sha256)
);
-- Decision for an incoming set:
-- same key and same hash -> reject as duplicate, notify partner
-- same key, different hash -> hold as possible revision for review
-- new key -> accept
Freight payment teams receiving X12 210 invoices should hold any transaction whose carrier SCAC, invoice number and SHA-256 body hash match an accepted invoice, regardless of ISA13 or GS06, because retry jobs re-wrap identical content; in the worked case that rule removed 48 duplicate payments a year worth $110,880.
Hash the transaction body only after normalising it: strip the ST02 and SE02 values, which change with every wrap, and keep everything else byte for byte. A carrier that sends a corrected weight produces a different hash under the same invoice number, which correctly lands in review rather than rejection.
When the sender asked for a TA1 by setting ISA14 to 1, an envelope-level rejection should go back as a TA1 with note code 025, duplicate interchange control number, as listed in Microsoft's X12 TA1 error-code table. Business-key holds happen after acknowledgment, so they are reported through your partner portal or an application advice, not the TA1.
Generating control numbers on the sending side without gaps or reuse
Outbound counters belong in a durable store that is written before the file leaves, kept per partner pair and usage indicator, and excluded from any routine restore. Most receiver-side duplicate incidents begin as sender-side counter mistakes.
- Commit before transmit: increment and save the counter, then build and send the file, so a crash can create a gap but never a reuse.
- One counter per pair: keep separate ISA13 sequences for each partner pair and for test and production.
- Resend, never re-translate: a retry should send the stored bytes with their original numbers, so the receiver's envelope check recognises the repeat.
- Restore guard: after any database restore, set each counter to the highest number found in the outbound archive plus one.
- Rollover rule: a nine-digit ISA13 wraps after 999,999,999; agree in writing whether to restart at 1 and confirm the partner's window has long expired.
- Gap monitor: report daily any gap or backward step in each partner's inbound sequence; a backward step usually means the partner restored a backup.
Ownership of these settings is often unclear because they sit between IT, EDI operations and the business teams that feel the consequences. The table assigns each one.
Scroll horizontally to see all columns.
| Setting or decision | Where it lives | Maintained by | Approved by |
|---|---|---|---|
| Outbound ISA13 and GS06 counters | Translator control-number store | EDI operations | Integration manager |
| Inbound duplicate window per partner | Partner profile, from the trading partner agreement | EDI analyst | Integration manager and partner's EDI contact |
| ISA05 to ISA08 identity values | Partner profile | EDI analyst | Both partners in writing before go-live |
| Business key per transaction set | Middleware rule | Integration developer | Process owner: AP for 210, warehouse for 940, billing for 810 |
| TA1 request flag (ISA14) and response | Partner profile | EDI analyst | Integration manager |
| Release or rejection of a held document | Exception queue | AP, warehouse or billing analyst | Relevant process manager |
India: X12 at the partner edge, IRN uniqueness inside GST
X12 is a US standard with no Indian statutory status, so the envelope rules apply to Indian firms only where they trade with partners using X12. Inside India's GST system, the e-invoice IRN gives a separate duplicate guard, but it is keyed on document number, not on content.
- Who meets X12 in India: 3PLs, exporters and subsidiaries of US groups that receive 940 shipping orders or send 810 invoices because a parent or customer EDI hub uses X12.
- What stays the same: the envelope ledger and business-key ledger above apply without change.
- What differs: the tax document raised after a duplicate slips through, which falls under e-invoicing on the Invoice Registration Portal.
The NIC e-invoice API documentation defines the IRN as a SHA-256 hash of the supplier GSTIN, document number, document type and financial year, and states that duplicate IRN requests are not considered. A second IRN therefore cannot exist for the same document type and number in one financial year. If a duplicate 940 leads the ERP to bill a second shipment under a new invoice number, the portal issues a second IRN without complaint.
Indian 3PLs receiving X12 940 orders cannot rely on GST e-invoice IRN uniqueness to catch duplicates, because the NIC IRN hash covers supplier GSTIN, document type, document number and financial year only; a duplicate order billed under a new invoice number receives a valid second IRN and needs a credit note.
Our article on generating e-way bills from the e-invoice IRN covers that downstream flow. The worked comparison below sets a US shipper's duplicate 210 payments beside an Indian 3PL's duplicate 940 shipments for one year. All figures are illustrative.
Scroll horizontally to see all columns.
| Line | US shipper, inbound 210 invoices (USD $) | Indian 3PL, inbound 940 orders (INR ₹) |
|---|---|---|
| Transaction sets received per year | 96,000 | 52,000 |
| Duplicates passing an ISA13-only check | 48 (0.05%) | 26 (0.05%) |
| Cost per duplicate | $2,310 average invoice paid twice | ₹36,500: outbound freight ₹18,400, return freight ₹11,200, handling ₹6,900 |
| Gross exposure | 48 x $2,310 = $110,880 | 26 x ₹36,500 = ₹9,49,000 |
| Recovered later | 70% via carrier statement offsets = $77,616 | None; freight already spent |
| Net loss | $33,264 | ₹9,49,000 |
| Staff time to unwind | 48 x 40 min = 32 h at $46 = $1,472 | 26 x 3 h = 78 h at ₹650 = ₹50,700, including credit notes |
| Review time for held genuine revisions | 19 x 10 min = 3.2 h at $46 = $147 | 12 x 10 min = 2 h at ₹650 = ₹1,300 |
| Annual saving with business-key layer | $33,264 + $1,472 - $147 = $34,589 | ₹9,49,000 + ₹50,700 - ₹1,300 = ₹9,98,400 |
| One-time build cost | $18,000 | ₹6,50,000 |
| Payback | 6.2 months | 7.8 months |
The Indian case pays back on physical cost rather than cash leakage, because a duplicate shipment cannot be clawed back the way a duplicate payment can. That shifts where the check belongs: for a warehouse, the business-key hold must sit before order release to the WMS, not at billing.
Translator rules versus analyst assistance on suspected duplicates
Envelope matching, count checks and business-key matching are exact comparisons and belong in coded rules. Comparing two near-identical documents, reading a partner's guide, or spotting a counter that went backwards are tasks where an assistant can prepare evidence for an analyst.
Scroll horizontally to see all columns.
| Task | Handled by | Why | Human decision |
|---|---|---|---|
| Rejecting a repeated ISA13 from the same partner pair and usage indicator inside the window | Translator rule | Exact key match defined in the agreement | None; TA1 sent if requested |
| Checking IEA02, GE02 and SE02 echoes and the three counts | Translator rule | Structural arithmetic | None |
| Holding a 210 whose SCAC, invoice number and body hash match an accepted one | Middleware rule | Reproducible and auditable | None for identical hash |
| Comparing two 210s with the same invoice number but different hashes | Assistant lists line differences such as weight or accessorials | Revision versus error needs judgement | AP analyst accepts revision or rejects |
| Extracting a partner's duplicate window and qualifiers from its PDF guide | Assistant drafts the profile values | Guides are unstructured | EDI analyst confirms before saving |
| Spotting a partner whose inbound ISA13 sequence stepped backwards | Rule flags the step; assistant groups related alerts | Pattern across days of traffic | EDI analyst calls the partner |
| Releasing a held 940 to the WMS for picking | Person only | Physical shipment and customer cost | Warehouse supervisor releases with reason |
Keep the assistant's output as a note on the held record, never as a status change. The audit trail should show who released each held document and why, especially for 940s, where a wrong release ships product that cannot be recalled by journal entry.
Control-number checklist for a new trading partner go-live
Test duplicate handling on purpose before go-live, with files built to fail. A partner connection that has only ever seen clean test files has not proved it can stop a replay.
Scroll horizontally to see all columns.
| Test | How to run it | Expected result | Signed by |
|---|---|---|---|
| Identical redelivery | Send the same file twice | Second rejected; TA1 with 025 if ISA14 = 1 | EDI analyst |
| Re-wrapped content | Resend one document with new ISA13 and GS06 | Held by business key; nothing reaches WMS or AP | Process owner |
| Genuine revision | Same document number, changed weight | Held for review, not rejected | AP or warehouse analyst |
| Test flag in production | Send ISA15 = T to the production endpoint | Rejected or routed to test only | Integration manager |
| Header-copying split | Two different files sharing one ISA13 | Second rejected and partner told to renumber | EDI analyst |
| Counter restore | Restore sender counter to an earlier value in test | Gap monitor alerts on the backward step | EDI operations |
| Window written down | Check the signed agreement | Window in days and key fields stated | Both partners |
Envelope numbers are one input into wider partner onboarding, covered step by step in our EDI trading partner onboarding test plan. Order intake that does not arrive by EDI at all, such as emailed requests, has no envelope to check; the email-to-shipment order pilot deals with duplicates and amendments in that channel, where the key must be built from the message content alone. More integration topics sit in the Logistics and Supply Chain collection.
If you are specifying duplicate controls across many partners or moving translators and want the ledger design and test files prepared alongside the migration plan, you can send us a request for proposal with your partner count and transaction volumes.
Discuss this workflow
Describe your current systems, the recurring exception and the outcome you need. Keep shipment, customer and financial records out of the initial message.
Common operational questions
Practical answers for operations, engineering, and finance teams working on edi isa gs envelope control numbers in logistics & supply chain.
How long must an ISA13 interchange control number stay unique?
Can ST02 be 0001 in every functional group?
Why did a duplicate invoice pass our translator's duplicate check?
Does India's e-invoice IRN stop duplicate invoices created from duplicate EDI orders?
References
Sources checked 13 November 2026. US and India statutory authorities and vendor documentation support platform facts; the worked examples and diagrams are original.
- X12 - Request for Interpretation 2532, Interchange control number uniquenessCites X12.5 section 5.1.2: no reuse between a trading partner pair within an agreed time frame. Accessed 13 November 2026.
- X12 - Request for Interpretation 1646, GS06 uniqueness requirementsQuotes X12.6 section 3.9.1 on GS01, GS02, GS03 and GS06 uniqueness and the limit on rejecting without an agreed window. Accessed 13 November 2026.
- X12 - Request for Interpretation 1139, ST02 transaction set control numberConfirms X12 requires ST02 uniqueness within the functional group. Accessed 13 November 2026.
- Kroger - EDI interchange, group and transaction set header and trailer segment specificationsPublished retail implementation of ISA01 to ISA16, GS, ST, SE, GE and IEA lengths, echoes and counts. Accessed 13 November 2026.
- Microsoft Learn - X12 TA1 acknowledgment error codes (BizTalk Server)TA104 values and TA105 note code 025 for a duplicate interchange control number. Accessed 13 November 2026.
- Stedi - X12 element I05 Interchange ID Qualifier and element 479 Functional Identifier CodeCode values 01, 08, 12 and ZZ; functional IDs IM (210), OW (940) and IN (810) checked on the companion element 479 page. Accessed 13 November 2026.
- NIC - e-Invoice API sandbox, Generate IRN (version 1.03)IRN defined as SHA-256 of GSTIN, document number, document type and financial year; validation that duplicate IRN requests are not considered. Accessed 13 November 2026.
- ASC X12 — EDI Supply Chain & Transportation Transaction Sets (204/210/214/856/940/945)US standard for electronic data interchange across shippers, 3PLs, and motor carriers.
- FMCSA — 49 CFR Part 395 Hours of Service & Electronic Logging Devices (ELD)US federal motor carrier dispatch and driver duty-status compliance mandate.
- ULIP & NIC GST E-Way Bill Portal — Unified Logistics & Rule 138 ComplianceIndian statutory goods-in-transit and multi-modal logistics verification framework.