You can customize an EDI file’s Interchange (ISA) and Group (GS) headers - also known as the envelope - using the Create Outbound Interchange endpoint.

If you don’t need to customize the envelope, we strongly recommend generating EDI files with the Create Outbound Transaction endpoint instead because it is simpler and easier to use.

Interchange overrides

You can customize the following elements in the ISA header:

  • Interchange Authorization values (ISA-01 to ISA-04): Some trading partners require additional information in these elements to verify the transaction.
  • Interchange Version Control Number Code (ISA-12): Stedi defaults to using the X12 release number of the guide associated with the transaction. However, some partners require a different release for the ISA envelope.
  • Acknowledgment Requested Code (ISA-14): This code indicates whether you are requesting a TA1 Interchange Acknowledgments.
  • Interchange Usage Indicator Code (ISA-15): This code indicates whether data is test, production, or information. Stedi defaults to P for production data, but you may need to set this to T when sending test data.

Visit the Create Outbound Transaction documentation for more details.

curl --location 'https://core.us.stedi.com/2023-08-01/x12/partnerships/<PARTNERSHIP_ID>/generate-edi' \
--header 'Content-Type: application/json' --header "Authorization: ${STEDI_API_KEY}" \
--data-raw '{
  "filename": "my-output-file.edi",
  "overrides": {
    "acknowledgmentRequestedCode": "1",
    "interchangeUsageIndicator": "T",
    "interchangeControlVersionNumberCode": "00200"
  },
  "transactionGroups": [
    {
      "transactionSettingId": "<TRANSACTION_SETTING_ID>",
      "transactions": [
        {
          "heading": {},
          "detail": {},
          "summary": {}
        }
      ]
    }
  ]
}'

Group overrides

By default, Stedi generates EDI files using the application IDs (GS-02 and GS-03 elements) configured for each profile within the partnership. However, some partners use multiple application IDs to route files to different locations.

To set custom application IDs, set the localApplicationId and the partnerApplicationId properties in the override object. These values are optional; you should only send them when you need to override the application IDs configured within each profile.

You can include multiple overrides objects to customize the application IDs for each transaction group in the file.

curl --location 'https://core.us.stedi.com/2023-08-01/x12/partnerships/<PARTNERSHIP_ID>/generate-edi' \
--header 'Content-Type: application/json' --header "Authorization: ${STEDI_API_KEY}" \
--data-raw '{
  "filename": "my-output-file.edi",
  "transactionGroups": [
    {
      "transactionSettingId": "<TRANSACTION_SETTING_ID>",
      "overrides": {
        "localApplicationId": "LOC1",
        "partnerApplicationId": "PART1"
      },
      "transactions": [
        {
          "heading": {},
          "detail": {},
          "summary": {}
        }
      ]
    },
     {
      "transactionSettingId": "<TRANSACTION_SETTING_ID>",
      "overrides": {
        "localApplicationId": "LOC2",
        "partnerApplicationId": "PART2"
      },
      "transactions": [
        {
          "heading": {},
          "detail": {},
          "summary": {}
        }
      ]
    }
  ]
}'

Call the Interchange API

The Create Outbound Interchange endpoint can generate fully-formed EDI files containing multiple transactions and even multiple transaction types.

Request data

The API uses the following data to generate and deliver an EDI file.

DataRequiredDescription
partnershipIdYesInclude this ID within the API route to identify the associated partnership. You can find this ID on the Trading partners page under Partnership identifier.
transactionGroupsYesThe Generate API accepts multiple arrays of transactions in a single API call, allowing you to send multiple transactions or even multiple functional groups in a single file. If you only plan to send a single type of transaction (such as a Purchase Order), then your API request should have one transaction group.
transactionGroups.transactionSettingIdYesThis ID specifies the outbound transaction setting Stedi should use to validate the transaction data and generate the file. To find this ID, go to the partnership, find the outbound transaction setting, and copy its Transaction Setting ID.
transactionGroups.transactionsYesThis object contains the transaction data. It must conform to the Guide JSON format for the specified transaction setting.
filenameSpecify the name of the generated EDI file. Stedi overwrites files with the same name, so we recommend making the filename unique by including a timestamp or other identifier. If you do not specify a filename, Stedi autogenerates a unique name using a UUID.
Envelope overridesYou can use several optional parameters to customize aspects of the EDI envelope - both the ISA header and GS header.

Sample request and response

The following example shows a cURL request and response.

The API returns the full X12 EDI file in the response. The response also includes an artifactId (equivalent to the file name) and a globally unique fileExecutionId that you can use to locate the generated file.

curl --location 'https://core.us.stedi.com/2023-08-01/x12/partnerships/<PARTNERSHIP_ID>/generate-edi' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header "Authorization: ${STEDI_API_KEY}" \
  --data '{
  "filename": "<OPTIONAL_FILENAME>",
  "transactionGroups": [
    {
      "transactionSettingId": "<TRANSACTION_SETTING_ID>",
      "transactions": [
        {
          "heading": {},
          "detail": {},
          "summary": {}
        }
      ]
    }
  ]
}'