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

# Ak9Segment

`Ak9Segment` models the X12 AK9 functional group response trailer, which closes out a 999/997 functional acknowledgement with a summary of how many transaction sets were included, received, and accepted for the acknowledged functional group.

## Purpose
- Represents the AK9 segment identity via `SegmentId` returning the literal `"AK9"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries the overall acceptance disposition (`ResponseCode`) and the transaction-set counts (`NumberOfSets`, `NumberOfReceivedSets`, `NumberOfAcceptedSets`) that summarize the acknowledged functional group.

## 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 `"AK9"`. |
| ResponseCode | `string ResponseCode { get; set; }` | The overall acceptance/rejection code for the functional group (AK901), read/written at element 1. |
| NumberOfSets | `int NumberOfSets { get; set; }` | The number of transaction sets included in the functional group (AK902), read/written at element 2. |
| NumberOfReceivedSets | `int NumberOfReceivedSets { get; set; }` | The number of transaction sets received (AK903), read/written at element 3. |
| NumberOfAcceptedSets | `int NumberOfAcceptedSets { get; set; }` | The number of transaction sets accepted (AK904), read/written at element 4. |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("AK9")` and adds `ResponseCode` and the three counts at elements 1-4, returning the built segment. |
| Fill | `void Fill(IEdiSegment segment)` | Reads elements 1-4 via `GetChildValue`, converting elements 2-4 to `int`, into `ResponseCode` and the three counts. |
| Parse | `static Ak9Segment Parse(IEdiSegment segment)` | Instantiates a new `Ak9Segment`, calls `Fill(segment)` on it, and returns it. |

## Behavioral notes
- The class carries a code comment noting its field layout resembles the GS segment's positions*.

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

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