> ## 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.

# Inbound AS1 (EDI-over-email) receive path: the mail service forwards a

> received email as JSON; we extract the EDI interchange and run it through the standard inbound pipeline (parse → validate → acknowledge → translate → sync)…

received email as JSON; we extract the EDI interchange and run it through
the standard inbound pipeline (parse → validate → acknowledge → translate →
sync). Bearer-authenticated — the mail service is a trusted first-party
caller carrying the platform token.

### Request body

JSON body of type `crate.as1.As1InboundEmail`.

### Response

`InboundResult`

<ResponseField name="ack_997" type="string">
  Serialized 997 interchange acknowledging what we received. `None` when the inbound interchange only contained FA groups or was rejected.
</ResponseField>

<ResponseField name="ack_contrl" type="string">
  Serialized EDIFACT CONTRL acknowledgment, for inbound EDIFACT interchanges.
</ResponseField>

<ResponseField name="ack_ta1" type="string">
  Serialized TA1 interchange rejection, when envelope validation failed.
</ResponseField>

<ResponseField name="documents" type="InboundDocument[]" required>
  <Expandable title="InboundDocument">
    <ResponseField name="control_number" type="string" required />

    <ResponseField name="error" type="string" />

    <ResponseField name="parsed" type="object" />

    <ResponseField name="reference" type="string" required />

    <ResponseField name="status" type="string" required />

    <ResponseField name="transaction_set" type="string" required />
  </Expandable>
</ResponseField>

<ResponseField name="error" type="string" />

<ResponseField name="events_queued" type="integer" required />

<ResponseField name="interchange_control_number" type="string" required />

<ResponseField name="partner_id" type="string" required />

<ResponseField name="status" type="string" required>
  `processed` or `interchange_rejected`.
</ResponseField>

### Status codes

| Code  | Meaning                                              |
| ----- | ---------------------------------------------------- |
| `200` | Processing result with 997/TA1 acknowledgment        |
| `404` | No partner matches the ISA sender                    |
| `409` | Duplicate interchange control number                 |
| `422` | Email carries no EDI attachment/body, or unparseable |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://edi.stateset.com/v1/as1/inbound' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "ack_997": "string",
    "ack_contrl": "string",
    "ack_ta1": "string",
    "documents": [
      {
        "control_number": "string",
        "error": "string",
        "parsed": {},
        "reference": "ORD-10042",
        "status": "pending",
        "transaction_set": "string"
      }
    ],
    "error": "string",
    "events_queued": 1,
    "interchange_control_number": "string",
    "partner_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "status": "pending"
  }
  ```
</ResponseExample>
