How to Pack Multiple Container Sizes in One Shipment Plan
Your order is too big for one 40ft, too small for two, and there are two 20ft containers sitting in the yard plus a handful of pallets. You could plan the 40ft first, see what’s left, then plan the 20ft separately — and spend the afternoon discovering that the leftovers would have fit better if you had split the load differently from the start.
This article walks through the other approach: hand RSJ 3D Packer every container you have available — different dimensions, different counts, different weight limits — in a single POST /solve request, and let the solver decide which combination to use. By the end you’ll have a working request, a response you can read, and a check-list for confirming the plan is actually usable.
Mixed container sizes are a Standard or Pro feature. On Basic, all containers in a request must share the same dimensions. The free 30-day test account exposes the Pro feature set, so you can follow every step below before deciding on a plan.
Why Mixed Container Sizes Belong in a Single Plan
Real shipments rarely arrive in tidy, uniform container quantities. A load might combine a 40ft container and a 20ft container, or a mix of full-size containers and smaller pallet-sized bins. Matching container dimensions to actual volume is the difference between paying for air and paying for space.
Planning each size separately has a structural problem: the first run optimises for the containers it knows about, and the second run inherits whatever is left over. The result is usually a worse global fill rate and more containers used overall than necessary.
RSJ 3D Packer treats it as one problem. You supply a containers array in which each entry has its own width, height, depth and count, and the solver returns one plan covering all of them — with a fill percentage per container, positions for every packed item, and an explicit list of anything that didn’t fit.
Two constraints worth knowing up front:
- The problem is static: items may be packed in any order. If you need a fixed packing or unpacking order, the algorithm can be adapted for that, but it is a customisation rather than a switch.
- Every request runs within a 240 second solver time budget, on every plan.
Prerequisites for a Mixed-Container Packing Run
Before you send anything, make sure you have:
- An account and a suitable plan. Sign up through the application; different container sizes require Standard (€150/month) or Pro (€200/month), or the free 30-day trial.
- Item data.
width,height,depthper item type, pluscount. Optional:weight,itemClass,vertical,riskPoints,riskTypes, and your ownid. - Container data.
width,height,depthper container type, pluscount. Optional:weight(maximum load),allowedRiskPoints,itemClass. - A way to call the API. Either the web UI (which authenticates via cookies) or the JSON REST API. The rendered reference lives at 3ddocs.html, and the sandbox lets you fire live requests and see a 3D preview.
Use the same dimension unit for items and containers throughout — the solver compares them directly.
Step 1: Define Your Containers with Different Sizes
Start with the containers. Each object is one container type, and count says how many of that type you have available. Here’s a two-type setup: one large container and up to two smaller ones, each with its own maximum load.
{
"containers": [
{
"width": 48,
"height": 47,
"depth": 46,
"count": 1,
"weight": 2000
},
{
"width": 40,
"height": 40,
"depth": 40,
"count": 2,
"weight": 1200
}
]
}
Notes:
countdefaults to1when omitted, but setting it explicitly is worth the keystrokes — it’s the knob that tells the solver how much room it has to work with.weightis optional and caps the total load for that container type. If you only need weight limits and no rotation, the walkthrough in How to Pack a Pallet With Weight Limits and No Rotation goes deeper on those two fields.allowedRiskPointsonly matters when dangerous goods are involved; that’s covered separately in How to Pack Dangerous Goods With Risk Points in One Container.
Step 2: Describe Your Items and Constraints
Items work the same way: one object per item type, with a count. width, height and depth map to x, y and z.
{
"items": [
{ "width": 11, "height": 6, "depth": 6, "count": 51 },
{
"width": 7,
"height": 8,
"depth": 9,
"count": 53,
"vertical": false,
"itemClass": 1,
"weight": 12
},
{ "width": 8, "height": 9, "depth": 10, "count": 57, "id": "sku-4711" }
]
}
The three optional fields that most affect whether your multi-size plan succeeds:
itemClassenforces stacking order. An item is only ever placed on items of a lower or equal class, so heavier or crushable goods get a low class and fragile top-layer goods get a high one. Over-constraining here is a common cause of low fill rates — a class-1 item can never sit on a class-2 item, in any container.verticalcontrols rotation. Set"vertical": falsefor anything that must stay upright; the solver will not tip it over.idis yours to choose. It comes back on packed and unpacked items, which makes it easy to map results back to your SKUs.
Unknown keys are ignored, so client metadata can travel alongside an item — just be aware a future API field could collide with a key you invent.
Step 3: Submit the Packing Request
Combine the two arrays into one body and post it to /solve. Here’s a complete request, saved as packing-request.json:
{
"containers": [
{ "width": 48, "height": 47, "depth": 46, "count": 1, "weight": 2000 },
{ "width": 40, "height": 40, "depth": 40, "count": 2, "weight": 1200 }
],
"items": [
{ "width": 11, "height": 6, "depth": 6, "count": 51 },
{ "width": 7, "height": 8, "depth": 9, "count": 53, "vertical": false, "itemClass": 1, "weight": 12 },
{ "width": 8, "height": 9, "depth": 10, "count": 57, "id": "sku-4711" }
]
}
Authentication uses a session token. Fetch one by presenting the HMAC of your e-mail address, which can only be computed on the server while you are logged in — a stand-alone client copies it once and reuses it:
# 1. Get a session (run once, keep the returned value)
curl -s "https://3dpacker.rsj.de/user/you@example.com?hmac=$HMAC"
The response contains your user record and a session value. Send it as a bearer token on every call:
# 2. Solve
curl -s -X POST https://3dpacker.rsj.de/solve \
-H "Authorization: Bearer session-1bc90169-1c83-443e-8ed7-b0328aaf78a5" \
-H "Content-Type: application/json" \
-d @packing-request.json \
-o packing-response.json
The session is valid for roughly a day. Fetch a fresh one rather than caching it in a long-lived job — expired tokens are the most common cause of a call that “suddenly stopped working”. The browser application authenticates with cookies instead, which is why the sandbox needs no token.
Expect the request to take up to the 240 second budget to return. That’s intentional: the solver is a neural network optimised through neuro-evolution, and it spends the budget searching.
Step 4: Read the Solution and Fill Rates per Container
The response is built for exactly this question — which container sizes did the plan actually use, and how full did they end up?
{
"containers": [
{ "width": 48, "height": 47, "depth": 46, "count": 1, "used": 1, "filled": 76.77 },
{ "width": 40, "height": 40, "depth": 40, "count": 2, "used": 1, "filled": 61.40 }
],
"packedItems": [
{ "id": 0, "c": 0, "width": 11, "height": 6, "depth": 6, "x": 0, "y": 0, "z": 0 }
],
"unpackedItems": [
{ "id": 2, "width": 8, "height": 9, "depth": 10, "weight": 0, "itemClass": 0, "count": 17 }
]
}
How to read it:
containers[].usedis how many containers of that type the plan needs. Ifusedequalscountfor every type, you have hit your inventory ceiling and should expect unpacked items.containers[].filledis the fill percentage for that container type. Compare the numbers across types: if the small containers came back much fuller than the large one, the solver is telling you the load composition suits small bins — useful when you reorder containers next time.packedItems[]gives every placed item its container indexcand anx/y/zposition inside it. Useidto join back to your order lines.usedContainers[]identifies which specific containers ended up in the plan.unpackedItems[]lists what didn’t fit, with counts and the original dimensions, weight and class.- The response also carries a viewer URL and an API sandbox URL so you can jump straight from the payload to a visual.
If you want a quick summary rather than eyeballing JSON, this does the job:
import json
resp = json.load(open("packing-response.json"))
for c in resp["containers"]:
print(f'{c["width"]}x{c["height"]}x{c["depth"]}: '
f'used {c["used"]}/{c["count"]}, filled {c["filled"]}%')
packed = len(resp["packedItems"])
unpacked = sum(u["count"] for u in resp["unpackedItems"])
print(f"packed {packed} lines, {unpacked} units left over")
Step 5: Visualise and Export the Plan
Numbers tell you whether a plan is efficient; the 3D viewer tells you whether it is sensible. Open the viewer URL from the response and rotate the model — you will see each container, the items inside it, and how the layers stack.
Two practical follow-ons:
- Embed it. The viewer can be dropped into an IFRAME, which is handy for putting a plan in front of a colleague or a loading team without giving them an account.
- Export it. The solution downloads as a GLB 3D model, so you can open it in any 3D tool that reads glTF binaries.
Cloud subscribers who live in spreadsheets can also run and view plans through the dedicated Google Sheets add-on — useful for order lists that arrive as a sheet rather than from an ERP.
How to Confirm the Plan Worked
Before you act on a plan, run through these five checks:
- Container counts. For every entry,
usedmust be less than or equal tocount. Ifusedequalscounteverywhere andunpackedItemsis non-empty, your container inventory is the binding constraint, not the packing. - Fill percentages. Reasonable fill rates are workload-dependent, but a container sitting far below its siblings usually points at a constraint in the item data rather than at the solver.
- Unpacked items.
unpackedItemsshould be empty or contain only the quantities you expected to leave behind. - Support. The solver guarantees that every packed item is supported by the item below it — no floating items appear in a plan.
- Geometry. Open the viewer and confirm items sit inside container bounds and that your stacking classes and
"vertical": falseitems look the way you intended.
Troubleshooting Common Issues
Unpacked items came back. The solver ran out of room or hit a constraint. Raise count on one of the container types and re-run; if that doesn’t help, check per-container weight limits — a weight ceiling can stop a container long before its volume is full.
Fill rates are low across all container types. Look at itemClass and vertical first. A strict class hierarchy fragments the free space in every container, and disallowing rotation on large item types wastes volume. Relax one field at a time and compare results.
The request times out. The 240 second budget is fixed and applies to every request on every plan. Reduce the number of item types and container types, or simplify constraints, so more of the budget goes into search rather than into modelling a large problem.
Authentication fails. Check the token is fresh (about one day of validity) and that the header reads exactly Authorization: Bearer <session>. Re-fetch rather than debugging a stale value.
Nothing was packed at all. Verify that every item is smaller than at least one container in every dimension it can rotate into, and that container weight limits aren’t below the weight of a single item.
FAQ
Can I mix container sizes with different weight limits?
Yes. Each container can have its own optional weight limit (maximum load). The solver will respect the weight limit for each container type when packing items.
What happens if I specify more container types than needed?
The solver will use as many containers as necessary to pack all items, up to the counts you provide. If some container types are not needed, they will simply not be used, and the response will show used counts per type.
Does the solver consider the order of packing?
The solver treats the problem as static, meaning items may be packed in any order. The algorithm can be adapted for dynamic problems with a fixed packing order or required unpacking order, but that requires customisation.
Is there a limit to the number of container types I can include?
The API does not impose a hard limit on the number of container types, but the solver works within a 240 second time budget per request. Including many container types may increase computation time, so it’s best to include only the types you actually have available.
Conclusion
Mixed container sizes are only hard when you plan them in sequence. Put every container type into one containers array and the problem collapses into a single optimisation with a single answer: this many of this size, that full, with a hand-checkable 3D view attached.
Start with the free 30-day test — it exposes the full Pro feature set, so mixed container sizes, weight limits, no-rotation items and dangerous goods are all available while you validate the approach against your own order data. If you’re wiring the solver into an order system rather than running it by hand, Connect a Packing Solver to Your Order System via REST API picks up where this walkthrough ends.
Related posts
- Connect a Packing Solver to Your Order System via REST API
- How to Pack a Pallet With Weight Limits and No Rotation
- Packing Optimisation for Small E-Commerce Warehouses