START A CONVERSATION

Let’s talk about your next build.

Prepare your brief below, then review and send it in your email app to sales@nextlabsonline.com.

THE FIRST CONVERSATION

Your product idea, AI opportunity or automation challenge—and a useful first milestone.

All fields are required.

A few sentences about the problem, your users and timing are enough.

We’ll use your details to respond to your enquiry. Please don’t include patient records, passwords or confidential information. Privacy Policy · Website Terms.

Logistics & supply chain / EDI & Message Standards

EDI 322 Terminal Operations: Gate In, Gate Out and Rail Ramp

By Vikasraj YadavPublished 8 min read

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 — Two supply chain IT and finance staff sitting at a wooden table with two side-by-side out-of-focus monitors, two closed laptops, a blank ruled clipboard, and a plain cream folder, overlooking a warehouse floor with pallet racking and an orange forklift.

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.

At a glance · Quick answer

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.

How the 322 differs from the other X12 status messages a drayage or rail team receives
Transaction setTypical senderSubject of the messageBest use
322 Terminal Operations and Intermodal Ramp ActivityMarine terminal, port authority, rail rampEquipment passing a gate or moving on or off a railcarInterchange times, per diem and chassis day evidence
315 Status Details (Ocean)Ocean carrierStatus events for containers or shipmentsVoyage milestones and availability
214 Transportation Carrier Shipment StatusMotor or other carrierShipment status: pickup, in transit, deliveredDelivery 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.

Common 322 event codes in Q5-01 and the downstream action each one should trigger
Q5-01 codeX12 meaningTypical trigger in your systems
OAOut-GateOpen the Interchange Period and the per diem and chassis clocks for the motor carrier
IIn-GateClose the Interchange Period; stop per diem and chassis use days
ALLoaded on RailMark the box departed from the drayage leg; start rail transit tracking
URUnloaded from a Rail CarStart the destination ramp's storage free time; alert the drayage dispatcher
RLRail Departure from Origin Intermodal RampUpdate the expected arrival at the destination ramp
ARRail Arrival at Destination Intermodal RampPrepare the pickup appointment; unloading may still be pending
AVAvailable for DeliveryRelease the pickup to dispatch once holds are clear
CTCustoms ReleasedClear 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.

From a gate move to a per diem decision using X12 322 events Step 1, Gate or ramp move: Facility records the event. EIR issued at the gate; Out-gate OA or in-gate I; Rail moves AL, UR, RL, AR. Step 2, 322 message: Q5, N7, NA and R4 sent. Event, date, time, time code; Container initial and serial; Chassis in NA, facility in R4. Step 3, Translator checks: Validate before storing. Known codes per partner; Check digit and serial format; ZC1 corrections linked. Step 4, Per diem audit: Clock against invoice. Out-gate to in-gate days; Less addendum free days; Dispute within 30 days. From a gate move to a per diem decision using X12 322 events The facility records the move, the carrier validates the message, and the audit compares it with the invoice 1 · GATE OR RAMP MOVE Facility records the event • EIR issued at the gate • Out-gate OA or in-gate I • Rail moves AL, UR, RL, AR 2 · 322 MESSAGE Q5, N7, NA and R4 sent • Event, date, time, time code • Container initial and serial • Chassis in NA, facility in R4 3 · TRANSLATOR CHECKS Validate before storing • Known codes per partner • Check digit and serial format • ZC1 corrections linked 4 · PER DIEM AUDIT Clock against invoice • Out-gate to in-gate days • Less addendum free days • Dispute within 30 days

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.

Illustrative per diem and detention disputes resolved from gate event records, US and India
ItemUS drayage carrier ($)India importer, ICD import box (₹)
Gate-out (322 OA or custodian gate-out)3 March, 06:424 August, 11:15
Return per gate record (322 I or yard receipt)12 March, 15:1015 August, 17:40
Return date the invoice used15 March17 August
Calendar days counted, inclusive10 correct; 13 billed12 correct; 14 billed
Free days (illustrative)47
Container per diem or detention rate per day853,000
Container charge correct versus billed510 versus 76515,000 versus 21,000
Chassis use at 32 a day, all days320 versus 416Not applicable; trailer belongs to the transporter
Amount disputed and recovered3516,000 plus GST as invoiced

