This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
MRPeasy + n8n: Auto-Generate Purchase Orders When Inventory Hits Minimum Stock
Running out of a critical component mid-production is one of the most avoidable disruptions in manufacturing — yet it still happens constantly in small and mid-sized operations. The fix is not hiring someone to stare at stock levels all day. The fix is automation. By connecting MRPeasy with n8n, you can build a workflow that monitors your inventory in real time and fires off a purchase order the moment a part or material drops to its minimum stock threshold.
This guide walks you through exactly how to set that up — no custom code required, no expensive middleware, just a clean workflow that runs in the background while your team focuses on production.
What You Need Before You Start
- MRPeasy account — with API access enabled (available on Starter plan and above)
- n8n instance — either self-hosted (free) or via n8n, which offers n8n Cloud with 400+ integrations and no infrastructure to manage
- Supplier data in MRPeasy — each item that needs auto-ordering must have a default supplier and a minimum stock level configured
- MRPeasy API key — found under Settings → Integrations → API in your MRPeasy dashboard
How the Workflow Logic Works
The core idea is simple: n8n polls the MRPeasy API on a schedule, checks current stock quantities against the defined minimum levels, and — when a shortfall is detected — creates a purchase order automatically in MRPeasy and optionally sends a notification to your purchasing team.
Here is the step-by-step flow:
- Trigger: A Schedule node runs the workflow every hour (or at whatever interval fits your operation).
- Fetch stock levels: An HTTP Request node calls the MRPeasy REST API endpoint
GET /api/v1/stock/to retrieve current quantities for all tracked items. - Filter below-minimum items: A Function or IF node compares
quantity_on_handagainstminimum_stockfor each item and passes only those that are at or below the threshold. - Check for open POs: An optional HTTP Request node calls
GET /api/v1/purchaseorders/and filters for open orders containing the same item — preventing duplicate orders from being created. - Create purchase order: For items that pass both filters, a POST request to
/api/v1/purchaseorders/creates the PO with the item, quantity to order (reorder quantity from MRPeasy), supplier ID, and expected delivery date. - Notify the team: A final node sends a Slack message, email, or Teams notification summarising which POs were created, what was ordered, and from which supplier.
Setting Up the MRPeasy API Call in n8n
Step 1 — Add an HTTP Request node
In your n8n canvas, add an HTTP Request node after the Schedule trigger. Set the method to GET and the URL to:
https://app.mrpeasy.com/api/v1/stock/
Under Authentication, choose Header Auth and add your MRPeasy API key as:
- Header name:
Authorization - Header value:
Bearer YOUR_API_KEY
Step 2 — Filter with a Function node
Add a Function node and use this logic to extract items below minimum stock:
const items = $input.all();
return items.filter(item => {
const qty = item.json.quantity_on_hand;
const min = item.json.minimum_stock;
return qty !== null && min !== null && qty <= min;
});
Step 3 — Deduplicate with an open PO check
Before creating a new PO, fetch existing open purchase orders via GET /api/v1/purchaseorders/?status=open and use an IF node to skip any item that already has an open order. This prevents the workflow from flooding your suppliers with duplicate requests if it runs frequently.
Step 4 — POST the new purchase order
Add another HTTP Request node, set it to POST, and point it to /api/v1/purchaseorders/. In the JSON body, map the following fields from the filtered stock data:
item_id— the MRPeasy product IDsupplier_id— from the item's default supplier fieldquantity— use the item'sreorder_quantityfield, or calculate it asminimum_stock - quantity_on_hand + safety_bufferexpected_delivery— today's date plus the item's configured lead time in days
Extending the Workflow
Multi-supplier logic
If some items have multiple approved suppliers, you can add a Switch node that selects the preferred supplier based on lead time, price tier, or availability — all stored as custom fields in MRPeasy.
Approval gate
Instead of creating POs automatically, you can route large orders (above a defined value threshold) to a Slack approval step. A manager clicks Approve or Reject directly in Slack before the PO is submitted to MRPeasy. n8n's Wait node handles this elegantly.
Google Sheets log
Append every auto-generated PO to a Google Sheet for audit purposes — date, item, quantity, supplier, and PO reference number. This gives your finance team a clean paper trail without requiring them to log in to MRPeasy.
Common Mistakes to Avoid
- Not setting minimum stock in MRPeasy: The workflow cannot trigger if the field is empty. Audit your item master before activating.
- Missing default supplier: Each item must have a default supplier configured or the POST will fail. Use an error branch to catch these and notify a human.
- Running too frequently: Polling every 5 minutes is rarely necessary for inventory checks and can hit API rate limits. Every 1–4 hours is usually sufficient.
- No duplicate PO check: Skipping step 3 above means the workflow may create multiple POs for the same item on consecutive runs before the first order is received and stock is updated.
Results You Can Expect
Small manufacturers who implement this pattern typically report:
- Elimination of manual daily stock checks for reorder decisions
- Faster PO creation — from hours to seconds once a threshold is crossed
- Fewer stockouts, since the buffer is enforced automatically every time the workflow runs
- A clear audit trail of every auto-generated order, with timestamps and quantities
The investment is a few hours of setup. The payoff is a procurement process that runs itself.
If you manage inventory for a small or mid-sized manufacturing operation, you can track stock levels and manage purchasing via MRPeasy — including production planning, inventory and purchasing in one cloud ERP — to stop stockouts before they disrupt your production line.