Pack items into the smallest fitting carton (bounded heuristic)

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

Checks whether up to 50 box-shaped items (axis-aligned, 90-degree rotations, optional this-side-up lock, optional weights) fit into any of up to 20 candidate cartons, and recommends the smallest-volume carton for which a packing was found, with coordinates for every item. For shipping and fulfilment agents sizing a parcel. The packing is a greedy extreme-point HEURISTIC with a fixed step cap, not an optimal solver: pass means a verified packing exists; fail only when a carton is provably impossible (an item exceeds every orientation, total volume or total weight exceeds the limit); unknown means no packing was found but none is proven impossible. Dunnage, void fill, item support and crush strength are not modelled.

What you get

A verified packing with coordinates, or a proof of impossibility, in one $0.005 call.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/carton-fit. 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/carton-fit \
  -H 'content-type: application/json' \
  -d '{"items":[{"id":"book","l":24,"w":17,"h":3,"qty":3},{"id":"mug","l":10,"w":10,"h":5,"thisSideUp":true}],"boxes":[{"id":"small","l":20,"w":15,"h":10},{"id":"medium","l":30,"w":20,"h":15}]}'

Input

FieldTypeRequiredDescription
itemsarray<object>; max 50 itemsyesAt most 50 item lines and 50 units in total (sum of qty).
boxesarray<object>; max 20 itemsyesAt most 20. Use inner dimensions.

Example request body

{
  "items": [
    {
      "id": "book",
      "l": 24,
      "w": 17,
      "h": 3,
      "qty": 3
    },
    {
      "id": "mug",
      "l": 10,
      "w": 10,
      "h": 5,
      "thisSideUp": true
    }
  ],
  "boxes": [
    {
      "id": "small",
      "l": 20,
      "w": 15,
      "h": 10
    },
    {
      "id": "medium",
      "l": 30,
      "w": 20,
      "h": 15
    }
  ]
}

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.
heuristicbooleannoAlways true: the packer is a heuristic, not an optimal solver.
recommendedBoxone ofno
boxesarray<object>no
placementsarray<object>noFor the recommended carton: lower corner (x,y,z) and placed size (l,w,h) of every unit, in the caller's unit.
totalWeightone ofno
stepsintegernoOverlap tests used of the step cap.
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