Incident trace: an in-gate message dropped by the translator

  1. 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.
  2. 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.
  3. 15 March, 09:30: A depot yard audit records the unit as received; the provider's billing system takes that as the return date.
  4. 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.
  5. 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.

Ownership and correction rights for gate and ramp event data across terminal, provider, carrier and shipper
RecordCreated byHeld by receiving parties asWho may correct it
Gate event and EIRTerminal, depot or ramp gate system322 message plus EIR imageThe facility, by a 322 with ZC1
Free days and per diem ratesEquipment provider's addendumRate table in the carrier's audit systemThe provider, by addendum change
Per diem or detention invoiceProvider or ocean carrierPayable pending auditThe provider, by credit note
Trip and equipment assignmentDrayage carrier's TMSTrip record linked to container and chassisCarrier dispatch
Indian custodian gate logICD or CFS operatorGate-out slip and line's detention statementThe 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.

322 handling tasks run as fixed translator rules versus tasks where software assists a dispatcher or auditor
TaskFixed ruleWhere software or AI assists a person
Accepting only agreed Q5-01 codes per partnerYes, others routed to an exception queueNot needed
Normalising N7-02 when the check digit is appendedYes, strip and compare with N7-18Not needed
Converting Q5 local time using the facility's time zoneYes, offset table per R4 locationNot needed
Linking a ZC1 correction to the original eventYes, by ZC1-04 and ZC1-05Not needed
Reading a photographed paper EIR to confirm a timeNoText extraction proposes unit, time and damage notes; the auditor checks
Explaining a late return caused by a terminal closureNoA model drafts the dispute narrative; the dispute lead approves it
Deciding to accept or contest a provider's day countNoNot 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.

Onboarding checklist for a terminal or intermodal ramp 322 feed
CheckPass conditionEvidence
Version and guidelineX12 release and partner implementation guide agreed in writingSigned mapping specification
Event code setEvery Q5-01 code the facility sends is listed with an actionCode table in the mapping
Equipment formatInitial, serial and check digit placement confirmedThree sample messages parsed cleanly
Chassis reportingNA or second N7 convention known, pool moves coveredBare-chassis sample message
Time basisQ5-04 value and facility time zone recordedOffset entry per R4 location
CorrectionsZC1 messages link to and supersede originalsTest correction processed
Acknowledgement997 returned for each group; rejected sets alertedDaily acknowledgement report
Invoice rebuildOne month of per diem invoices recomputed from 322 eventsVariance 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.

START A CONVERSATION

Let’s talk about your next build.

Prepare your brief below, then review and send it in your email app to sales@nextlabsonline.com.

SELECTED INDUSTRYLogistics & supply chain

Article: EDI 322 Terminal Operations: Gate In, Gate Out and Rail Ramp · EDI & Message Standards

THE FIRST CONVERSATION

Your product idea, AI opportunity or automation challenge—and a useful first milestone.

All fields are required.

A few sentences about the problem, your users and timing are enough.

We’ll use your details to respond to your enquiry. Please don’t include patient records, passwords or confidential information. Privacy Policy · Website Terms.

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?
A marine terminal, port authority or rail intermodal ramp sends it, generated from its gate or crane system. Receivers are parties authorised for the shipment, typically the ocean carrier or equipment provider, the drayage motor carrier, the railroad and sometimes the beneficial cargo owner or its logistics provider.
Which 322 events start and stop per diem?
Under the UIIA the Interchange Period runs from interchange of equipment to the motor carrier until interchange back to the provider. In a 322 those moments are normally the out-gate, Q5-01 code OA, and the in-gate, code I. Free days and daily rates come from each provider's addendum.
How is a chassis identified in a 322?
Usually in the NA cross-reference segment, which attaches related equipment to the container in the N7 loop by its own initial and number, with an optional chassis type code. Some facilities send the chassis as a second N7 loop with equipment description code CH, so confirm each partner's convention.
Can a receiver correct a wrong time in a 322?
No. Only the facility that recorded the event can correct it, by sending a new 322 whose ZC1 segment points to the original transaction's reference number and date. A receiver should keep the original, attach EIR evidence, and request the correction or dispute the resulting invoice.

References

Sources checked 13 November 2026. US and India statutory authorities and vendor documentation support platform facts; the worked examples and diagrams are original.

About the author

Vikasraj Yadav writes about operational decisions, software and automation for NextEdge Labs.