RSJ 3D Packer 3D bin packing, palletising and load optimisation

← All posts

2026-10-13

Automate Pallet Loading with a Packing API: A Walkthrough

Automate Pallet Loading with a Packing API: A Walkthrough
RSJ 3D Packer packing optimization item packer

Automate Pallet Loading with a Packing API: A Walkthrough

Planning a pallet load by hand is a loop most logistics teams know too well: pull the order lines, sort cartons by footprint, sketch a base layer, count what fits, guess a safe height, repeat for the next pallet. Then a quantity changes, a second pallet type appears, and the whole sketch is worthless.

The costs are easy to underestimate:

  • Space. A layout that is “good enough” leaves gaps that add up over hundreds of pallets per week.
  • Time. Every order triggers the same manual exercise, and the planner is usually the person who is also answering the phone.
  • Consistency. Two planners produce two different plans for the same order, so results depend on who was on shift.
  • Scale. Manual planning does not get faster when order volume doubles.

The alternative is to treat pallet loading as a computation: send the item list and the pallet or container dimensions as JSON, get a loading plan back, and let your ERP or WMS consume the result. This article walks through that automation end to end using RSJ 3D Packer as the practical example. It is a managed service that computes optimised packing plans for containers and pallets, solves the static 3D bin packing problem with multiple bins, and uses a neural network optimised through neuro-evolution as its solver core.

One-Time Setup: Getting API Access

There is nothing to install. RSJ 3D Packer runs as a managed service: you create an account, obtain a session token, and call a REST endpoint. Base URL is https://3dpacker.rsj.de, and the same information that powers the endpoints is published as an OpenAPI 3.0 document at openapi.yaml.

Step 1 — Sign in. Use Sign in or create an account — password, passkey, social login and 2FA are available.

Step 2 — Obtain an access token. The endpoint is:

GET /user/{email}?hmac={hmac}

The hmac is the HMAC-SHA256 hash of the e-mail address. It can only be computed on the server while the user is logged in, so a stand-alone client copies it once and reuses it. The response contains the user record and a session value.

Step 3 — Send the session on every call:

export SESSION="session-1bc90169-1c83-443e-8ed7-b0328aaf78a5"
Authorization: Bearer session-1bc90169-1c83-443e-8ed7-b0328aaf78a5

The session is valid for a limited time (about one day), so fetch a fresh one instead of storing it long-term. The browser application authenticates with cookies instead, which is what the API sandbox relies on.

Two shortcuts worth knowing before you write code:

  • The cloud version is also integrated into Google Sheets through its own add-on. If a planner only needs occasional plans, that is a no-code entry point.
  • Every plan can be tested free for 30 days, and the free test exposes the Pro feature set — including dangerous goods handling and multiple container sizes.

A minimal call to /solve looks like this. All dimensions are unit-less, so just keep one unit (cm, mm, inches) consistent across every item and container:

curl -s https://3dpacker.rsj.de/solve \
  -H "Authorization: Bearer $SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "containers": [{ "width": 120, "height": 100, "depth": 80, "count": 1 }],
    "items": [
      { "width": 40, "height": 30, "depth": 20, "count": 12 },
      { "width": 20, "height": 20, "depth": 20, "count": 24 }
    ]
  }'

Building the Automated Pipeline

The data flow is the same regardless of whether your source system is an ERP, a WMS or a spreadsheet:

  1. Extract order lines with dimensions, quantities, weights, stacking classes and any risk data.
  2. Transform them into the API’s JSON shape and post them to /solve.
  3. Parse the response into positions, fill rates and leftovers.
  4. Feed back pick lists, pallet labels or a 3D preview to the people who build the load.

The request

A realistic request carries several item types, a container specification and optional fields. Roughly a 48 × 47 × 46 box, 51 small items, 53 items that must stay upright, and 57 units of a dangerous-goods item:

