---
title: Properties and Constraints
slug: docs/properties-and-constraints
description: Learn how Paccurate API's Properties and Constraints features enable sophisticated packing rules for battery weight limits, hazmat requirements, cold chain shipping, and more. Track custom attributes while optimizing cartonization decisions.
icon: ⛓️
docTags: PRQq_lBQtwy-4NNFrbNb8,f_WLoBkHazPq60SOFlrNA,1TaQf9nerJM0hn0bzoh86
createdAt: 2025-05-27T13:53:00.290Z
---

Learn how to use custom item properties to drive more precise and sophisticated packing behavior

The Paccurate API has robust support for packing rules and procedures. You can squish, stack, and exclude items, force items to pack alone or with extra dunnage, or pack in fully custom box sizes. As our customer base has grown, so has the complexity of packing requirements: variable limits on attributes like ice for cold chain or q value for hazmat shipments. Additionally, customers often want to track item attributes wherever the cartonization response is stored.

In order to handle these requirements, we have introduced new attributes to our API schema: **Properties** and **Constraints**. To better understand how properties and constraints work with each other, let’s start with a scenario. A shipper called Modern Electronics supplies myriad rechargeable items — laptops, cell phones, power banks, etc, each with varying sizes of batteries. While all of these items can be shipped with one another, no shipped carton can exceed a battery weight of 3lbs, per federal safety regulations. As we know, carton’s typical weight limit is much higher than that, and electronics often exceed that weight already. How can we make sure items are packed logically, while respecting these battery weight *constraints?* Enter: item *properties*.

Properties are simple: a map of key/value pairs. Keys are strings, and values can be any number type or a string. Item properties are returned in the pack response regardless of type. Number types are used in conjunction with `propertyConstraints` , which we’ll address shortly.

Here’s an example of an order from Modern Electronics with properties defined on each item.

JSON

```json
{
	"itemSets":[
		{
			"name":"Pear Laptop", 
			"quantity":2,
			"weight":4.01,
			"dimensions":{
				"x":2,
				"y":6,
				"z":11
			},
			"properties":{
				"battWeight":0.55,
				"HD":"SSD512",
				"bin-location-id":"C-8902"
			}
		},
		{
			"name":"Robo Tablet", 
			"quantity":4,
			"weight":1.89,
			"dimensions":{
				"x":1.3,
				"y":5,
				"z":8
			},
			"properties":{
				"battWeight":0.37,
				"HD":"SSD64",
				"bin-location-id":"H-1730"
			}
		},
	]
}
```

In the snippet above, we’ve added a property called `battWeight` to track the battery weight of each item, along with additional properties flagging the type of hard drive contained in the item and bin location to be tracked in client systems or added to a print ticket at packout.

Next, let’s see how to leverage the properties to drive cartonization decisions. Modern Electronics only has 3 different handling units, and each one has different limits on how much battery weight can be shipped within it. Let’s define them below:

JSON

```text
{
	"boxTypes":[
		{
			"name":"MED-HEAVY", 
			"weightMax":50,
			"dimensions":{
				"x":11,
				"y":6,
				"z":12
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":1.2
				}
			]
		},
		{
			"name":"LG-HEAVY", 
			"weightMax":50,
			"dimensions":{
				"x":13,
				"y":11,
				"z":17
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":1.3,
					"aggregate":"sum"
				}
			]
		},
		{
			"name":"SM-MAILER", 
			"weightMax":8,
			"dimensions":{
				"x":4,
				"y":13,
				"z":15
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":0.5,
					"aggregate": "sum"
				}
			]
		}
	]
} 
```

The `propertyConstraints` attribute is an array of constraint definitions. Each constraint has 4 attributes:

