Amazon Edi 856

By Alexander Georges|Updated March 10, 2026
TL;DR: This guide explains Amazon EDI 856 (ASN) end-to-end: the core segments you must populate, why common errors occur, how to convert an 856 to CSV for ERP ingestion, and practical fixes using validation tools. Use the step-by-step conversion and troubleshooting sections to map HL hierarchies, validate carrier and carton data, and eliminate common 997/AK5 rejections; upload files to PlainEDI for automated checks and CSV export.

What This Is

The Amazon EDI 856 (Advance Ship Notice, ASN) is an X12 transaction used to tell a trading partner when and how a shipment is leaving your facility. The 856 conveys hierarchical data: shipment-level, order-level, and item-level details. Amazon uses ASNs to verify on-time shipment (OTIF) and carton-level accuracy; incorrect or malformed ASNs can trigger chargebacks and rejection codes.

This guide focuses on practical implementation and troubleshooting for Amazon EDI 856 files. You will get concrete EDI snippets, line-by-line explanations, real-world scenarios (multi-carton, multi-order shipments), a conversion mapping to CSV, and precise fixes for frequent validation failures. It also explains the structure of HL loops and how to flatten them into a CSV suitable for ERP or WMS imports, using validation and mapping features in PlainEDI.

Who This Is For

This guide is for EDI developers, integrators, warehouse managers, 3PLs, and small-to-medium vendors who send ASNs to Amazon or ingest received ASNs for carrier and receiving automation.

Key Segments Explained

  • ISA / GS (Interchange and Functional Group)

    The ISA segment is the interchange envelope that wraps X12 messages; it contains sender/receiver IDs, control characters, and indicates delimiters (element separator is ISA+1 character). The GS groups functionally related transaction sets and contains functional group control numbers used for acknowledgment tracking (997).

  • ST / SE (Transaction Set Header and Trailer)

    ST begins the 856 transaction set and sets the transaction set control number; SE ends it and includes the segment count. If the SE count is wrong, partners can generate a 997 AK5 error for invalid transaction structure.

  • BSN (Beginning Segment for Ship Notice)

    BSN is critical for Amazon: it contains the shipment identification (BSN03) and the ASN creation date/time. Missing or duplicate BSN03 values cause mismatches between ASN and receiving records and lead to compliance issues.

  • HL (Hierarchical Level)

    HL defines the ASN's hierarchical tree. Typical HL levels are: Shipment (HL level 1), Order (HL level 2), Pack/Container (HL level 3), and Item (HL level 4). Each HL has an ID and a parent ID to define the relationship. Incorrect HL nesting is the #1 technical cause of flat-file mapping failures and receiving mismatches.

  • TD1 / TD5 / PKG

    TD1 describes carrier packaging and carton counts and weights. TD5 carries carrier details and SCAC codes. Populate TD5 correctly for Amazon to match carrier data to the inbound receiving record. Amazon uses TD5.SCAC to match your tracking update against the purchase order.

  • MAN / REF / N1 / N3 / N4

    MAN contains the carton/SSCC identifiers (like GS1-128 or SSCC-18), and REF often contains order references or vendor shipment numbers. N1/N3/N4MAN are used to validate scanned carton IDs during receiving.

Example EDI Snippet

ISA*00*          *00*          *ZZ*SENDERID       *01*AMAZON         *210101*1200*U*00401*000000905*0*T*:~
GS*SH*SENDERID*AMAZON*20210101*1200*905*X*004010~
ST*856*0001~
BSN*00*SHIP123456*20210101*1200~
HL*1**S~
TD1*CTN*10****G*1000~
TD5*B*2*UPSN*M*D~
REF*CN*CONT123~
N1*ST*AMAZON FULFILLMENT*92*AMZWH1~
HL*2*1*O~
PRF*4500012345~
HL*3*2*P~
MAN*CP*000123456789012345~
HL*4*3*I~
LIN**VP*ABC123~
SN1**5*EA~
CTT*2~
SE*17*0001~
GE*1*905~
IEA*1*000000905~

