PO workflow: API call sequence
As a purchase order moves from upload to submitted draft sales order, OrderBridge calls your ERP connection at each stage. The sequence below shows which endpoints to build first and when each request is sent.
Stage details
1. Ingest
The PO arrives as a PDF upload or email and is parsed into line items. No ERP calls happen at this stage. Everything below is triggered by operator actions on the extracted PO.
2. Match customer
The operator searches for the buying customer by name or code.
- Endpoint:
POST /catalog/customers/searchwithqueryandlimit. - Return: a
hits[]array witherpIdanderpName. Alderstone scores match confidence; return rows in relevance order without aconfidencefield.
3. Match products
Each PO line is matched to an ERP product, by free-text search or SKU lookup.
- Endpoint:
POST /catalog/products/searchorPOST /catalog/products/by-sku. - Return:
hits[]witherpSku,erpProductId, and a description.
4. Addresses
When the order needs ship-to or billing locations:
- Endpoint:
POST /catalog/customers/addresseswith the matchedcustomerIdand an optionalkindfilter.
5. Price check
For each matched line, OrderBridge asks what the ERP thinks the unit price should be, and flags lines where the PO price disagrees.
- Endpoint:
POST /pricing/resolvewithcustomerErpIdandproductErpId. - Return:
systemUnitPricein the same currency and precision as the PO line. Returnnullwhen no price exists.
6. Allocation (only when SKU caps are configured)
If the company caps how many units of a SKU a customer may order in a period, OrderBridge sums historical usage before allowing the line through.
- Endpoint:
POST /sales-orders/usagewithcustomerErpId,sku,periodStart, andperiodEnd. - Return:
units. A non-negative integer sum of ordered quantity in the window.
7. Submit
The operator confirms the PO and OrderBridge creates the draft sales order in your ERP.
- Endpoint:
POST /sale-draftwithpoNumber,currency, andlines[]. - Return:
saleId, optional human-readablesaleNumber,status: "draft", and areceivedAtISO datetime. - Idempotency matters here: if the same
poNumberis submitted again (retry, double-click, network blip), return the existingsaleIdinstead of creating a duplicate order.
The connection test on save
When a REST integration is saved in Settings → Integrations, OrderBridge immediately calls:
POST /healthPOST /sale-draftwith a sample body (PO numberDEMO-PO-001, a demo SKU)
Both must succeed before the connection status becomes connected, so make sure your test environment accepts the demo SKU or returns a clear validation error. See Troubleshooting if the test fails.