{
  "containers": [
    {
      "width": 48,
      "height": 47,
      "depth": 46,
      "count": 1,
      "weight": 2000,
      "allowedRiskPoints": 1000
    }
  ],
  "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, "riskTypes": [1, 2], "riskPoints": 10 }
  ],
  "risks": [{ "type1": 1, "type2": 2 }]
}

Field notes:

  • items and containers are required, risks is optional.
  • width, height, depth are required for items and containers; count defaults to one when omitted.
  • Optional item fields: weight, itemClass, vertical, riskPoints, riskTypes, plus an id of your choosing for tracing.
  • Optional container fields: weight (maximum load), allowedRiskPoints and count.
  • itemClass and risk types are integers; weight, riskPoints and allowedRiskPoints are numbers.
  • "vertical": false marks an item that must not be rotated out of its upright position.

If you are generating this from order lines, keep the transform dumb and explicit:

def to_item(row):
    item = {
        "id": row["line_id"],          # your own identifier, echoed back for tracing
        "width": row["w"],
        "height": row["h"],
        "depth": row["d"],
        "count": int(row["qty"]),
    }
    if row.get("weight"):
        item["weight"] = row["weight"]
    if row.get("stack_class") is not None:
        item["itemClass"] = int(row["stack_class"])
    if not row.get("may_rotate", True):
        item["vertical"] = False
    if row.get("risk_points"):
        item["riskPoints"] = row["riskPoints"]
        item["riskTypes"] = row["risk_types"]
    return item

The response

The response tells you what was packed, where, and what did not fit. An abridged example:

{
  "containers": [
    { "width": 48, "height": 47, "depth": 46, "count": 1, "used": 1, "filled": 76.77 }
  ],
  "items": [
    { "width": 11, "height": 6, "depth": 6, "count": 51, "vertical": true, "remaining": 0 },
    { "width": 8, "height": 9, "depth": 10, "count": 57, "remaining": 17 }
  ],
  "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 }
  ]
}

What you get in practice:

  • Packed items with a container index (c) and an x/y/z position, so you can render or drive a label printer.
  • Fill percentage per container and the number of containers used.
  • Unpacked items with counts, which is your signal that the order needs attention.
  • A viewer URL and an API sandbox URL in the result, so a planner can look at the plan instead of reading coordinates.

The geometry is worth trusting here: every packed item is supported by the item below it and the plan contains no floating items, and an item is only ever placed on items of a lower or equal stacking class.

Feeding the result back

Three common ways to get the plan out of your pipeline and into the operation:

  • Generate pick lists in load order, so the pallet is built bottom-up without backtracking.
  • Print pallet labels with a container index per pallet.
  • Visualise the plan: the web application has an interactive 3D view, and the viewer is embeddable in an IFRAME, which is handy for an internal dashboard. There is a sample packing solution you can look at first.
  • Download the solution as a GLB 3D model if you want to inspect it in another tool.

One scheduling detail matters: the solver works with a 240-second time budget per request on every plan. That is generous for typical orders, but it is far longer than a web request should block. Treat /solve as an asynchronous job in your pipeline — queue it, poll or wait for it, then continue.

import os, requests

BASE = "https://3dpacker.rsj.de"

def solve(problem, session):
    r = requests.post(
        f"{BASE}/solve",
        json=problem,
        headers={"Authorization": f"Bearer {session}"},
        timeout=300,  # longer than the 240 s solver budget
    )
    r.raise_for_status()
    return r.json()

plan = solve(problem, os.environ["SESSION"])

for c in plan["containers"]:
    print(f"used {c['used']} of {c['count']}, filled {c['filled']}%")

if plan["unpackedItems"]:
    mark_for_manual_review(order_id, plan["unpackedItems"])

Monitoring and Handling Failures

Automation only pays off if the failures are boring. Three cases cover most of them.

