POST
/
x12
/
partnerships
/
{partnershipId}
/
generate-edi
curl --request POST \
  --url https://core.us.stedi.com/2023-08-01/x12/partnerships/{partnershipId}/generate-edi \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "filename": "my-output-file.edi",
  "overrides": {
    "interchangeUsageIndicator": "T",
    "acknowledgmentRequestedCode": "1"
  },
  "transactionGroups": [
    {
      "transactionSettingId": "some-setting-id",
      "overrides": {
        "localApplicationId": "customLocal",
        "partnerApplicationId": "customPartner"
      },
      "transactions": [
        {
          "heading": {
            "transaction_set_header_ST": {
              "transaction_set_identifier_code_01": "850",
              "transaction_set_control_number_02": 1
            },
            "beginning_segment_for_purchase_order_BEG": {
              "transaction_set_purpose_code_01": "XX",
              "purchase_order_type_code_02": "XX",
              "purchase_order_number_03": "XXXXX",
              "date_05": "2023-08-11"
            }
          },
          "detail": {
            "baseline_item_data_PO1_loop": [
              {
                "baseline_item_data_PO1": {}
              }
            ]
          },
          "summary": {
            "transaction_set_trailer_SE": {
              "number_of_included_segments_01": 4,
              "transaction_set_control_number_02": 1
            }
          }
        }
      ]
    }
  ]
}'
{
  "edi": "ISA*00*          *00*          *14*ANOTHERMERCH   *ZZ*THISISME       *230828*0900*^*00801*000000002*1*P*>~GS*PO*ANOTHERMERCH*THISISME*20230828*090020*000000002*X*008010~ST*850*0001~BEG*XX*XX*XXXXX**20230811~PO1~SE*4*0001~GE*1*000000002~IEA*1*000000002~",
  "artifactId": "f75168e4-e682-4410-bfec-b5b1541c7f21.x12",
  "fileExecutionId": "f75168e4-e682-4410-bfec-b5b1541c7f21"
}

When you call this endpoint, Stedi:

  1. Generates a single EDI file containing all transactions according to the Stedi guide attached to each outbound transaction setting. This includes adding required envelope information (ISA and GS headers) and autogenerated control numbers.
  2. Delivers the EDI file to your trading partner through the connection specified in the transaction settings.

Transaction data

You must provide transaction data in Guide JSON format. The transaction data must be < 5MB.

Delivery attempts

Stedi attempts to deliver a file to all configured connections every 6 minutes for up to 3 total attempts. If it cannot deliver the file after the third attempt, it marks the file execution as FAILED and emits the file.failed.v2 event. Stedi displays each delivery attempt and the failure details on the Files page.

Customize generated files

You can change the timezone, time format, character set (which characters are allowed), and filename for generated files. Learn more.

Inbound processing

There is no equivalent endpoint for parsing EDI files into JSON. To parse inbound files, you or your partner can send EDI files to an SFTP/FTPS or AS2 connection, and Stedi sends the JSON payload to the configured Destination webhook.

Authorizations

Authorization
string
header
required

A Stedi API Key for authentication.

Headers

Idempotency-Key
string

A unique string to identify this request to the server. The key can be up to 255 characters. You can safely retry requests with the same idempotency key within 24 hours of making the first request. This prevents sending duplicate data to your trading partners in case of network errors or other intermittent failures. Learn more.

Path Parameters

partnershipId
string
required

A unique ID for this partnership within Stedi. You can find this ID on the Trading partners page under Partnership identifier.

Required string length: 1 - 81

Body

application/json

Response

200
application/json
GenerateEdi 200 response

The response is of type object.