Core concepts

This page covers the core model the rest of the documentation assumes. For the request shape itself (every top-level key in one place), see Anatomy of a job.

Load units & roles

A job is built from two flat lists: carriers[] and cargo[]. Every entry in either list (box geometry only) has a geometry of type "box" (dimensionX/dimensionY/dimensionZ). What differs between the two lists is the fields around that geometry, matching each list's role in the shipment.

Supply vs. demand: carriers[] and cargo[]

  • carriers[] = supply: what you load into. Each carrier has an externalId echo label and a quantity: how many instances are available. Omit quantity and the solver decides how many instances to use; when you supply it, it must be greater than zero.
  • cargo[] = demand: what you ship. Each line has an amount (how many identical units to place) and a weight. Whatever the solver can't place comes back in unplacedItems (see Results below).

Both lists are flat: a carrier cannot go inside another carrier, and a cargo entry cannot itself hold other cargo. So a loaded pallet is not something you can place inside a truck in one job. Nesting carriers that way is planned for a future release.

Coordinate frame

The v2 coordinate frame drawn inside an open carrier, with a worked placement example

The axes are fixed for every carrier:

AxisMeaning
X: dimensionX, sizeX, xLongitudinal: the length. x = 0 is the front wall: the closed end of the carrier, away from the doors, which are at the far end of X. The default -X consolidation packs cargo toward it.
Y: dimensionY, sizeY, yLateral: the width.
Z: dimensionZ, sizeZ, zVertical: the height. z = 0 is the floor.

All positions and sizes are in the job's units.length; rotations (orientationRx/Ry/Rz) are always in degrees. The frame is right-handed, and positive angles follow the right-hand rule: orientationRz = 90 takes +X toward +Y: counter-clockwise seen from above, looking down at the floor.

Reading a placement: orientation and size values

Every placed box in the result is described by four sets of fields. Knowing which set to trust, and which one not to act on, is the whole difference between a renderer that is correct and one that only looks correct.

FieldsWhat they carry
x, y, zThe box's minimum corner: the lowest X, Y and Z point of its axis-aligned bounding box within the carrier.
sizeX, sizeY, sizeZThe placed box's extents along each axis, with any rotation already applied, not its original pre-rotation dimensions.
orientationRx, orientationRy, orientationRzThe box's orientation about each axis, in degrees. sizeX/Y/Z and x/y/z already reflect this rotation, so do not apply it again when plotting the box.
geometry.dimensionX/Y/ZThe original, unrotated dimensions you submitted for that cargo line. The same numbers also appear under geometry.box, which is deprecated.

A placement also carries the cargo line's groups labels (and the same labels under the deprecated name group). They say nothing about the box's position or size. With group separation they also tell you which section of the carrier the box belongs to; see Reading the result.

Drawing the box

Draw an axis-aligned box from (x, y, z) extending +sizeX, +sizeY, +sizeZ. That is the entire renderer. Because every angle is a multiple of 90°, a placed box is always axis-aligned, so this path needs no rotation maths, and no handedness, at all.

The trap: applying orientationR* on top of the minimum corner rotates the box a second time, and it will no longer sit where the solver put it. Both this mistake and its opposite (treating x/y/z as a corner measured before rotation) look perfectly correct for a box that isn't rotated. Always test a renderer against a rotated one.

Worked example

One box submitted with a geometry of 0.3 × 0.4 × 0.2 m, placed with a 90° turn about Z:

FieldValue
x, y, z0.3, 0.0, 0.0
sizeX, sizeY, sizeZ0.4, 0.3, 0.2
orientationRz90

The box occupies [0.3..0.7] × [0.0..0.3] × [0.0..0.2] m, exactly the minimum corner plus the rotated extents above, with no further rotation applied. Note what the rotation did and did not do: sizeX and sizeY are the submitted 0.3 and 0.4 swapped, while geometry.dimensionX/Y/Z still report the box you sent. Plot the box from 0.3, 0.0, 0.0 and it lands where the solver put it.

