POST
/
partnerships
/
{partnershipId}
/
transactions
/
{transactionSettingId}
curl --request POST \
  --url https://core.us.stedi.com/2023-08-01/partnerships/{partnershipId}/transactions/{transactionSettingId} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "filename": "my-output-file.edi",
  "transaction": {
    "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
      }
    }
  }
}'
{
  "fileExecutionId": "d3b3e3e3-3e3e-3e3e-3e3e-3e3e3e3e3e3e"
}

When you call the endpoint, Stedi:

  1. Applies the mapping (if present) to the provided transaction data.
  2. Adds fragments from specified fragment groups (if present).
  3. Generates an EDI file according to the Stedi guide attached to the outbound transaction setting. This includes adding required envelope information (ISA and GS headers) and autogenerated control numbers.
  4. Delivers the EDI file to your trading partner through the connection specified in the outbound transaction setting.

Visit Generate EDI for step-by-step instructions to format transaction data and make requests.

Response

When you deliver a single transaction without any fragment groups, this endpoint is synchronous, and you will receive any errors. If you are using more advanced features, generation may be asynchronous. In both cases, you can use the returned fileExecutionId to check the status of the delivery and retrieve the execution input, output, and metadata for the generated file.

Transaction data

The endpoint supports three ways to provide transaction data:

  • No mapping or fragments: You provide transaction data in Guide JSON format. The transaction data must be < 5MB.
  • Mapping: You provide transaction data in the source schema format for the specified Stedi mapping. The transaction data that you want to map must be < 4MB.
  • Fragments: You provide the fragment wrapper in Guide JSON format. Visit outbound fragments for more details and examples.

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
headerrequired

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
transactionSettingId
string
required

A unique ID for the outbound transaction setting Stedi should use to determine the correct guide for validation and generation. It must be attached to the partnership associated with the partnershipId. To find the transactionSettingsId, go to the partnership and use the Transaction Setting ID field for the outbound transaction setting. If you are generating a transaction with fragments, the associated guide must be configured to use fragments.

Body

application/json
transaction
any
required

The data for an EDI transaction. If you are not using a mapping, this transaction data must be < 5MB and the shape should match the Guide JSON format for the specified outbound transaction setting. If you are using a mapping, this transaction data must be < 4MB and the shape must match the source schema for the specified mapping.

filename
string

Set a custom name for 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 the same ID generated for the fileExecutionId.

Required string length: 1 - 300
fragmentGroupIds
string[]

Specify the fragment groups to include when creating this transaction. You can only generate EDI with a fragment group once. After you include a fragment group in generation call, Stedi locks the fragment to prevent accidentally generating transactions with duplicate data.

mappingId
string

Specify a mapping ID to transform the transaction data to Guide JSON format. You can find the mapping ID on the Mappings page in the Stedi app.

interchangeOverrides
object

Response

200 - application/json
transactionId
string

This property is currently not supported. It is reserved for future use.

fileExecutionId
string

An ID for the process Stedi uses to generate the EDI file. This ID appears on the details page for the generated file in the Stedi app, and you can use it to trace the file's status and delivery.