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

# Nm1Segment

`Nm1Segment` models the X12 NM1 individual/organizational name segment, one of the most heavily reused segments across 837/835/277 transactions for naming any party in the transaction (subscriber, patient, provider, payer, and more). When entity type `"1"` is set, the party is treated as a person with last/first/middle/prefix/suffix name parts; any other entity type is treated as an organization with a single name field ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)). `Fill()` also composes a single `CompleteName` string from the parsed parts ([BR-048](../../business-rules.md#br-048-nm1-complete-name-composition)), and optional trailing elements are written only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)).

## Purpose
- Represents the NM1 segment identity via `SegmentId` returning the literal `"NM1"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries `EntityIdentifierCode` classifying which party role this instance represents, and `EntityType` distinguishing a person (`"1"`) from an organization (any other value) ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)).
- For a person, writes/reads `LastName`, `FirstName`, `MiddleName`, `NamePrefix`, and `NameSuffix`; for an organization, writes/reads a single `OrganizationName` ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)).
- Composes `CompleteName` on `Fill()` as `LastName + NameSuffix + ", " + FirstName + " " + MiddleName` for a person, or as `OrganizationName` for an organization ([BR-048](../../business-rules.md#br-048-nm1-complete-name-composition)).
- Writes `MiddleName`, `NamePrefix`, `NameSuffix`, `IdentificationCodeQualifier`, and `IdentificationCode` on `Build()` only when they are 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 `"NM1"`. |
| EntityIdentifierCode | `string EntityIdentifierCode { get; set; }` | Code identifying which party role this NM1 instance represents (NM101), element 1. |
| IsForPerson | `bool IsForPerson { get; set; }` | Recomputed on both `Build()` and `Fill()` as `EntityType == "1"`; drives whether person or organization name fields are used ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)). |
| EntityType | `string EntityType { get; set; }` | The entity-type qualifier code (NM102): `"1"` for a person, any other value for an organization (NM102), element 2 ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)). |
| OrganizationName | `string OrganizationName { get; set; }` | The organization's name (NM103), used when `EntityType` is not `"1"` ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)). |
| LastName | `string LastName { get; set; }` | The person's last name (NM103), used when `EntityType` is `"1"` ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout)). |
| FirstName | `string FirstName { get; set; }` | The person's first name (NM104), used when `EntityType` is `"1"`. |
| MiddleName | `string MiddleName { get; set; }` | The person's middle name (NM105), written on `Build()` only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| NamePrefix | `string NamePrefix { get; set; }` | The person's name prefix (NM106), written on `Build()` only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| NameSuffix | `string NameSuffix { get; set; }` | The person's name suffix (NM107), written on `Build()` only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)); also appended into `CompleteName` ([BR-048](../../business-rules.md#br-048-nm1-complete-name-composition)). |
| IdentificationCodeQualifier | `string IdentificationCodeQualifier { get; set; }` | The qualifier for `IdentificationCode` (NM108), written on `Build()` only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| IdentificationCode | `string IdentificationCode { get; set; }` | The party's identification code value (NM109), written on `Build()` only when populated ([BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| CompleteName | `string CompleteName { get; set; }` | The composed display name for the party, computed by `Fill()` from either the person's name parts or the organization name ([BR-048](../../business-rules.md#br-048-nm1-complete-name-composition)); not written by `Build()`. |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("NM1")`, adds `EntityIdentifierCode` and `EntityType`, then branches on `IsForPerson` to add either the person name parts (with optional fields only when populated) or `OrganizationName`, and finally adds `IdentificationCodeQualifier`/`IdentificationCode` only when populated, returning the built segment ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout), [BR-059](../../business-rules.md#br-059-optional-segment-elements-written-only-when-populated)). |
| Fill | `void Fill(IEdiSegment segment)` | Reads `EntityIdentifierCode`/`EntityType`, branches on `IsForPerson` to populate either the person name parts or `OrganizationName`, composes `CompleteName` accordingly, and reads `IdentificationCodeQualifier`/`IdentificationCode` ([BR-047](../../business-rules.md#br-047-nm1-person-vs-organization-name-layout), [BR-048](../../business-rules.md#br-048-nm1-complete-name-composition)). |
| Parse | `static Nm1Segment Parse(IEdiSegment segment)` | Instantiates a new `Nm1Segment`, calls `Fill(segment)` on it, and returns it. |

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