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

# RefSegment

`RefSegment` models the X12 REF reference-identification segment, one of the most widely reused segments across 837/835/277 transactions for attaching a qualified cross-reference identifier (e.g. prior authorization number, medical record number, group number) to a claim, provider, or subscriber loop.

## Purpose
- Represents the REF segment identity via `SegmentId` returning the literal `"REF"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries `ReferenceIdQualifier` identifying the type of reference identifier, paired with `ReferenceIdentification`, the identifier value itself.

## 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 `"REF"`. |
| ReferenceIdQualifier | `string ReferenceIdQualifier { get; set; }` | The code qualifying the type of reference identifier (REF01), element 1. |
| ReferenceIdentification | `string ReferenceIdentification { get; set; }` | The reference identifier value (REF02), element 2. |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("REF")` and adds `ReferenceIdQualifier` and `ReferenceIdentification` at elements 1-2, returning the built segment. |
| Fill | `void Fill(IEdiSegment segment)` | Reads elements 1-2 via `GetChildValue` into `ReferenceIdQualifier` and `ReferenceIdentification`. |
| Parse | `static RefSegment Parse(IEdiSegment segment)` | Instantiates a new `RefSegment`, calls `Fill(segment)` on it, and returns it. |

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