> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction Sets

> Every X12 and EDIFACT transaction set the StateSet EDI gateway supports, its direction, and the VES event it produces.

# Transaction Sets

One inbound endpoint auto-detects the syntax: X12 interchanges (`ISA`) are acknowledged with
a **997**, EDIFACT interchanges (`UNA`/`UNB`) with a **CONTRL**.

## X12

| Set     | Direction | Purpose                                                                                                                                                                           |
| ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **850** | inbound   | Purchase order → StateSet order-create payload                                                                                                                                    |
| **860** | inbound   | PO change/cancellation → `edi.purchase_order.changed` / `.cancelled`                                                                                                              |
| **855** | both      | PO acknowledgment — outbound (accept/backorder/reject); inbound → `edi.po_acknowledgment.received`                                                                                |
| **856** | both      | Advance ship notice — outbound S→O→I **or** S→O→P→I (carton level: `HL*P` + `MAN*GM` SSCC-18 per carton, for QVC-style pack compliance); inbound → `edi.shipment_notice.received` |
| **810** | both      | Invoice — outbound (ITD terms, exact-decimal TDS); inbound → `edi.invoice.received`                                                                                               |
| **832** | both      | Price/sales catalog — outbound publish; inbound ingest into the partner item master                                                                                               |
| **865** | outbound  | PO change acknowledgment                                                                                                                                                          |
| **940** | outbound  | Warehouse shipping order to a 3PL                                                                                                                                                 |
| **943** | outbound  | Warehouse stock-transfer shipment advice (stock inbound to a 3PL)                                                                                                                 |
| **944** | inbound   | Warehouse stock-transfer receipt advice → `edi.warehouse_receipt.received`                                                                                                        |
| **945** | inbound   | Warehouse shipping advice → `edi.warehouse_shipment.received` (short ships flagged)                                                                                               |
| **947** | inbound   | Warehouse inventory adjustment → `edi.inventory_adjustment.received` (damage / cycle-count)                                                                                       |
| **204** | outbound  | Motor-carrier load tender (offer a shipment to a carrier)                                                                                                                         |
| **210** | inbound   | Motor-carrier freight invoice → `edi.freight_invoice.received` (freight audit / AP)                                                                                               |
| **214** | inbound   | Carrier shipment status → `edi.shipment_status.received` (transit/delivery events + locations)                                                                                    |
| **846** | both      | Inventory advice → `edi.inventory_advice.received` (available / on-hand / backorder)                                                                                              |
| **852** | inbound   | Product activity → `edi.product_activity.received` (per-item sales/inventory for replenishment)                                                                                   |
| **820** | inbound   | Remittance advice → `edi.remittance.received` (per-invoice payment breakdown)                                                                                                     |
| **824** | inbound   | Application advice → `edi.application_advice.received` (a partner's accept/reject verdict on a document we sent, with error reasons)                                              |
| **864** | inbound   | Text message → `edi.text_message.received` (compliance / exception notices)                                                                                                       |
| **812** | inbound   | Credit/debit adjustment — the source of a captured [deduction](/stateset-edi/operations#deductions)                                                                               |
| **270** | outbound  | Healthcare eligibility inquiry (HIPAA 5010) — subscriber coverage check to a payer                                                                                                |
| **271** | inbound   | Healthcare eligibility response → `edi.eligibility.received` (active coverage, benefits, AAA errors)                                                                              |
| **997** | both      | Functional acknowledgment — generated per inbound group; parsed when partners ack ours                                                                                            |
| **TA1** | both      | Interchange acknowledgment — generated for invalid envelopes; parsed when received                                                                                                |

## EDIFACT

| Message    | Direction | Endpoint                                                      |
| ---------- | --------- | ------------------------------------------------------------- |
| **INVOIC** | outbound  | `POST /v1/edifact/outbound/invoic/{partner_id}`               |
| **DESADV** | outbound  | `POST /v1/edifact/outbound/desadv/{partner_id}`               |
| **CONTRL** | outbound  | Generated automatically for every inbound EDIFACT interchange |

Inbound EDIFACT arrives on the same `POST /v1/edi/inbound` endpoint as X12 — the syntax is
detected from the envelope.

## Outbound endpoints

Each outbound set takes StateSet-shaped JSON and returns enveloped wire format:

```
POST /v1/edi/outbound/204/{partner_id}
POST /v1/edi/outbound/270/{partner_id}
POST /v1/edi/outbound/810/{partner_id}
POST /v1/edi/outbound/832/{partner_id}
POST /v1/edi/outbound/846/{partner_id}
POST /v1/edi/outbound/855/{partner_id}
POST /v1/edi/outbound/856/{partner_id}
POST /v1/edi/outbound/865/{partner_id}
POST /v1/edi/outbound/940/{partner_id}
POST /v1/edi/outbound/943/{partner_id}
```

## Validation and debugging

Before sending anything live, dry-run it:

| Endpoint                             | Purpose                                                                     |
| ------------------------------------ | --------------------------------------------------------------------------- |
| `POST /v1/edi/parse`                 | Parse arbitrary X12 and return the envelope structure.                      |
| `POST /v1/edi/validate`              | Dry-run validation against the ISA-resolved partner's implementation guide. |
| `POST /v1/edi/validate/{partner_id}` | Dry-run validation against a specific partner's guide.                      |

A guide violation produces a **997 with an `R`** rather than a silent accept. An invalid
envelope produces a **TA1 rejection**. Nothing is ever consumed silently.

## Related

* [Transports](/stateset-edi/transports) — how documents arrive and leave
* [Operations](/stateset-edi/operations) — reconciliation, evidence, deductions
* [MCP server](/stateset-edi/mcp-server) — drive these flows from an agent
