Choose which inventory lots to pick (FIFO, FEFO, LIFO, fewest lots)

$0.005 USDC per call · Business, finance and compliance · POST /api/v1/lot-pick · Id lot-pick

Allocates a demand quantity across up to 200 inventory lots under a stated policy (FIFO by received date, FEFO by expiry, LIFO, or fewest lots), excluding held, expired, short-shelf-life and wrong-location lots, in whole case multiples if asked. For warehouse and order agents. Returns the pick plan, the shortfall and a reason for every excluded lot. A caller asOf date is required (the check never reads the clock). pass: demand fully covered; fail: the eligible stock cannot cover it (shortfall in the witness); unknown: a date the policy or shelf-life rule needs is missing or the dates are unusable. It does not reserve stock, handle partial-lot reservations or choose locations by travel distance.

What you get

Deterministic pick plan with exclusion reasons for one $0.005 call.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/lot-pick. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/lot-pick \
  -H 'content-type: application/json' \
  -d '{"asOf":"2026-11-04","demand":150,"policy":"FEFO","lots":[{"id":"L-100","qty":100,"expiry":"2026-12-01"},{"id":"L-200","qty":80,"expiry":"2026-11-20"},{"id":"L-300","qty":500,"expiry":"2026-11-01"},{"id":"L-400","qty":60,"expiry":"2027-03-01","hold":true}]}'

Input

FieldTypeRequiredDescription
asOfstring; length 0..10yesReference date, YYYY-MM-DD. An expiry date is the last usable day: a lot expiring on asOf has 0 days left.
demandinteger; 0..1000000000yesUnits wanted (whole units).
policystring; one of "FIFO", "FEFO", "LIFO", "MIN_LOTS"yesFIFO: oldest received first. FEFO: earliest expiry first. LIFO: newest received first. MIN_LOTS: fewest lots (largest usable first; ties by earlier expiry, then id).
lotsarray<object>; max 200 itemsyesAt most 200.
minShelfLifeDaysinteger; 0..36500noExclude lots with fewer than this many days left at asOf (needs expiry on every non-held lot).
pickMultipleinteger; 1..1000000noEach lot contributes whole multiples of this case size (default 1).
allowOverpickbooleannoWith pickMultiple, allow the last pick to round the total up to a whole case (default false: leave the remainder as shortfall).
allowedLocationsarray<string; length 0..64>; max 50 itemsnoIf set, lots elsewhere (or without a location) are excluded.

Example request body

{
  "asOf": "2026-11-04",
  "demand": 150,
  "policy": "FEFO",
  "lots": [
    {
      "id": "L-100",
      "qty": 100,
      "expiry": "2026-12-01"
    },
    {
      "id": "L-200",
      "qty": 80,
      "expiry": "2026-11-20"
    },
    {
      "id": "L-300",
      "qty": 500,
      "expiry": "2026-11-01"
    },
    {
      "id": "L-400",
      "qty": 60,
      "expiry": "2027-03-01",
      "hold": true
    }
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
picksarray<object>no
pickedintegerno
shortfallintegernoDemand not covered.
excludedarray<object>no
policystringno
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the physical-ops-kit package.

Machine-readable