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

# Split inbound EDI files with fragments

<Note>
  This functionality is available in a Stedi module. [Contact us](https://www.stedi.com/contact) for details.
</Note>

Once you [configure fragments](/edi-platform/fragments/index) for an inbound transaction setting, Stedi splits the translated transaction payload into chunks based on the selected segment.

## Processing events

Stedi emits two types of events for inbound transactions with fragments enabled: `transaction.processed.v2` and `fragment.processed.v2`.

For example, if you enable fragments on `Loop 2000` (Member Level Detail) in an 834 Healthcare Benefit Enrollment. Stedi will fragment a translated 834 file and emit the following events:

* One [`transaction.processed.v2` event](/edi-platform/operate/event-types#transaction-processed) for each unique transaction set that was included in the original file.
* One or more [`fragment.processed.v2` events](/edi-platform/operate/event-types#transaction-processed). Each fragment contains several iterations of `Loop 2000` (Member Level Detail), the start of which is indicated by the presence of the required initial `INS` segment.

## Ingest fragments

You have two options for ingesting fragments from processed inbound transactions into your downstream system.

### Fragment processed events

Configure a [webhook](/edi-platform/configure/webhooks/configure-webhooks) for fragment processed events. As Stedi emits these events, use the [Get Fragment](/api-reference/edi-platform/core/get-transaction-fragment-detail) endpoint to retrieve each processed fragment from Stedi.

### Transaction processed events

Configure a [webhook](/edi-platform/configure/webhooks/configure-webhooks) for transaction processed events only. After you receive a transaction processed event, use the API to retrieve associated fragments in batches according to your system's requirements.

The event payload includes a `fragments` object with general information about the fragments that Stedi created.

<Accordion title="transaction processed event with fragments enabled">
  <CodeGroup>
    ```json Translated inventory file with fragments
    {
      "event": {
        "version": "0",
        "id": "85634bf9-8359-4a9b-b8f3-66616d896f51",
        "detail-type": "transaction.processed.v2",
        "source": "stedi.core",
        "account": "<ACCOUNT_ID>",
        "time": "2023-11-13T15:47:09Z",
        "region": "us-east-1",
        "resources": [
          "https://core.us.stedi.com/2023-08-01/transactions/1b1d2424-72ba-4157-bcfa-3e1620430a3f"
        ],
        "detail": {
          "transactionId": "1b1d2424-72ba-4157-bcfa-3e1620430a3f",
          "direction": "INBOUND",
          "mode": "production",
          "fileExecutionId": "bb141a6f-79f8-9c88-9b91-37609ddd90f9",
          "processedAt": "2023-11-13T15:47:09.231Z",
          "fragments": {
            "batchSize": 800,
            "fragmentCount": 1,
            "keyName": "member_level_detail_INS_loop"
          },
          "artifacts": [
            {
              "artifactType": "application/edi-x12",
              "usage": "input",
              "url": "https://core.us.stedi.com/2023-08-01/transactions/1b1d2424-72ba-4157-bcfa-3e1620430a3f/input",
              "sizeBytes": 665,
              "model": "transaction"
            },
            {
              "artifactType": "application/json",
              "usage": "output",
              "url": "https://core.us.stedi.com/2023-08-01/transactions/1b1d2424-72ba-4157-bcfa-3e1620430a3f/output",
              "sizeBytes": 825,
              "model": "transaction"
            }
          ],
          "partnership": {
            "partnershipId": "sender_receiver",
            "partnershipType": "x12",
            "sender": { "profileId": "sender" },
            "receiver": { "profileId": "receiver" }
          },
          "x12": {
            "transactionSetting": {
              "guideId": "01H9JMMG4839VQG9QQVSZ6X29G",
              "transactionSettingId": "01HF4N77F5YWA2RXEDMMF5FF6J"
            },
            "metadata": {
              "interchange": {
                "acknowledgmentRequestedCode": "0",
                "controlNumber": 76
              },
              "functionalGroup": {
                "controlNumber": 76,
                "release": "004010",
                "date": "2022-09-24",
                "time": "20:01",
                "functionalIdentifierCode": "IB"
              },
              "transaction": {
                "controlNumber": "319101",
                "transactionSetIdentifier": "834"
              },
              "receiver": {
                "applicationCode": "RECEIVER",
                "isa": { "qualifier": "ZZ", "id": "RECEIVER" }
              },
              "sender": {
                "applicationCode": "SENDER",
                "isa": { "qualifier": "ZZ", "id": "SENDER" }
              }
            }
          },
          "connectionId": "01H1CH2ZES1Z8AW94A3RQSRWRW" // optional
        }
      }
    }
    ```
  </CodeGroup>
</Accordion>

## Retrieve inbound transaction with fragments

Stedi does not store the complete transaction for inbound files with fragments enabled. When you use Stedi's [Get Transaction](/api-reference/edi-platform/core/get-transactions) endpoint to retrieve inbound transactions with fragments, Stedi always returns the fragment wrapper (the transaction minus fragments).

You cannot retrieve the complete transaction with fragments included - you must use the [Get Fragment](/api-reference/edi-platform/core/get-transaction-fragment-detail) endpoint to retrieve the fragments separately.
