Skip to content

Warehouse 0.5.4: Read and change stock through API keys

Warehouse 0.5.4 lets other systems read and change stock through PhoenixKit API keys, with five tools: warehouse.list_locations, warehouse.get_stock, warehouse.receive_stock, warehouse.set_stock and warehouse.issue_stock.

The three write tools each create and post one document (a goods receipt, a stocktake or a goods issue) with up to 500 lines. A request is all or nothing: if any line is wrong, every problem is reported and nothing is posted, and an issue lists every line that is short. A dry run previews a request, and a caller’s own document number in external_ref makes a retry harmless. A large request can be held until a person confirms it. Each posted document gets an Activity entry.

The tools need a PhoenixKit core that ships the API tool registry, and the write tools also need its confirmation flow. On an older core the module offers the read tools or none, and nothing else changes.

Full release notes: Warehouse 0.5.4

0.5.4 · 17 October 2026

Added

  • Warehouse admin API tools (#36) — five tools offered to API keys through api_tools/0: warehouse.list_locations and warehouse.get_stock (read), and warehouse.receive_stock, warehouse.set_stock and warehouse.issue_stock (one document with up to 500 lines, created and posted in one transaction). Atomic: every problem of a request is reported and nothing is posted if any line is wrong; issue_stock lists every short line. dry_run previews, an Activity entry per posted document (via: api) and external_ref retries answered from the posted document are included; see the README. The tools need a core that ships the tool registry; the write tools also need its confirmation flow. On an older core api_tools/0 offers the read tools or none, and nothing else changes.
  • :source_refs accepted by create_and_post/2 and a resulting_quantity recorded on receipt lines that moved stock (#36).
  • Activity entries for posted goods receipts and goods issues (warehouse.goods_receipt.posted, warehouse.goods_issue.posted) when posted through the API (#36).

Fixed

  • A retry of a posted external_ref with a trashed product could hide a changed request — a changed quantity, unit value or duplicate on another line was answered skipped. The retry now recovers the missing product from the posted document and compares every line; an unchanged retry is still answered skipped with an external_ref_lines_unverified effect.
  • An unknown external_id passed for a stored product on such a retry. A missing ref must now match a stored UUID, a unique stored SKU or a unique stored external ID; documents posted through the API keep the external ID of each line. For older documents retry with the product UUID.
  • mix precommit was red against the published core (dialyzer could not find PhoenixKit.API.Tool.new!/1); a justified ignore for api.ex covers it.

Warehouse 0.5.4. Install or update: {:phoenix_kit_warehouse, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.