Expiring Lot Allocation

Allocate an order from eligible lots in expiry order while enforcing minimum remaining shelf life.

Custom requests cost 0.04 USDC on Base.

Download example JSON · OpenAPI · Source and usage

Pay with a browser wallet · Open example in checkout

POST a JSON request to /expiring-lot-allocation/v1/check with an x402 V2 client.

Worked example

Request

{
  "dispatch_day": 100,
  "shelf_days": 5,
  "quantity": 10,
  "lots": [
    {
      "id": "old",
      "expiry_day": 104,
      "quantity": 10
    },
    {
      "id": "early",
      "expiry_day": 106,
      "quantity": 3
    },
    {
      "id": "later",
      "expiry_day": 112,
      "quantity": 10
    }
  ]
}

Result

{
  "pick": [
    {
      "id": "early",
      "quantity": 3
    },
    {
      "id": "later",
      "quantity": 7
    }
  ],
  "insufficient_shelf_life": [
    "old"
  ],
  "shortfall": 0
}

Support catalog maintenance through GitHub Sponsors. Sponsor gptenv · Sponsor Jeremy Carter