Constraints
Three per-item controls tell the solver what it may do with a cargo line once it is placed: whether other cargo may rest on top of it, whether it may stack only on its own SKU, and which way it may be turned.
When to use this
allowedRotations(top): four before-and-after pairs. The box stands on a floor and its bottom face is hatched, so you can follow that one face through the change. Under["Z"]the box makes a quarter turn and the hatched face stays on the floor; under["X"]or["Y"]the box tips about a bottom edge and the hatched face ends up facing sideways; under[]the two poses are identical, because nothing may turn.allowStackingOnTop(bottom): whether other items may rest above this one.
- You need to stop other cargo from being stacked on a fragile or top-heavy line.
- You need each product to stack only on itself, without creating a class per product (see Stack only with the same SKU).
- You need to keep a cargo line upright, restrict it to specific faces, or forbid any rotation at all.
Walkthrough
Stacking & support
allowStackingOnTop is a boolean under constraints on a cargo entry. It controls whether other cargo may be placed directly on top of this one:
{
"externalId": "TV-55",
"category": "box",
"amount": 40,
"geometry": { "type": "box", "dimensionX": 1300, "dimensionY": 200, "dimensionZ": 800 },
"weight": 22,
"constraints": {
"allowStackingOnTop": false
}
}
allowStackingOnTop:false(the default) means nothing may be placed on top of this cargo line;trueallows other items to be stacked on it.
To keep rules between kinds of cargo, see Stacking rules.
Stack only with the same SKU
To let a product stack only on itself, set sameSkuStacking: "upperAndLower" under constraints. Its boxes then stand in columns of their own: the box directly underneath and the box resting directly on top must be the same SKU, or the floor underneath. It needs no cargo classes and no rules, however many products the job has.
| Value | Meaning |
|---|---|
none (the default) |
No requirement: the box stacks as it would without this member. |
upperAndLower |
Columns of one SKU: the boxes in direct contact above and below must be the same SKU. |
The values are accepted in any case and returned as written above. Any other value is a 400 validation_failed at the member. More values may be added later; a client that reads sameSkuStacking back tolerates a value it does not know.
Three lines that each stack only on themselves, so every column holds one product:
[
{ "externalId": "TV-55", "amount": 40, "geometry": { "type": "box", "dimensionX": 1300, "dimensionY": 200, "dimensionZ": 800 }, "weight": 22,
"constraints": { "allowStackingOnTop": true, "sameSkuStacking": "upperAndLower" } },
{ "externalId": "SOUNDBAR", "amount": 60, "geometry": { "type": "box", "dimensionX": 1000, "dimensionY": 150, "dimensionZ": 200 }, "weight": 6,
"constraints": { "allowStackingOnTop": true, "sameSkuStacking": "upperAndLower" } },
{ "externalId": "STAND", "amount": 25, "geometry": { "type": "box", "dimensionX": 600, "dimensionY": 600, "dimensionZ": 300 }, "weight": 9,
"constraints": { "allowStackingOnTop": true, "sameSkuStacking": "upperAndLower" } }
]
- The same SKU. Cargo lines that reference one SKU with
libraryIdare that SKU, whatever their overrides. An inline line is a SKU of its own: two inline lines are never the same SKU, even with equal dimensions, so to let several lines stack on each other, reference one SKU from a library. The 40 units of a line withamount: 40are one SKU and stack on each other. - Both lines set it. A box of a line with
upperAndLowertouches only boxes of the same SKU whose line setsupperAndLowertoo. This matters when one line of a SKU overrides the SKU's value withnone: its boxes stack as usual, but not on or under the boxes of the lines that keepupperAndLower. - With
allowStackingOnTop. Nothing rests on a box unless its line allows it, andallowStackingOnTopdefaults tofalse. SendallowStackingOnTop: truenext tosameSkuStacking;POST /v2/jobs/validatewarns withstacking_disabledwhen no line allows stacking. - With cargo classes and stacking rules. They all apply and the strictest wins: a glass line with
upperAndLowerunder adirectOnrule for glass on glass does not stack at all, and under a tower limit of 3 for glass on glass its columns are at most 3 high. See Stacking rules.
Orientation
allowedRotations is the only rotation control on a cargo entry (see Not supported). It names which axes ("X", "Y", "Z") the box may be turned 90° about, relative to the orientation you submitted it in:
{
"externalId": "GLASS-PANEL",
"category": "box",
"amount": 60,
"geometry": { "type": "box", "dimensionX": 1600, "dimensionY": 50, "dimensionZ": 1100 },
"weight": 35,
"constraints": {
"allowedRotations": []
}
}
| Value | Meaning |
|---|---|
| omitted | ["Z"]: upright, may spin about the vertical axis |
["Z"] |
the footprint turns; the box stays upright |
["X"] or ["Y"] |
the box tips onto another face |
[] |
no rotation at all, placed exactly as submitted |
| an unknown token | 400 |
Omitted is not the same as empty. Leaving out allowedRotations falls back to the default: upright, free to spin about Z; sending [] explicitly locks the box in the exact orientation you submitted, with no rotation permitted at all.
Packing the load toward one end or side (consolidation) is a secondary objective, not a per-item constraint. See Optimization objectives.
Key fields
| Field | Where | Type | Meaning |
|---|---|---|---|
constraints.allowStackingOnTop |
cargo entry | boolean | Whether other items may rest on top of this one. Default false. |
constraints.sameSkuStacking |
cargo entry | string | Whether the line stacks only with the same SKU (upperAndLower). Default none. |
constraints.allowedRotations |
cargo entry | string[] |
Axes (X/Y/Z) the box may be turned 90° about. Omitted → ["Z"]; [] → locked in the submitted orientation. |
Notes & caveats
- Constraints are per cargo line only. Carriers in this API have no
constraintsfield; only a cargo entry carries one. - These two fields are a line's own rules; rules between kinds of cargo are in Stacking rules. See Not supported for what it does not have.
- Omitted vs. empty is not the same for
allowedRotations. Omitting it defaults to["Z"](upright, may spin); sending[]explicitly forbids any rotation.
Related
- Building load units: how a cargo line's geometry and weight are described.
- Optimization objectives: consolidation and CenterLoadMass, the secondary objectives that shape the plan.
- Errors & troubleshooting: the one
validation_failedproblem and itserrors[]that a validation failure comes back as.