Line-by-line explanation:

  1. ISA: Interchange envelope; last element ':' shows subelement separator. ISA control number = 000000905.
  2. GS: Functional group header for Ship Notices (SH). GS control number = 905.
  3. ST*856*0001: Transaction set 856 with control number 0001.
  4. BSN*00*SHIP123456*20210101*1200: ASN ID = SHIP123456; date/time stamp included.
  5. HL*1**S: HL level 1 (Shipment); no parent (empty second element); code S for Shipment.
  6. TD1*CTN*10****G*1000: 10 cartons total; gross weight 1000 (units per companion code).
  7. TD5*B*2*UPSN*M*D: Carrier route/carrier qualifiers. The third element often contains SCAC or carrier name; for Amazon, SCAC must match carrier expectations.
  8. REF*CN*CONT123: Reference control number—often the carrier container number.
  9. N1*ST*AMAZON FULFILLMENT*92*AMZWH1: Ship To qualifier ST and Amazon warehouse ID in N104 with qualifier 92.
  10. HL loop continues: HL 2 = Order, HL 3 = Pack/Container with MAN (carton SSCC) and HL 4 = Item with LIN and SN1 quantity.
  11. SE/GE/IEA: Transaction, group, and interchange trailers closing counts and control numbers.

CSV Output Example

The following CSV shows a flattened version for ERP import: one row per carton-item or one row per item depending on your ERP requirements. Example below is one row per carton-item (carton SSCC + SKU + qty).

ShipmentID ASNDate CarrierSCAC TrackingOrSSCC OrderNumber CartonCount ItemSKU QtyShipped ShipToID
SHIP123456 2021-01-01T12:00 UPSN 000123456789012345 4500012345 10 ABC123 5 AMZWH1

Step-by-Step Conversion Process

  1. Detect Delimiters and Read Envelope
    1. Read the first 106 characters of the EDI file to parse the ISA element separators. The character at position 4 is the element separator; position 105 is the subelement separator. Correct delimiter detection is the prerequisite for parsing.
    2. Extract ISA13/ISA14 (interchange control) and store for 997 reconciliation.
  2. Validate Envelope and Transaction Counts
    1. Validate ST/SE counts and GS/GE control numbers. If SE segment count mismatches, the file will be flagged for structural error.
    2. Run basic schema validation against an 856 implementation guide — check required segments (BSN, at least one HL, LIN + SN1 pairs).
  3. Validate Business Rules (Amazon-specific)
    1. Confirm BSN03 is present and unique for the shipment. If Amazon requires ASN within a specific time window, log timestamp differences for OTIF monitoring. Verify current Amazon policies and penalties (Last Updated: 2025-12-28). Verify current requirements with retailer portal.
    2. Ensure MAN or REF contains carton SSCC or label ID for each pack-level HL where Amazon expects carton scanning.
  4. Map HL Hierarchy to Flat Rows
    1. Traverse HL loops. For each HL with code P (pack/container), capture associated MAN and link to its child item HLs (code I).
    2. For each item HL under a pack, emit one CSV row combining shipment-level fields (BSN), order-level fields (PRF Purchase Order), pack-level fields (MAN SSCC, pack quantity), and item-level fields (LIN, SN1 quantity).
  5. Normalize and Enrich
    1. Normalize carrier codes (TD5) to canonical SCAC values your ERP expects. Enrich missing address fields from master data using N1* qualifiers.
    2. Convert dates/time to ISO 8601 for CSV consumption (e.g., 20210101,1200 -> 2021-01-01T12:00).
  6. Validate Final CSV Against ERP Schema
    1. Check required CSV columns, data types, and lengths (SKU lengths, SSCC 18-digit checks). Run checksum on SSCC if present.
    2. Run a dry import into a staging environment to detect mismatches (missing PO numbers, unknown SKUs).
  7. Use PlainEDI for Automated Checks and Upload
    1. Upload the original EDI file to PlainEDI to automatically detect delimiter issues, HL hierarchy errors, and required-segment failures. PlainEDI will produce a mapped CSV and a validation report highlighting missing segments and 997/AK5 actionable issues.
    2. After automated validation, download CSV and import to ERP. PlainEDI reduces manual debugging by surfacing the exact segment/element that fails validation.

