Reference·QAK Segment·QAK-2
HL7 v2 Reference

QAK-2 in HL7 v2: A Field Guide to Query Response Status

Jul 28, 2026 · 4 min read
← QAK-1 QAK-3 →

QAK-2 is the two-letter verdict that decides whether a querying system should read the rest of the response as real data, treat it as an empty result, or route it to error handling — and it is the field most query test suites never vary away from the success case.

Quick answer

QAK-2 is the Query Response Status field. It carries a short coded value telling the requesting system how the query went: data was found, the query ran cleanly but nothing matched, or the receiving application had trouble processing the request at all. Each value is meant to send the requester down a different handling path.

Valid code values

OK
Data Found — the query executed successfully and the response carries at least one matching result
NF
No Data Found — the query executed successfully but nothing in the receiving system matched the search criteria
AE
Application Error — the receiving application attempted to run the query but hit a problem processing it, such as a downstream lookup failure
AR
Application Reject — the receiving application declined to run the query at all, typically because it failed validation before execution began

Example

Synthetic example Generated by Synthibase
QAK|Q1042|OK|Q11^EligibilityInquiryByPatient^SYNTHIB0001

QAK-2 (OK) marks this synthetic response as a successful query with results, paired with a fabricated tag and query name.

Where this trips people up

Because OK is the only status that comes with a populated result set, test suites built around a handful of captured real responses tend to only ever exercise OK, leaving the empty-result and error branches of the requester's logic completely unproven. Teams also sometimes treat NF as a failure state and route it into error handling, when a query that ran correctly and simply found nothing is a normal, expected outcome that should be handled differently from AE or AR, which represent the query actually breaking.

Testing HL7 v2 QAK: The Fields Your System Actually Needs to Handle
EDI 999 vs 997: What's the Difference and Why It Matters
How to Write EDI Test Cases That Actually Catch Go-Live Failures
Test every query status, not just OK
Synthibase generates synthetic query responses spanning OK, NF, AE, and AR outcomes, so your empty-result and error-handling logic gets exercised against real scenarios before go-live.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.