Home /  Core / 

Generate and send EDI with Stedi Core

You can generate and send X12 EDI by providing JSON to the Core API or SDK. Core displays generated EDI files in the UI and delivers them to the destination specified in each partnership's connection settings.

Configure Core to generate EDI

To generate EDI, you must set up the following configuration in Core:

Profiles

Core profiles contain the information required to construct an Interchange Control Header (ISA), which is the official name for an X12 EDI envelope. The Local profile represents the sender of the EDI message, and the Partner profile refers to the recipient.
We recommend setting a default Application ID for each profile to populate the Functional Group Header (GS segment). Some trading partner relationships may require different Application IDs in some circumstances. In these cases, you can override the default ID in the Partnership’s transaction settings.

Partnership

Core partnerships represent an established relationship between one Local profile and one Partner profile. When you call the API or SDKs to generate an EDI file, you must specify a partnership ID. Within the partnership, define the following settings:
  • Connection: Create a connection that describes where the resulting EDI file should be delivered.
  • Transaction Settings: Define an outbound transaction setting for each transaction set you plan to send to your trading partner.

Core uses these settings across all instances of a given EDI transaction set within a partnership. For example, if you configure settings for an 810 Invoice inside a partnership from your business to Walmart, Core will apply those settings every time it generates an 810 for Walmart.

For step-by-step instructions, visit the Profiles and partnerships documentation.

Runtime data required to generate EDI

To generate an EDI document, you submit a single JSON payload to Core’s Generate API. The Generate API accepts multiple arrays of transactions in a single API call, allowing you to generate multiple Functional Groups in a single Interchange.
Core uses a Stedi guide to generate EDI according to partner-specific requirements. Each guide’s JSON schema represents the shape of the EDI transaction set that the guide defines. Before calling the Core Generate API, you must ensure that the payload from your source system matches the guide’s JSON schema.
We recommend using Stedi Mappings to transform outgoing data from your internal systems, such as ERPs, to the required structure. You can create mappings based on a Stedi guide and then call the Mappings API to transform JSON data into the required shape.
Note: The Generate API groups transactions into the correct Functional Group automatically, based on Functional Identifier Code.

Generate EDI

You can use the Stedi SDK or the Stedi HTTP API to generate EDI with Core.
For each successful generation call, Core emits a file.delivered event and one or more transaction.processed events, with the Direction SENT within the body of the event. Visit Events for details.

Stedi SDK

You can use the Stedi JavaScript/TypeScript SDK on any compatible Node-based runtime, such as Stedi Functions, AWS Lambda, Google Cloud Functions, or Azure Functions.
The following example shows how to use the SDK to generate an X12 5010 850. The main transactions array is abbreviated for readability.
import core from "@stedi/sdk-client-partners";

export const handler = async (event) => {
	const client = new core.PartnersClient({
		region: "us",
		apiKey: "YOUR_STEDI_API_KEY_HERE",
	});

	const { edi } = await client.send(
	    new core.GenerateEdiCommand({
  		  transactionGroups: [
        		{
            	transactionSettingId: "005010-850",
		    		transactions: [
        {
          heading: {...},
          detail: {...},
          summary: {...}
			},
			}
],
	    })
	);

	return { edi };
};

Stedi HTTP API

For environments not based on Node, you can integrate with the HTTP API directly. The following example shows a cURL request with the transactions array abbreviated for readability.
curl --location 'https://partners.us.stedi.com/2022-01-01/x12/partnerships/this-is-me_another-merchant/generate-edi' \
--header 'Content-Type: application/json' --header 'Authorization: Key YOUR_STEDI_API_KEY_HERE' \
--data-raw '{
    "transactionGroups": [
        {
        	"transactionSettingId": "005010-850",
		"transactions": [
  {
    "heading": { },  "detail": {},  "summary": {}
  }
  ]
}
      ]
    }'

View generated EDI

Both the SDK and HTTP API return the full X12 EDI interchange along with a unique artifactId that you can use to locate the generated document in Core’s File Executions page.
{
  artifactId: '341d7a6a-252f-4c5e-baf9-e0bdb32dbaae.x12',
  edi: 'ISA*00*      *00*      *ZZ*THISISME       *14*ANOTHERMERCH ... IEA*1*000000009~'
}
These generated files appear in the Core with the direction indicated as ↗ Sent. Each Transaction within the generated file also appears on the Transactions page.
Configure Core to generate EDIRuntime data required to generate EDIGenerate EDIView generated EDI

Feedback

Have an idea for something we could improve? Page not clear? We love feedback - send us a message.

Stedi

Build EDI integrations fast, without being an EDI expert

Start building
About
ProductPricingCareersContactBlog
Follow
  1. Twitter
  2. GitHub
Backed by
AdditionBloomberg BetaFirst RoundStripeUSV
Customer AgreementService TermsPrivacy Notice

Stedi is a registered trademark of Stedi, Inc. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.