{
  "slug": "edi-997-rejection-codes",
  "title": "Reading a 997: what AK5, AK3 and AK4 codes actually mean",
  "description": "A Functional Acknowledgment reports its verdict as bare letters and numbers. Here is how to turn one into a sentence, and why silence is worse than rejection.",
  "keywords": [
    "edi 997",
    "ak5",
    "ak9",
    "functional acknowledgment",
    "997 rejected",
    "ak3 ak4",
    "999 ik5"
  ],
  "cause": [
    "A 997 answers whether a document was accepted, but encodes it as codes. AK5 carries the transaction-set verdict, AK9 the group verdict, AK3 a segment-level fault and AK4 an element-level one.",
    "AK5*R*5 means rejected because one or more segments are in error. AK3*HL*4**7 means the HL segment at position 4 is out of sequence. AK4*2**7*XX means element 2 held an invalid code value, and that value was XX. None of this is readable without the tables.",
    "The more expensive failure is the document that gets no acknowledgment at all. Nothing in the pipeline reports it; you discover it weeks later as a chargeback for a shipment the retailer never knew about."
  ],
  "example": {
    "label": "Decode a rejection and reconcile it against what was sent",
    "curl": "curl -sX POST https://fluentedi.com/v1/edi/acknowledge -H 'content-type: application/json' \\\n  -d '{\"input\":\"ST*997*0003~AK1*SH*5~AK2*856*0001~AK5*A~AK9*P*2*2*1~SE*6*0003~\",\"sent\":[\"0001\",\"0002\"]}'",
    "output": "\"reconciliation\": {\n  \"unacknowledged\": [\"0002\"],\n  \"complete\": false,\n  \"note\": \"1 document(s) you sent were never acknowledged: 0002.\n           An unacknowledged document is not a delivered one —\n           chase these before assuming they arrived.\"\n}"
  },
  "fix": [
    "Keep the control numbers you sent, and reconcile every 997 against them. Acceptance of the documents that came back says nothing about the one that did not.",
    "Resend a rejected document with a NEW control number. Reusing a rejected one is itself a rejection reason, code 23.",
    "Treat AK9 of P as a rejection: partially accepted means at least one transaction set failed, even though the group looks answered."
  ],
  "tools": [
    "https://fluentedi.com/v1/edi/acknowledge",
    "https://fluentedi.com/v1/edi/validate",
    "https://fluentedi.com/v1/edi/parse"
  ]
}