EDI 322 Terminal Operations: Gate In, Gate Out and Rail Ramp
For edi and integration analysts, it leads at shippers, 3pls and carriers · Understand the problem

EDI 322 Terminal Operations: Gate In, Gate Out and Rail Ramp: Illustrative TMS–ERP order and invoice handoff review beside a warehouse floor; not a client facility.
Quick answer: edi 322 terminal operations
The X12 322 Terminal Operations and Intermodal Ramp Activity message is sent by a terminal, port or rail ramp to report ingates, outgates and railcar moves. Q5-01 carries the event code, such as OA out-gate or I in-gate, N7 identifies the container, NA cross-references the chassis, and R4 names the facility. Out-gate and in-gate times bound per diem.
TL;DR — what you’ll learn
- A 322 comes from the facility itself, so its out-gate and in-gate times are the closest electronic evidence to the Equipment Interchange Receipt in a per diem dispute.
- Match equipment on N7-01 initial plus N7-02 serial and validate the N7-18 check digit; strip a check digit appended to the serial or in-gates will be silently dropped.
- Under the UIIA a provider must invoice per diem within 60 calendar days of return, and the carrier has 30 calendar days to dispute in writing with evidence.
- India has no X12 322: ICD and CFS custodians keep gate records under Customs Act Section 45(2)(a), and LDB tracks containers at 103 ICDs and 439 CFSs.
Topics: edi 322 terminal operations · x12 322 intermodal ramp activity · gate in gate out edi · chassis id edi · per diem start out-gate
All quantities, amounts, product codes and events are illustrative teaching examples.
A drayage carrier returns an empty container to the depot on the ninth day, the gate clerk keys it in, and three weeks later the equipment provider bills per diem to the fifteenth. The carrier is sure it returned the box earlier but cannot prove it quickly, because its own system never received the in-gate message. The terminal did send one. The carrier's translator rejected it because the container number arrived with the check digit glued to the serial.
The X12 322 message is the electronic record of exactly those moments: a container or trailer passing through a terminal gate, or being loaded to or unloaded from a railcar at an intermodal ramp. Read correctly, it gives every party the same timestamps for the start and end of equipment use, which is where most per diem and chassis disputes are won or lost. This guide walks through the segments, the event codes, the equipment identifiers and the commercial clocks they feed.
- What this guide covers: the 322's purpose and segments, gate and ramp event codes, container and chassis identification, per diem counting under the UIIA, and how Indian inland container depots record the same events without X12.
- What it adds: an annotated 322 sample, a per diem dispute worked in dollars, an inland detention case in rupees, translator rules and an onboarding checklist.
What a 322 reports that a 214 or 315 status message does not
The 322, Terminal Operations and Intermodal Ramp Activity, is sent by the facility itself: a marine terminal, a port authority or a rail ramp. X12 describes its purpose as communicating terminal and intermodal ramp activities, such as ingates and outgates, to authorised parties to a shipment. The 214 comes from a motor carrier about a shipment, and the 315 from an ocean carrier about a container's journey.
That difference in sender matters when the messages disagree. A 315 out-gate status is the ocean carrier's restatement of what a terminal told it, sometimes hours later. A 322 is the facility's own record, generated from its gate or crane system, and is normally the closest electronic evidence to the paper or digital Equipment Interchange Receipt the driver received at the gate.
Scroll horizontally to see all columns.
| Transaction set | Typical sender | Subject of the message | Best use |
|---|---|---|---|
| 322 Terminal Operations and Intermodal Ramp Activity | Marine terminal, port authority, rail ramp | Equipment passing a gate or moving on or off a railcar | Interchange times, per diem and chassis day evidence |
| 315 Status Details (Ocean) | Ocean carrier | Status events for containers or shipments | Voyage milestones and availability |
| 214 Transportation Carrier Shipment Status | Motor or other carrier | Shipment status: pickup, in transit, delivered | Delivery tracking and appointment compliance |
The site's guide to container tracking API events covers how to keep planned and actual milestones apart once several feeds arrive; this guide stays with the 322's own fields.
Segment walk-through: ZC1, Q5, N7, W2, NA and the R4 terminal loop
A 322 carries one status at header level and one or more pieces of equipment beneath it. The header Q5 segment holds the event; each N7 loop identifies a unit of equipment and can carry seals, a cross-referenced chassis, a vessel and one or more R4 locations. The list below follows X12 Release 8010; older versions in use by many partners differ in detail.
- ZC1 correction header: present only when the message corrects an earlier one; ZC1-04 and ZC1-05 point to the original transaction's reference number and date, and ZC1-06 carries the correction indicator.
- Q5 status details: Q5-01 is the event code, Q5-02 the date, Q5-03 the time and Q5-04 the time code, such as LT for local time; Q5-06 to Q5-08 give city, state and country.
- N7 equipment details: N7-01 equipment initial, N7-02 equipment number, N7-11 equipment description code such as CN container or CZ refrigerated container, N7-15 length and N7-18 check digit.
- W2 equipment identification: repeats the unit and adds W2-05 equipment status, such as L for load or E for empty.
- NA cross-reference: attaches related equipment, typically the chassis, by its own initial and number, with an optional chassis type code.
- R4 port or terminal: R401 states the location's role, R402 and R403 give a qualified code such as a UN/LOCODE, and R406 the terminal name.
ST*322*0001~
Q5*OA*20260303*0642*LT**MEMPHIS*TN*US~
N7*NXEU*123456*********CN*NXEL***4000***5~
W2*NXEU*123456**CN*L~
NA***NXCZ*804512~
R4*5*UN*USMEM*MEMPHIS*US*EXAMPLE INTERMODAL RAMP~
SE*7*0001~
Q5-01 OA = Out-Gate; Q5-02/03 = 3 March 2026, 06:42; Q5-04 LT = local time
N7-01/02 = container initial NXEU, serial 123456 (fictitious unit)
N7-11 CN = container; N7-12 = owner SCAC; N7-15 4000 = 40 ft 00 in; N7-18 = check digit 5
W2-05 L = loaded
NA-03/04 = chassis NXCZ 804512 cross-referenced to the container
R4-01 5 = place where the reported activity occurs; R402 UN + R403 USMEM = UN/LOCODE
Gate and ramp event codes that drive drayage and rail planning
Q5-01 uses the Shipment Status Code list shared with other X12 status messages, so a 322 parser must accept only the codes your terminal partners actually send and treat everything else as an exception. Each code below triggers something different downstream, from closing an Interchange Period to releasing a driver for the next load.
Scroll horizontally to see all columns.
| Q5-01 code | X12 meaning | Typical trigger in your systems |
|---|---|---|
| OA | Out-Gate | Open the Interchange Period and the per diem and chassis clocks for the motor carrier |
| I | In-Gate | Close the Interchange Period; stop per diem and chassis use days |
| AL | Loaded on Rail | Mark the box departed from the drayage leg; start rail transit tracking |
| UR | Unloaded from a Rail Car | Start the destination ramp's storage free time; alert the drayage dispatcher |
| RL | Rail Departure from Origin Intermodal Ramp | Update the expected arrival at the destination ramp |
| AR | Rail Arrival at Destination Intermodal Ramp | Prepare the pickup appointment; unloading may still be pending |
| AV | Available for Delivery | Release the pickup to dispatch once holds are clear |
| CT | Customs Released | Clear the customs hold flag on the container |
R401 tells you which role the facility plays in a rail move: code 6 marks the origin rail intermodal terminal and code 7 the destination, while code 5 is the place where the reported activity occurs. Use these, not the terminal name, to decide whether an in-gate at a ramp closes the drayage leg or opens a rail leg.
Container and chassis identity: N7 initial, number and NA cross-reference
Match equipment on initial plus serial, with the check digit carried separately. The X12 elements split an equipment identifier into a one-to-four-character initial and a number, and N7-18 holds the check digit. A partner who sends the check digit inside N7-02 will break an exact match unless your parser normalises the value before comparing it.
The container's check digit follows ISO 6346, computed from the owner code, category letter and six-digit serial. Verifying it on receipt catches keying errors made at a manual gate. The chassis, which carries its own provider prefix and number, travels in the NA segment so that container and chassis days can be counted separately when they come from different providers.
Per diem evidence from an X12 322 depends on matching N7-01 equipment initial and N7-02 serial exactly, with the N7-18 check digit validated under ISO 6346; a translator that also accepts the check digit appended to N7-02 avoids silently dropping in-gate events that close the UIIA Interchange Period.
Out-gate to in-gate: how per diem and chassis days are counted
In the United States, container and chassis interchanges with motor carriers are governed by the Uniform Intermodal Interchange and Facilities Access Agreement (UIIA), which the Intermodal Association of North America administers. Interchange is the transfer of physical possession; the Interchange Period runs from interchange to the motor carrier until interchange back to the provider. A 322 out-gate and in-gate are the electronic marks of those two moments.
- Per diem definition: the UIIA defines per diem as the charge paid when equipment is not returned by the end of the allowable free time, whether or not the provider calls it detention.
- Free time and rates: free days, per diem rates and chassis use charges are set in each provider's addendum, not in the UIIA body.
- Invoice deadline: Section E.6.c requires the provider to invoice within 60 calendar days of the equipment's return, or lose the right to recover the charge.
- Evidence and response: the provider must supply reasonably necessary evidence such as EIRs or electronic equivalents, and the motor carrier must respond in writing within 30 calendar days.
Per diem reconciliation for a motor carrier compares provider invoices with X12 322 out-gate and in-gate timestamps held in the drayage TMS; under UIIA Section E.6.c a provider must invoice within 60 calendar days of return, and Section E.6.f gives the carrier 30 calendar days to dispute with evidence.
Ocean carrier and marine terminal invoices follow a separate federal rule. Under 46 CFR 541.6(b), a demurrage or detention invoice from those billing parties must show the free time allowed, its start and end dates, the container availability date for imports or the earliest return date for exports, and the specific dates charged. Section 541.7 requires the invoice within 30 calendar days of the charge last being incurred. Our guide that separates demurrage, detention and terminal storage explains which clock each charge follows.
Indian ICD and CFS gate events: custodian records, LDB and no 322
X12 322 is a North American standard and has no regulatory counterpart in India. Indian inland container depots and container freight stations record gate events in their own terminal systems, and the commercial clocks that follow, such as line detention and ground rent, are set by each shipping line's and custodian's tariff. The data exists; it reaches you by different routes.
The legal anchor is custody. Under Section 45(2)(a) of the Customs Act, 1962, the person approved as custodian of imported goods in a customs area must keep a record of those goods and send a copy to the proper officer. ICD and CFS operators work under that approval and the Handling of Cargo in Customs Areas Regulations, 2009, so their gate logs carry regulatory weight, not just commercial value.
- Logistics Data Bank: containers are RFID-tagged and read at port terminals, ICDs, CFSs and toll plazas; a Ministry of Commerce and Industry release of 14 August 2026 reported 10 crore containers tracked, with coverage of 19 ports, 32 container terminals, 103 ICDs and 439 CFSs.
- Custodian and line data: gate-in and gate-out times come from the custodian's terminal system or the shipping line, often as UN/EDIFACT messages or portal downloads rather than X12.
- Rail legs: rake loading and unloading at rail-served ICDs adds its own events; our guide to rail rakes, terminal sidings and wharfage covers the railway side, while this section stays with the container gate.
ICD and CFS gate records in India rest on Section 45(2)(a) of the Customs Act, 1962, which obliges the approved custodian to keep a record of imported goods; matching custodian gate-out and empty-return times against a shipping line's detention invoice removed two billed days, ₹6,000, from one container in the illustrative case.
A per diem dispute in dollars and an ICD detention case in rupees
Both cases below use illustrative rates and free days, because those come from each provider's addendum or each line's tariff. The US case shows a per diem and chassis bill extended by a missed in-gate message; the Indian case shows line detention extended by a late empty-yard entry. The fix in both is the same: produce the facility's own gate record.
Scroll horizontally to see all columns.
| Item | US drayage carrier ($) | India importer, ICD import box (₹) |
|---|---|---|
| Gate-out (322 OA or custodian gate-out) | 3 March, 06:42 | 4 August, 11:15 |
| Return per gate record (322 I or yard receipt) | 12 March, 15:10 | 15 August, 17:40 |
| Return date the invoice used | 15 March | 17 August |
| Calendar days counted, inclusive | 10 correct; 13 billed | 12 correct; 14 billed |
| Free days (illustrative) | 4 | 7 |
| Container per diem or detention rate per day | 85 | 3,000 |
| Container charge correct versus billed | 510 versus 765 | 15,000 versus 21,000 |
| Chassis use at 32 a day, all days | 320 versus 416 | Not applicable; trailer belongs to the transporter |
| Amount disputed and recovered | 351 | 6,000 plus GST as invoiced |
Incident trace: an in-gate message dropped by the translator
- 3 March, 06:42: Ramp gate system issues EIR E-221904 and a 322 with Q5*OA for NXEU 123456 on chassis NXCZ 804512; the carrier's TMS opens trip DR-30417.
- 12 March, 15:10: The empty is in-gated at the depot. Its 322 carries N7-02 as 1234565, with the check digit appended, and the carrier's translator rejects it for no matching unit.
- 15 March, 09:30: A depot yard audit records the unit as received; the provider's billing system takes that as the return date.
- 2 April, 08:00: Invoice PD-48812 bills 9 chargeable container days and 13 chassis days; the carrier's audit flags that trip DR-30417 is still open.
- 9 April, 14:20: The carrier pulls the rejected 322 from its error log, attaches the in-gate EIR, and disputes within the UIIA 30-day window; the provider credits $351.
The acknowledgement layer would have exposed the problem on 12 March. A translator that accepts the interchange but drops a transaction set should report it, and our guide to 997 functional acknowledgments shows how to reconcile accepted and rejected sets daily.
Who owns each gate event record and who can correct it
Only the facility that recorded a gate event can correct it, and it does so by sending a new 322 with a ZC1 segment that points to the original. Receivers should never overwrite an event by hand; they should hold their dispute evidence beside the original message and wait for, or request, the facility's correction.
Scroll horizontally to see all columns.
| Record | Created by | Held by receiving parties as | Who may correct it |
|---|---|---|---|
| Gate event and EIR | Terminal, depot or ramp gate system | 322 message plus EIR image | The facility, by a 322 with ZC1 |
| Free days and per diem rates | Equipment provider's addendum | Rate table in the carrier's audit system | The provider, by addendum change |
| Per diem or detention invoice | Provider or ocean carrier | Payable pending audit | The provider, by credit note |
| Trip and equipment assignment | Drayage carrier's TMS | Trip record linked to container and chassis | Carrier dispatch |
| Indian custodian gate log | ICD or CFS operator | Gate-out slip and line's detention statement | The custodian, through its own procedure |
Parsing rules a translator enforces and calls a planner still makes
Structural and identity checks on a 322 are fixed rules that should run on every message. Interpretation, such as whether a late in-gate reflects a dispatch delay or a terminal outage, needs a planner. Software and AI tools can assemble evidence and draft disputes, but a person approves what is sent to a provider.
Scroll horizontally to see all columns.
| Task | Fixed rule | Where software or AI assists a person |
|---|---|---|
| Accepting only agreed Q5-01 codes per partner | Yes, others routed to an exception queue | Not needed |
| Normalising N7-02 when the check digit is appended | Yes, strip and compare with N7-18 | Not needed |
| Converting Q5 local time using the facility's time zone | Yes, offset table per R4 location | Not needed |
| Linking a ZC1 correction to the original event | Yes, by ZC1-04 and ZC1-05 | Not needed |
| Reading a photographed paper EIR to confirm a time | No | Text extraction proposes unit, time and damage notes; the auditor checks |
| Explaining a late return caused by a terminal closure | No | A model drafts the dispute narrative; the dispute lead approves it |
| Deciding to accept or contest a provider's day count | No | Not delegated; the per diem auditor decides |
Onboarding a terminal or ramp feed: test events before go-live
Agree the version, codes and equipment format with each facility, then test with real events covering every gate and ramp move you care about. Go live only when your per diem audit can rebuild a recent month of invoices from 322 data alone. For wider context on terminal and drayage processes, see the logistics and supply chain hub.
Scroll horizontally to see all columns.
| Check | Pass condition | Evidence |
|---|---|---|
| Version and guideline | X12 release and partner implementation guide agreed in writing | Signed mapping specification |
| Event code set | Every Q5-01 code the facility sends is listed with an action | Code table in the mapping |
| Equipment format | Initial, serial and check digit placement confirmed | Three sample messages parsed cleanly |
| Chassis reporting | NA or second N7 convention known, pool moves covered | Bare-chassis sample message |
| Time basis | Q5-04 value and facility time zone recorded | Offset entry per R4 location |
| Corrections | ZC1 messages link to and supersede originals | Test correction processed |
| Acknowledgement | 997 returned for each group; rejected sets alerted | Daily acknowledgement report |
| Invoice rebuild | One month of per diem invoices recomputed from 322 events | Variance report signed by the auditor |
If you are evaluating a drayage TMS, per diem audit tool or integration layer that can ingest 322 feeds, apply these rules and rebuild provider invoices, you can describe your terminals, volumes and current disputes through our request for proposal page.
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 322 terminal operations in logistics & supply chain.
Who sends an EDI 322 and who receives it?
Which 322 events start and stop per diem?
How is a chassis identified in a 322?
Can a receiver correct a wrong time in a 322?
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 - Transaction set 322, Terminal Operations and Intermodal Ramp Activity (purpose statement)Official X12 catalogue description of the 322 and 315. Accessed 13 November 2026.
- X12 - 322 segment table and element definitions for Q5, N7, W2, NA, R4 and ZC1, with code lists 157, 40, 578, 115, 309 and 623 (Release 8010)X12 dictionaries are licensed; segment and code definitions read from Stedi's reproduction of the X12 standard. Older partner versions may differ. Accessed 13 November 2026.
- Intermodal Association of North America - Uniform Intermodal Interchange and Facilities Access Agreement, effective 18 June 2026Definitions of Interchange, Interchange Period, EIR and Per Diem; Section D.2 on EIRs; Section E.6.c, e and f on invoicing within 60 days, evidence and 30-day responses. Accessed 13 November 2026.
- eCFR - 46 CFR 541.6 and 541.7, demurrage and detention invoice contents and billing time limitseCFR refused automated access; text checked on the Cornell LII copies of sections 541.6 and 541.7. Accessed 13 November 2026.
- Government of India - Customs Act, 1962, Section 45 (restrictions on custody and removal of imported goods)India Code timed out; Section 45(1) and 45(2)(a) wording checked on a reproduced copy (lawgist.in) of the current text. Accessed 13 November 2026.
- Press Information Bureau, Ministry of Commerce and Industry - Logistics Data Bank tracks 10 crore EXIM containers, 14 August 2026Coverage of 19 ports, 32 container terminals, 103 ICDs and 439 CFSs through RFID-based tracking. Accessed 13 November 2026.
- 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.