Items that did not fit. unpackedItems is populated whenever the solver could not place everything. Your pipeline should branch on it explicitly rather than assume success: raise the container count and re-solve, split the order, or put the order in a planner’s normal queue in your ERP/WMS so a human decides. Silent partial plans are the expensive failure mode.

Transient errors and expired sessions. Wrap the call in a retry with a backoff for network errors and 5xx responses. When authentication fails, re-fetch a session from the /user/{email}?hmac={hmac} endpoint instead of retrying with the stale one — sessions last about a day, which is short enough that a long-running batch job will hit expiry eventually.

Expectations about optimality. The solver produces heuristically optimised solutions. It will not always find the theoretical best arrangement, and a plan that looks odd to a human may still be a good one. Decide in advance what “good enough” means for your order mix — a minimum fill percentage, a maximum container count — and treat plans outside that band as candidates for human review.

Keep a log of the request and response for each order. There is a practical trick that makes this easier: unknown keys in the request objects are ignored, so you can attach your own tracing metadata (order id, batch id, source system) to the payload without breaking the request. Just be aware a future field could collide with such a key, so prefix your keys.

Best Practices for Reliable Automation

  • Validate on your side first. Dimensions should be positive numbers, counts integers, and required fields present. Catching a zero-dimension line in your own code is faster and clearer than debugging it downstream.
  • Model stacking with itemClass. An item is only ever placed on items of a lower or equal class, which is exactly what you want for pallet patterns like “crates, then cartons, then bags”. Note that stacking classes are one of the plan-dependent features.
  • Use "vertical": false for fragile or upright-only goods. This prevents rotation out of the upright position and is available from the Standard plan up.
  • Use weight limits and dangerous goods fields where your plan supports them. Container weight, item riskPoints and riskTypes, container allowedRiskPoints and the risks pairs are all available — dangerous goods handling is a Pro feature. If you are unsure whether your use case is covered, test it against the Pro feature set during the free trial before committing to a plan; the Free 3D Bin Packing API Trial article covers how to structure that test.
  • Keep the integration modular. Separate data extraction, the API call and result processing into distinct functions. When a dimension unit changes or a customer wants a different label, you change one layer rather than the whole job.
  • Cache identical requests. If the same order is planned repeatedly (a re-run after a failed downstream step, for example), return the stored result instead of spending another slice of the solver budget.
  • Plan for sequence constraints if you have them. The algorithm can be adapted for dynamic problems, such as a fixed packing order or a required unpacking order, if your operation needs it.

FAQ

What are the system requirements for on-premises deployment?

The on-premises server runs on Windows 10/11 64 Bit or Ubuntu Linux 64 Bit, requires 16 GB RAM and 4 GB hard disk space. A stand-alone program is also available.

Can I try the API before buying a subscription?

Yes, every plan can be tested free for 30 days, and the free test exposes the Pro feature set, including dangerous goods handling and multiple container sizes.

How long does the solver take to return a result?

The solver works with a 240-second time budget per request. The actual time depends on the problem size and complexity, but the budget ensures a response within that limit.

Does the API support dangerous goods constraints?

Yes, on the Pro plan. Items can carry risk types and risk points, containers can have a maximum allowed risk points, and you can declare pairs of risk types that must not be loaded together.

Conclusion: Start Automating Today

The manual loop — sketch, count, guess, redo — is the part worth deleting from your week. Handing the calculation to a packing API turns it into a repeatable pipeline step: order lines in, positions and fill rates out, with leftovers you can act on programmatically.

RSJ 3D Packer is a managed service with no local installation, a JSON REST API, an embeddable 3D viewer, GLB export and a free 30-day trial that exposes the Pro feature set. The fastest way to judge whether it fits your order mix is to open the API sandbox and send a request with your own dimensions, then read the rendered API documentation when you are ready to write the client.

Plans start at €100/month (Basic) and scale up, with yearly discounts, and subscriptions are billed through Stripe — you can compare plans and check out at the storefront.

Related posts

EU label: AI-generated content