Common Errors and Fixes

  • Error: AK5 or 997 rejection for invalid transaction structure (wrong SE segment count).
    Fix: Recount segments between ST and SE inclusive. Ensure SE01 equals the number of segments and SE02 equals the ST control number. Re-generate the file and re-send.
  • Error: HL hierarchy errors — receiving system reports “orphan HL” or incorrect parent-child mapping.
    Fix: Ensure every non-root HL has a parent HL ID and that HL IDs are unique. Validate that HL03 hierarchy code values are correct (S, O, P, I). Use your parser to build the HL tree and verify every leaf-level item links to a pack/container HL when required by Amazon.
  • Error: Missing or invalid MAN SSCC value leading to scanning failures.
    Fix: Validate SSCC format (18 digits, correct GS1 check digit). Confirm MAN01 qualifier is the expected code (e.g., CP). Ensure you repeat MAN for each pack-level HL when there are multiple cartons.
  • Error: Carrier SCAC mismatches (TD5 not matching expected Amazon carrier).
    Fix: Normalize carrier names to SCAC codes before sending. Use an internal carrier mapping table. For Amazon, ensure TD5 third element contains standardized SCAC. Upload to PlainEDI to detect carrier mapping mismatches as part of validation.
  • Error: ASN rejected due to missing BSN03 (shipment ID) or duplicate BSN03.
    Fix: Populate BSN03 with a unique shipment identifier and ensure duplicates aren’t generated. Track BSN03 values in your EDI system to prevent reuse within the required window.
  • Error: Item quantities invalid or mismatched between LIN/SN1 and CTT totals.
    Fix: Validate that SN1 quantities are integers and that CTT*01 (number of line items) matches count of LIN segments. Reconcile line-level quantities against packing list or WMS data prior to generating ASN.
  • Error: Invalid delimiters causing parse failures (common when files transit different systems).
    Fix: Read ISA fixed-width positions to re-detect element and subelement separators and correct mismatch. If your EDI translator changes delimiters, configure it to preserve ISA delimiters when transmitting.

Related Resources

FAQ Section

Q: What is an Amazon EDI 856 (ASN)?

An Amazon EDI 856 is the X12 Advance Ship Notice that communicates shipment details to Amazon before or at the time of physical shipment. It contains hierarchical information for shipment, order, pack/container, and item levels so Amazon can plan receiving and reconcile cartons and quantities.

Q: How do I flatten HL loops into CSV properly?

Traverse HL loops programmatically: capture shipment-level fields from HL with code S, order-level fields from HL code O, pack-level fields from HL code P, and item-level fields from HL code I. For each pack HL, emit rows for each child item HL, combining fields from the entire HL ancestry into a single flat record. Ensure unique HL IDs and correct parent pointers for accurate joins.

Q: Why did Amazon reject my 856 with an AK5 code?

An AK5 in the 997 indicates the partner (Amazon) flagged the transaction set as rejected for structural or business rule violations. Common reasons include invalid segment counts, missing required segments (BSN, MAN), incorrect HL hierarchy, or invalid data types. Use the 997 detail to locate the specific failing segment and repair the source EDI generation logic.

Q: Can PlainEDI detect SSCC/GS1 errors before sending to Amazon?

Yes. PlainEDI provides validation that checks SSCC length, GS1 check digits, and presence of MAN segments at pack-level HLs. PlainEDI flags missing or malformed SSCC values and provides actionable segment-level error messages so you can correct ASNs before transmission.

Q: What should I do if my carrier SCAC in TD5 doesn’t match Amazon's expected value?

Standardize carrier data at the EDI generation stage: map local carrier names to SCAC codes and use a canonical lookup table to populate TD5. If Amazon rejects due to SCAC mismatch, update your mapping and resend ASN. Use validation tools to flag unknown carriers during pre-send checks.

Q: How do I handle multiple orders in one ASN when converting to CSV?

When multiple order HLs are under a shipment HL, include the order number (PRF) on each flattened row derived from that order’s child item HLs. Your CSV will therefore contain rows that repeat shipment-level fields but have distinct order numbers and item lines, enabling order-level reconciliation in ERP.

Q: Are there Amazon-specific penalties for incorrect ASNs?

Retailers impose penalties for ASN noncompliance and carton-level inaccuracies (e.g., OTIF failures, ASN accuracy penalties, chargebacks). For Amazon, check the vendor portal for current penalty details (Last Updated: 2025-12-28). Verify current requirements with retailer portal.

Q: What is the best approach to prevent recurring ASN errors?

Implement automated pre-send validation that checks delimiters, required segments, HL integrity, SSCC format, and carrier mapping. Use a staging import to verify CSV outputs. Utilize PlainEDI to run automatic validation and produce human-readable diagnostics and CSV exports before you send the ASN to Amazon.

Call to Action

Ready to validate and convert your Amazon EDI 856s to CSV with automated checks? Upload your file to PlainEDI to detect delimiter issues, hierarchy errors, and generate a CSV mapped for ERP import. Use the validation report to fix errors before sending to Amazon and reduce 997 rejections and compliance penalties.