Units

A job-level units block sets the unit per kind, one per kind for the whole job: length, weight, volume, area and ldm. Omit any kind and it falls back to its default. The result echoes the units it used, so nothing is ambiguous. area and ldm are accepted and echoed but express nothing in the result today. See Units.

Jobs & lifecycle

Solving is asynchronous. You submit a job and poll it:

queued → running → succeeded | failed | cancelled

The last three are terminal. The flow:

  1. Optionally, POST /v2/jobs/validate → 200 with valid: true and any warnings, or 400 validation_failed. A dry-run: it creates no job.
  2. POST /v2/jobs → 202 Accepted with a jobId.
  3. GET /v2/jobs/{id} → status + percentage.
  4. GET /v2/jobs/{id}/result → the packing result once succeeded.

See Async & validate for validating, polling, cancellation and idempotent retries.

Results

The result carries a summary (totals), carriers[] (each with its own placements[]), unplacedItems[] for whatever didn't fit, each with its reason (see Why cargo was left unplaced), and the units block the job used.

Each placement carries an itemId, a UUID assigned by the API, one per cargo line (array element), not per unit: a line with amount: 5 yields five placements that all share the same itemId. Two otherwise-identical cargo lines still get distinct itemIds. This is the reliable way to join a placement, or an unplaced entry, back to the cargo line that produced it.

Joining the rest of the result back to your request, case by case:

  • A cargo line's externalId is the label you sent: optional, may be empty, may repeat across lines. Display it, but join on itemId.
  • Cargo lines with identical contents (same dimensions, weight and labels) get distinct but anonymous itemIds: you cannot send one and first see it in the result, so only the order of cargo[] tells them apart. Give each a distinct externalId: it comes back on every placement and every unplaced entry.
  • A packed carrier has no itemId: externalId with instance is what the result offers to identify it, plus libraryId when its line referenced a library entry. Its name, category and geometry come back too, but none of them has to be unique.
  • A packed carrier whose line references a library entry comes back with externalId null when neither the line nor the entry has a label, and the carriers of two lines that reference one entry share its libraryId.
  • Two carrier entries with identical contents (both labelled EUR-PALLET, same name, same dimensions) can come back as two carriers that are both ("EUR-PALLET", 1): externalId may repeat, and instance counts from 1 again for every entry.

So the same practice covers both lists: if you need to join results back to your request, make your externalIds distinct: one per carrier entry, and one per cargo line you could not otherwise tell apart. It costs nothing at submit time and it removes the ambiguity entirely.

Saved carriers and SKUs

Carriers and cargo units (SKUs) you use again and again can be saved once in your company libraries, one library per type, and referenced from a job by id: a carrier line names a carrier entry, a cargo line a SKU. The job copies the definition when you submit it, so later changes to a library never touch a submitted job. The result names the entry back: a packed carrier, and every placement and unplaced item, carries a libraryId, null for an inline line. See Libraries, and its SKU libraries section for cargo.

Users, API keys and who did what

An account belongs to one person or to a team. Everyone in it works on the same jobs, saved loads, libraries and stacking rules. Each of them records who did it, as an actor in createdBy, and the ones you can change record who changed them last in updatedBy; a saved load records who saved it in savedBy. An actor has a type, an id and a via: a user (type: user, with via: agent when they acted through an AI agent they connected) or one of the account's API keys (type: apiKey), with the id of that user or key. A key acts for the account, not for the person who created it, so a job your integration submits names the key. The API returns ids only; the web app shows names. A user who leaves the account keeps their id on what they did.

{ "type": "user", "id": "0192f3a4-5b6c-7d8e-9f01-23456789abcd", "via": "agent" }

Every member is always there, via is null when the user acted directly, and a library entry of the system catalogue, which Loadoptimizer maintains, has null for createdBy and updatedBy. To list what one user, or one key, did, pass its id as createdBy on GET /v2/jobs or as savedBy on GET /v2/saved-loads. Handle a type or via you do not know: both can gain values.