Miridia
Portal
Guides

Inventory

Track stock for each product at each location with an append-only movement ledger. Adjust, count, transfer, trace, and set reorder points.

Miridia holds stock for each product at each location. Each change to stock is a movement. Movements are never changed or deleted. The list of movements is the ledger, and the ledger is the audit record of your stock.

The inventory record

Each product at each location has one inventory record. The record holds:

  • On hand: the stock that is physically at the location.
  • Reserved: the stock that is promised to an order.
  • In transit: the stock that is on the way to the location from another location.
  • The costing method: WeightedAverage or Fifo.
  • The average cost and the last purchase cost.
  • The reorder point, the reorder quantity, and the safety stock.

To see the stock of one product at all locations, get the inventory by product. To see all products at one location, get the inventory by location.

Movements

Each movement records:

  • the movement type
  • the quantity
  • the running balance after the movement
  • the source document, for example a purchase order or a work order
  • the effective date
  • the reason, for a movement that a person posts
  • a note

The movement types are:

TypeCause
PurchaseA purchase order receipt.
SaleA sale to a customer.
TransferOutStock leaves a location on a transfer.
TransferInStock arrives at a location on a transfer.
AdjustmentA manual correction or a stock take.
AssemblyConsumptionA work order uses a component.
AssemblyProductionA work order produces a finished good.
ReturnA customer returns stock.
WriteOffStock is damaged, expired, or lost.
To correct an error, add a new movement with a note. Do not try to remove the incorrect movement. Both the error and the correction stay visible. This is the property that an auditor for FSSC 22000, HACCP, or ISO needs.

Costing

Miridia keeps the weighted average cost up to date from the ledger. Each receipt at a different price changes the average. A work order that uses a component then uses what the component really cost, not a list price.

The cost history endpoint gives the history of the average cost for a product.

Adjust stock

Use an adjustment to correct stock by hand, for example after a breakage. A person can post four movement types. Documents post the other types: a purchase order receipt posts Purchase, a shipment posts Sale, a transfer posts TransferOut and TransferIn, and a work order posts AssemblyConsumption and AssemblyProduction.

TypeDirectionReason
AdjustmentIn or out. The sign of quantity gives the direction.Required
WriteOffOut. quantity must be negative.Required
ReturnIn. quantity must be positive.Optional
SaleOut. quantity must be negative.Optional

Use Sale for a sale that has no order in Miridia, for example a till sale in a shop.

POST /api/v1/inventory/adjust
{
  "productId": "5b0c7a3e-1f0d-4a8e-9c2b-2f2d1c9e7a11",
  "locationId": "0f6c1b52-8d7e-4c0a-b3a9-6a1e5d2c4b77",
  "quantity": -3,
  "movementType": "WriteOff",
  "reason": "Damaged",
  "notes": "Three tubs damaged in the freezer"
}

Reasons

A reason tells why a person changed the stock. Reports can then group the losses by cause.

ReasonUse
CountDifferenceA stock count found a difference. A count sets this reason.
DamagedThe stock is broken or spoilt.
ExpiredThe stock is past its expiry date.
LostOrStolenThe stock is missing.
FoundStock that was not in the ledger is found.
QualityRejectedA quality check rejected the stock.
SampleOrPromotionThe stock was given away as a sample or for a promotion.
OtherAny other cause. notes is then required.

A movement that a document posts has no reason.

Count stock

A count lets you enter the quantity that you counted. You do not calculate the difference. Send countedQuantity in place of quantity, and the time of the count in countedAt.

POST /api/v1/inventory/adjust
{
  "productId": "5b0c7a3e-1f0d-4a8e-9c2b-2f2d1c9e7a11",
  "locationId": "0f6c1b52-8d7e-4c0a-b3a9-6a1e5d2c4b77",
  "countedQuantity": 113,
  "countedAt": "2026-10-10T09:00:00Z",
  "notes": "Monthly freezer count"
}

Miridia finds the balance at countedAt from the ledger. It then posts one Adjustment with the difference, the reason CountDifference, and the effective date countedAt.

For example, the ledger shows 120 tubs at 09:00, and you count 113 at 09:00. At 09:30 a shipment takes 10 tubs, and you send the count at 10:00. Miridia posts an Adjustment of -7 at 09:00. The shipment stays as it is, and the balance becomes 103. A movement after countedAt does not change the difference.

  • countedAt is optional. The default is the time of the request. It cannot be in the future.
  • A count is always an Adjustment with the reason CountDifference. You can leave out movementType and reason.
  • If the count is the same as the balance, Miridia posts no movement. The response then has the message The count matches the balance. No movement was posted.

Errors

A request that breaks one of these rules gets a 400 response with an error code.

CodeCause
E400_MOVEMENT_TYPE_NOT_MANUALThe type is not Adjustment, WriteOff, Return, or Sale.
E400_MOVEMENT_DIRECTIONThe sign of quantity does not agree with the type.
E400_MOVEMENT_REASON_REQUIREDAn Adjustment or a WriteOff has no reason.
E400_MOVEMENT_NOTES_REQUIREDThe reason is Other and notes is empty.
E400_ADJUST_OR_COUNTThe request has both quantity and countedQuantity, or neither.
E400_COUNT_MOVEMENT_TYPEA count has a type other than Adjustment.
E400_COUNT_REASONA count has a reason other than CountDifference.
E400_COUNTED_AT_IN_FUTUREcountedAt is in the future.

A quantity in a unit that cannot be split, for example Each or Box, must be a whole number. This applies to quantity and to countedQuantity.

Move stock in one step

For a quick move between two locations, use the one-step transfer. It writes a TransferOut at the source and a TransferIn at the destination in one operation.

For a move that needs a request, an approval, or time in transit, use a transfer order.

Backdated movements

An adjustment, a transfer, and a receipt accept an effectiveDate. A count accepts a countedAt in the past. You can load several months of history when you start on Miridia. The average cost is then correct. The system does not assume that all stock arrived on the day of the migration.

Lots and serial numbers

A lot groups units that were made or received together. A lot has a lot number, an optional expiry date, notes, and attachments, for example a certificate of analysis.

A work order can create a lot when it completes. It can also record serial numbers for the units that it produced. A serial number has a status: Available, Consumed, Shipped, or Scrapped.

To see the movements of one lot, get the movements of the lot.

Traceability

Miridia can trace stock in two directions.

  • Forward: start from a purchase order receipt. Find the shipments that most probably took stock from that receipt, and their orders and customers. Use this for a supplier recall.
  • Backward: start from a customer shipment. Find the receipts that most probably supplied the stock, and their purchase orders and suppliers. Use this for a customer complaint.
The trace is an inference on a first-in, first-out basis. It gives the probable source. It does not prove which physical consignment went to which customer. Each response includes a disclaimer field that states this limit.

Reorder points

Set these values on each inventory record:

  • Reorder point: when the balance goes below this value, Miridia raises a low-stock event.
  • Reorder quantity: the quantity to order.
  • Safety stock: the buffer for a change in demand or a late delivery.

The source of the values is Manual or Forecast. A planner can calculate them in Miridia Planner. The reorder history shows each change to the settings.

When the stock of a product at a location goes below its reorder point, Miridia sends a warning to the business and to the users with the Manager role. Read Notifications. You can also start a workflow on the OnInventoryLowStock trigger. Read Workflows.

API reference