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
Load your stock
Read every page of List stock once. Note the time before you start.
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 "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 "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 -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"
}
]
}'