O2M Logo
One to Many
Keep an ERP in step
Was this page helpful?

Keep an ERP in step

Copy stock, orders and goods receipts between O2M and your ERP.

Overview

This guide keeps an ERP up to date with O2M, using webhooks for speed and regular reads for certainty.

What you will build

First load

read all stock

Live changes

webhooks

Regular check

updated_since

Goods arrive

POST /goods-receipts

Figure 27.1  Keeping an ERP in step with O2M.

Load your stock

Read every page of List stock once. Note the time before you start.

cURL
curl "https://api.o2m.in/api/v1/stock?limit=500" \
  -H "X-Access-Key: $O2M_ACCESS_KEY" \
  -H "X-Secret-Key: $O2M_SECRET_KEY"

Follow changes

Add a webhook address with stock.changed and order.created. For each order.created, retrieve the order to get its lines.

On a schedule, say every 15 minutes, ask for what changed since your last read. This catches anything a webhook missed.

cURL
curl "https://api.o2m.in/api/v1/stock?updated_since=2026-10-02T10:00:00Z" \
  -H "X-Access-Key: $O2M_ACCESS_KEY" \
  -H "X-Secret-Key: $O2M_SECRET_KEY"
cURL
curl "https://api.o2m.in/api/v1/orders?updated_since=2026-10-02T10:00:00Z" \
  -H "X-Access-Key: $O2M_ACCESS_KEY" \
  -H "X-Secret-Key: $O2M_SECRET_KEY"

Follow every movement

For an audit trail, follow List stock movements. Keep the last next and pass it as cursor each time.

Send goods receipts

When your ERP records goods arriving, create a goods receipt with an Idempotency-Key built from your own document number.

cURL
curl -X POST "https://api.o2m.in/api/v1/goods-receipts" \
  -H "X-Access-Key: $O2M_ACCESS_KEY" \
  -H "X-Secret-Key: $O2M_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: receipt-INV-88" \
  -d '{
  "warehouse_code": "BLR",
  "invoice_no": "INV-88",
  "note": "From the factory",
  "lines": [
    {
      "sku": "MUG-BLUE",
      "qty": 100,
      "lot_no": "L-2026-10",
      "expiry_date": "2027-10-01"
    }
  ]
}'