1. `key` - the property to be constrained
2. `max` - the maximum allowed value for the property in the carton
3. `aggregate` - defines how to combine new property values (currently only `"sum"` is available)
4. `value` - the initial property value to which item properties will aggregate (for example, an ice pack's starting value)

As items are packed into a box, Packer’s algorithm monitors their constrained properties. While our example only tracks one property (`battWeight`), you can monitor and constrain multiple properties. Once a constraint's `max` value is reached, the box won't accept any additional items that would exceed that limit.

JSON

```text
{
	"itemSets":[
		{
			"name":"Pear Laptop", 
			"quantity":2,
			"weight":4.01,
			"dimensions":{
				"x":2,
				"y":6,
				"z":11
			},
			"properties":{
				"battWeight":0.55,
				"HD":"SSD512",
				"bin-location-id":"C-8902"
			}
		},
		{
			"name":"Robo Tablet", 
			"quantity":4,
			"weight":1.89,
			"dimensions":{
				"x":1.3,
				"y":5,
				"z":8
			},
			"properties":{
				"battWeight":0.37,
				"HD":"SSD64",
				"bin-location-id":"H-1730"
			}
		}
	],
	"boxTypes":[
		{
			"name":"MED-HEAVY", 
			"weightMax":50,
			"dimensions":{
				"x":11,
				"y":6,
				"z":12
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":1.2
				}
			]
		},
		{
			"name":"LG-HEAVY", 
			"weightMax":50,
			"dimensions":{
				"x":13,
				"y":11,
				"z":17
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":1.3,
					"aggregate":"sum"
				}
			]
		},
		{
			"name":"SM-MAILER", 
			"weightMax":8,
			"dimensions":{
				"x":4,
				"y":13,
				"z":15
			},
			"propertyConstraints":[
				{
					"key":"battWeight",
					"max":0.5,
					"aggregate": "sum"
				}
			]
		}
	]
}
```

\\

As we can see in the [API response](https://inspector.manage.paccurate.io/config-editor?packUuid=cd440d1cbd4db9b0a0447ef91fec6e8f0c5a058ac60e11a981e1b0d455ad203c3b1124ab599b76dd7530e749ccd0424f715108268149b87f382c160601f13927), this order requires three different containers due to battery weight limits. The `Pear Laptop` has a battery weight of `.55`, which immediately disqualifies it from the `SM-MAILER`. The `MED-HEAVY` box can accommodate exactly two laptops, as their combined battery weight of 1.1 approaches the box's maximum constraint of 1.2. The four tablets have a total battery weight of 1.48—exceeding both the MED-HEAVY and LG-HEAVY box limits. As a result, three tablets are packed in the MED-HEAVY box, while the fourth goes into the SM-MAILER box.

Let's examine the response for this request. While the API returns comprehensive data about cost, volume, and item placement for each packed box, it now also includes calculated properties within the `propertyConstraints` attribute. Here's what the API returns for the first box's constraints:

JSON

```text
{
"propertyConstraints": [
    {
      "key": "battWeight",
      "max": 1.2,
      "value": 1.1
    }
  ]
}
```

The `value` is the total value of the `key` property in the box — in this case, it is .55 x 2 = 1.1.

Remember the other properties we sent along with each item? They are also present in the box’s `items` array for each instance of the item to be tracked by any system that may need to save and consume the pack response. The properties are present in the JSON response shown below.

JSON

```text
{
  "item": {
    "centerOfMass": {
      "x": 3,
      "y": 3,
      "z": 5.5
    },
    "color": "aqua",
    "deltaCost": 0,
    "dimensions": {
      "x": 2,
      "y": 6,
      "z": 11
    },
    "globalId": 1,
    "index": 2,
    "message": "packed #1 in 9.222µs at 2.479486ms in Box(name:MED-HEAVY dimensions:[11,6,12] weight:50 index:0)",
    "name": "Pear Laptop",
    "origin": {
      "x": 2,
      "y": 0,
      "z": 0
    },
    "packedIndex": 1,
    "properties": {
      "HD": "SSD512",
      "battWeight": 0.55,
      "bin-location-id": "C-8902"
    },
    "quantity": 1,
    "refId": 0,
    "sequence": "",
    "uniqueId": "0-1",
    "virtual": false,
    "weight": 4.01
  }
}
```

This example demonstrates how to use item properties and constraints in your cartonization process. The key/value pair system allows you to include any WMS or ERP system attributes in your cartonization requests for advanced packing rules. Here are some common applications of property limits:

- Cold chain: coolant limiting
- Hazmat: q value tracking
- Kitting: limiting number of specific skus a carton could contain

Contact us if you need help implementing these features.
