ml-connector
Sage X3Stedi

Sage X3 and Stedi integration

Sage X3 manages procurement, but your suppliers expect EDI. Stedi translates JSON to X12 files and routes them via SFTP, AS2, or webhooks. Connecting the two keeps supplier orders synchronized and brings trading partner acknowledgments and shipment notices back into Sage X3 without manual re-entry. ml-connector handles Sage X3's token refresh, Stedi's Idempotency-Key requirement, and the full data mapping between ERP records and EDI formats.

How Sage X3 works

Sage X3 is a mid-market ERP available on-premise or in the cloud, covering manufacturing, procurement, finance, and project management. It exposes suppliers, purchase orders, invoices, and GL accounts through REST (legacy api1), GraphQL (Xtrem), or SOAP. Access is secured with OAuth2 client credentials for GraphQL or HTTP Basic auth for REST, and customers must provide their own server URL and folder name since there is no shared tenant registry. Sage X3 does not support native webhooks or outbound event push, so records are read by polling using the updatedDate field to detect changes since the last poll. Access tokens expire in 5 minutes, and refresh tokens are valid for 30 days.

How Stedi works

Stedi is a cloud EDI integration platform that translates JSON to X12 EDI formats and routes files to trading partners via SFTP, AS2, or webhook. It accepts REST calls with JSON bodies, secured with a static API key that does not expire unless manually revoked. Stedi handles the full EDI format library including 850 Purchase Orders, 810 Invoices, 855 Acknowledgments, and 856 Advance Shipment Notices. Inbound EDI files are parsed to JSON and pushed via webhook (transaction.processed event), and outbound writes require an Idempotency-Key header for 24-hour deduplication. Webhook endpoints must respond within 5 seconds and present a publicly trusted TLS certificate.

What moves between them

Purchase orders and invoices flow from Sage X3 into Stedi as 850 and 810 EDI documents, which Stedi routes to your trading partners via SFTP or AS2. Inbound 855 Purchase Order Acknowledgments and 856 Advance Shipment Notices arrive via Stedi webhook, are parsed to JSON, and are written back into Sage X3's purchase order and inventory records. The sync is continuous on a configurable schedule; Sage X3 is polled for changes to PO and invoice records, and Stedi webhooks push trading partner responses in real-time.

How ml-connector handles it

ml-connector polls Sage X3 on a schedule you set, reading purchase orders and supplier invoices via the REST or GraphQL interface, and handling OAuth2 token refresh automatically when 5-minute access tokens expire. Each PO and invoice is transformed to the appropriate Stedi EDI format (850 or 810), then posted to Stedi with an Idempotency-Key header to prevent duplicates if a network failure triggers a retry. On the inbound side, ml-connector listens for Stedi webhook pushes (transaction.processed events), parses the EDI 855 and 856 documents back to JSON, and writes the results into Sage X3's PO records using the same refresh logic. Because Sage X3 returns access tokens valid only 5 minutes and Stedi requires the Idempotency-Key header with a 24-hour deduplication window, ml-connector caches tokens until expiry and generates stable keys based on ERP record IDs. Every record is tracked with a full audit trail, and any failed write is queued for replay after a downstream issue is resolved.

A real-world example

A mid-sized electronics distributor runs Sage X3 for procurement and inventory, and supplies parts to three large OEMs that require EDI 850 and 856 data interchange. Before the integration, the procurement team exported purchase orders from Sage X3, manually reformatted them to EDI 850 files, and sent them via SFTP to each partner. When shipments arrived, partners sent back 856 advance notices via EDI, which the team manually parsed and re-entered into Sage X3 to update receipt dates and quantities. With Sage X3 and Stedi connected, each PO flows to trading partners in EDI format automatically, and inbound acknowledgments and shipment notices update Sage X3 without re-keying. Procurement staff spend less time on formatting and re-entry, and receiving teams see accurate shipment data as soon as the partner sends it.

What you can do

  • Send purchase orders from Sage X3 to Stedi as 850 EDI documents for your trading partners.
  • Send supplier invoices from Sage X3 to Stedi as 810 EDI documents.
  • Receive 855 Purchase Order Acknowledgments from Stedi and write confirmation status back into Sage X3.
  • Receive 856 Advance Shipment Notices from Stedi and update Sage X3 inventory receipt records.
  • Handle OAuth2 token refresh, Idempotency-Key deduplication, and a full audit trail for every order and shipment.

Questions

How does ml-connector handle Sage X3 tokens that expire every 5 minutes?
ml-connector caches the OAuth2 access token after each refresh call and tracks its 5-minute expiry window. When a cached token is near expiry, it requests a fresh one using the refresh token (valid 30 days). If a write call returns a 401 Unauthorized, ml-connector refreshes immediately and retries the request without losing data.
Why does Stedi require an Idempotency-Key header, and what happens if the network fails during a write?
Stedi uses the Idempotency-Key to deduplicate retries across a 24-hour window. If a network failure occurs after ml-connector posts a 850 or 810 to Stedi but before receiving a response, ml-connector retries the same request with the same key, and Stedi recognizes it as a duplicate and returns the original result. This prevents double-posting a PO or invoice to your trading partners.
Does ml-connector need to write back into Stedi, or only into Sage X3?
ml-connector only writes into Sage X3 (and reads from both). Stedi acts as the translation platform; trading partners send EDI files to Stedi, which pushes them to ml-connector via webhook, and ml-connector parses and writes the results into Sage X3. ml-connector does not write back to Stedi because Stedi is the gateway, not the system of record.

Related integrations

Connect Sage X3 and Stedi

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started