Control numbers in X12 EDI
Jun 7, 2022
Guide
Big takeaway: If you use Stedi’s JSON APIs, you can safely ignore X12 control numbers. If a top-level controlNumber
is required, use a dummy value.
Control numbers in X12 can be confusing. There are three different types, and they have weird formatting rules.
Luckily, if you use Stedi’s JSON APIs, you don’t need to deal with X12 control numbers at all. Even if you pass X12 directly to Stedi, you only need to follow a few validation rules. This guide covers:
What control numbers are
The different types of control numbers
How to use them with Stedi
What are control numbers?
Every X12 file contains three nested containers called envelopes:
Interchange – The outer envelope containing the entire EDI file. The file may contain one – and only one – interchange.
Functional group – A functional group of related transactions inside that envelope. An interchange can contain many groups.
Transaction set – An individual transaction in a group. A group can contain many transactions.
Each envelope has its own control number. The control number acts as an ID for that specific container.

Why have different control numbers?
Each control number serves a different purpose.
Interchange control numbers confirm whether an X12 file was received.
For example, Stedi sends an X12 file with interchange control number 000000001
to a payer. The payer can send back an acknowledgment for 000000001
. Stedi knows that the file wasn’t lost.
Group control numbers help with batching and routing.
If the receiver indicates there was an error with group 234
, the sender can just resend the transactions in that group. They don’t have to resend the entire file.
In some use cases, group control numbers are also used for internal routing. The receiver can split the X12 file by group and route each group’s transactions to a different system or department in their organization.
A transaction set control number identifies a specific transaction.
If there’s only an error with transaction 123456789
, the sender can just resend that transaction – not the entire group or file.
Control numbers in Stedi’s JSON APIs
If you’re using Stedi’s JSON APIs, you can ignore X12 control numbers.
Our JSON APIs handle any needed X12 translation for you.
Don’t use X12 control numbers for tracking.
Don't use the controlNumber
in API responses for transaction tracking. These values won't match what you pass in requests and aren't guaranteed to be unique to the transaction.
If you need to track claims, use the patient control number instead. See our How to track claims blog.
Control numbers in Stedi X12
Where control numbers are located
In an X12 file, each control number appears twice in an X12 message: once in the envelope's opening header and once in its closing trailer. The control number in the header must match the control number in its respective trailer.

The following table outlines each control number’s location and requirements.
Control number | Header location | Trailer location | Data type | Length |
Interchange | Numeric (integer) | Exactly 9 digits. Can include leading zeroes. | ||
Functional group | Numeric (integer) | 1-9 digits. | ||
Transaction set | Numeric (integer) | 4-9 digits. Only include leading zeroes to meet length requirements. |
Don’t worry about uniqueness.
If you pass X12 directly to Stedi using our X12 APIs or SFTP, you only need to ensure the ISA
/IEA
, GS
/GE
, and ST/SE
envelopes are valid X12.
Stedi creates its own ISA
/IEA
and GS
/GE
envelopes before sending them to the payer. This means you can use any valid transaction set control number in the ST
/SE
envelope. The transaction set control number only has to be unique within its groups.
Get started
You don’t have to learn EDI or wrestle with control numbers to process healthcare transactions. Stedi’s modern JSON APIs can handle it for you.
Sign up for free and request a trial to try them out. It takes less than two minutes and gives you instant access.
Share
Automate healthcare transactions with developer-friendly APIs that support thousands of payers. Contact us to learn more and speak to the team.