---
title: StSegment
summary: API reference for StSegment.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common.Files
reference_type: package
---

# StSegment

`StSegment` models the X12 ST transaction-set header, the segment that opens every transaction set (e.g. an 837 claim, an 835 remittance, a 277 status) within a functional group. Its control number is zero-padded to at least four digits on output, matching the paired `SeSegment.ControlNumber` format ([BR-041](../../business-rules.md#br-041-st-and-se-control-numbers-zero-padded-to-four-digits)), and its optional implementation convention reference is written only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)).

## Purpose
- Represents the ST segment identity via `SegmentId` returning the literal `"ST"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries `TransactionSetIdentifierCode` identifying the transaction set type, and `ControlNumber` uniquely identifying this instance within the functional group, zero-padded to at least four digits on `Build()` ([BR-041](../../business-rules.md#br-041-st-and-se-control-numbers-zero-padded-to-four-digits)).
- Writes the optional `VersionConventionReference` (implementation guide reference) on `Build()` only when it is non-empty ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)).

## Context
- Namespace: `SAIF.Common.Files.Edi.Segments`
- Assembly/package: `SAIF.Framework.Common.Files`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| SegmentId | `string SegmentId { get; }` | Returns the literal X12 segment identifier `"ST"`. |
| TransactionSetIdentifierCode | `string TransactionSetIdentifierCode { get; set; }` | The transaction set type identifier code (ST01), element 1. |
| ControlNumber | `long ControlNumber { get; set; }` | The transaction set control number matching the paired `SeSegment.ControlNumber` (ST02), zero-padded to at least four digits on `Build()` ([BR-041](../../business-rules.md#br-041-st-and-se-control-numbers-zero-padded-to-four-digits)). |
| VersionConventionReference | `string VersionConventionReference { get; set; }` | The implementation convention reference for the transaction set (ST03), written on `Build()` only when non-empty ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("ST")`, adds `TransactionSetIdentifierCode` at element 1, adds `ControlNumber` formatted with at least four digits at element 2, and adds `VersionConventionReference` at element 3 only when non-empty, returning the built segment ([BR-041](../../business-rules.md#br-041-st-and-se-control-numbers-zero-padded-to-four-digits), [BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| Fill | `void Fill(IEdiSegment segment)` | Reads elements 1-3 via `GetChildValue`, converting element 2 to `long`, into `TransactionSetIdentifierCode`, `ControlNumber`, and `VersionConventionReference`. |
| Parse | `static StSegment Parse(IEdiSegment segment)` | Instantiates a new `StSegment`, calls `Fill(segment)` on it, and returns it. |

## Sources
- Common\SAIF.Common.Files\Edi\Segments\StSegment.cs
