# Transport cost calculation logic

Transport costs represent the expenses incurred when goods are shipped between facilities or from a facility to the end consumer. These costs typically depend on the shipping service provider, the parcel or packaging type used, the destination country, and, depending on the chosen logic, additional factors such as weight or volume.

## Packing logic and shipping cost calculation

fulfillmenttools applies bin-packing logic to determine how ordered items are distributed across available packaging units and calculates shipping costs accordingly.

Two effort levels are available:

* [Standard logic](#standard-logic)
* [Advanced logic](#advanced-logic)

The logic applied to a given transfer within a sourcing path is determined by how the `packagingUnitByContexts` object is configured in the respective [facility connection](https://docs.fulfillmenttools.com/documentation/by-pillar/advanced-order-routing/complex-routing-with-combinatorics/network-model/facility-connection).

If a packaging unit is referenced within a facility connection, the `packagingUnitsByContexts` property may only define the corresponding transit times. All other information is inherited from the referenced `packagingUnit` and must not be redefined at the facility connection level.

{% hint style="info" %}
For details on how a fulfillment network is defined by facility connections and how they are structured, see the [Facility connection](/documentation/by-pillar/advanced-order-routing/complex-routing-with-combinatorics/network-model/facility-connection.md) article.
{% endhint %}

### Determining which logic applies

The active logic for a given transfer is determined only by how `packagingUnitByContexts` is configured in the corresponding facility connection:

<table><thead><tr><th width="397.671875">Configuration</th><th>Applied logic</th><th width="288.93359375">Example</th></tr></thead><tbody><tr><td>Packaging unit data is defined inline in <code>packagingUnitByContexts</code> in the facility connection.</td><td>Standard</td><td><pre><code>"packagingUnitsByContexts": [
    {
        "context": [
            {
                ,
                "type": "CATEGORY",
                "values": [
                    "WEBSHOP"
                ]
            }
        ],
        "packagingUnits": [
            {
                "name": "Parcel XXL",
                "priority": 1,
                "dimensions": {
                    "height": 1000,
                    "length": 1000,
                    "width": 1000,
                    "maxWeightInGram": 1000
                }
                "transitTime": {
                    "maxTransitDays": 3,
                    "minTransitDays": 1
                }
            }
        ]
    }
]
</code></pre></td></tr><tr><td>The facility connection <code>packagingUnitByContexts</code> references an external <code>packagingUnit</code></td><td>Advanced</td><td><pre><code>"packagingUnitsByContexts": [
    {
        "context": [
            {
                ,
                "type": "TAG_REFERENCE",
                "values": [
                    "WEBSHOP"
                ]
            }
        ],
        "packagingUnits": [
            {
                "name": "Parcel XXL",
                "packagingUnitRef": "2384df9220fj20j2d0",
                "priority": 1,
                "transitTime": {
                    "maxTransitDays": 3,
                    "minTransitDays": 1
                }
            }
        ]
    }
]
</code></pre></td></tr></tbody></table>

### Mixed logic within a sourcing route

The standard and advanced logics aren't mutually exclusive. Within a single sourcing route, different transfers can each apply a different logic, depending on how the respective facility connection is configured.

<figure><img src="/files/ze73QlaqawO8aBsDjRd5" alt=""><figcaption></figcaption></figure>

### Standard logic

The use of the standard logic is well‑suited for scenarios in which the carrier portfolio within the network is relatively homogeneous, and the pricing structure is simple, with only marginal differences between carriers.

The standard packing logic applies when packaging unit information is defined directly within the facility connection object in `packagingUnitByContexts`. No reference to an external collection is required.

A first-fit decreasing algorithm is applied to assign items to packaging units. This approach offers sufficient accuracy across a wide range of use cases and improves calculation speed.

{% hint style="info" %}
**First-fit decreasing algorithm**

* Check whether the largest item fits within the highest priority packaging unit (usually the smallest and cheapest to ship), based on the item's dimensions and the package's dimensions.
* If it does not fit, the next packaging unit is tried (in order of priority). If it fits, check for the next item to fit in this package, and so on.
* Do this for every item. If a packaging unit is full (considering its dimensions and restrictions), check for a second package, starting again with the package of highest priority.
* A packaging unit is full when the sum of the item volumes exceeds the inner parcel volume. However, an empty space (`volumeBufferInPercent`) might be deducted to ensure that the items really fit. Note: Geometries aren't considered, and no "Tetris" is played. So, it's important to leave some empty space.
* A parcel is also full if the maximum item amount is reached. This feature ensures that only one item is placed in a single package.
  {% endhint %}

Shipping costs are calculated using a standardized formula applied uniformly across all transfers using the standard logic.

### Advanced logic

The advanced logic is particularly suitable in scenarios where the carrier portfolio is broad and includes multiple shipping methods (for example, parcel, pallet, bulky goods, and two‑person handling).

In such environments, an optimized packing strategy combined with price‑optimized routing can significantly reduce fulfillment costs. This approach is especially beneficial when at least one of the following conditions applies:

* The network uses different parcel types
* Items vary significantly in size or dimensional characteristics
* The cost structure requires precise optimization across heterogeneous carriers

It should also be noted that the advanced logic is computationally more expensive and may not be ideal for very large networks where performance constraints are critical.

The advanced packing logic applies when `packagingUnitByContexts` within the facility connection references packaging units defined in a separate collection, rather than containing the packaging unit information inline.

{% hint style="info" %}
**Advanced algorithm**

* **Finds the cheapest combination of packaging units:** fulfillmenttools evaluates all feasible ways to group the ordered items into packaging units and selects the option with the lowest total cost.
* **Considers all available shipping options:** From standard parcels to freight and pallet shipments, fulfillmenttools automatically picks the best packaging unit type for each part of your order.
* **Respects physical constraints:** Item dimensions, weight limits, and carrier requirements are all factored in to ensure your shipment is valid and deliverable.
* **Guaranteed lowest shipping cost:** The result will always be the optimized packaging solution, not just a "good enough" estimate.
  {% endhint %}

In contrast to the first-fit decreasing approach, the advanced logic evaluates all possible distribution combinations within the solution space. The goal is cost optimization: the algorithm identifies the distribution of items across available facilities and their respective packaging units that results in the lowest overall shipping cost.

Packaging units defined in the separate collection also support a significantly broader set of configurable properties, including:

* Girth measurement
* Volumetric weight
* Detailed price tables dependent on weight and destination region

### Packaging unit type-specific definitions and calculation logics

The following section describes the logic applied to each `packagingUnit` type. It outlines the available configuration options, including the attributes and restrictions that can be defined for each type.

Also, it explains the factors used for price calculation, which are provided through the `packagingPricingDetails` associated with each packaging unit. Different shipping methods need different pricing calculation logics. These logics are defined per `packagingUnit` type and must be maintained accordingly.

All items are, by default, eligible for all packaging types unless this is explicitly restricted through `packagingUnitsByContexts.context[]` in the facility connection.

{% hint style="info" %}
All the following examples are using advanced logic. So, using the [packaging units endpoint](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#post-/api/packagingunits).
{% endhint %}

#### Parcel

**Definitions and restrictions**

The `parcel` `packagingUnit` type can be used for standard parcel shipment, fully enclosed in a box. Three-dimensional constraints apply because carriers calculate costs and enforce size limits based on weight, height, length, and width.

The maximum permissible dimensions are defined through the mandatory fields `maxWeight`, `maxHeightInMillimeters`, `maxWidthInMillimeters`, and `maxLengthInMillimeters`. These values establish the physical limits for routing and packing decisions. If an article or article combination exceeds any of these dimensions, fulfillmenttools doesn't assign it to this packaging unit.

The optional `volumeBufferInPercent` allows configuring additional free space within the parcel to account for packaging materials or irregular article geometries.

The optional `maxItemQuantity` specifies the maximum number of items that may be placed in a single parcel. This configuration can be used for operational requirements such as handling hazardous goods or specialized packaging scenarios, including bottle shipments or flower logistics.\
\
**Pricing structure and calculation logic**

The shipping cost for a parcel unit is determined by the `packagingPricingDetails` configuration and is composed of up to three components.

The primary cost is derived from the `pricing` array, which defines weight-based price brackets. Each bracket specifies an `upperThreshold` in grams and the corresponding shipping price. The bracket whose `upperThreshold` is equal to or greater than the actual shipment weight applies. Two approaches are available for handling shipments that exceed all defined thresholds:

* The highest configured `upperThreshold` matches the packaging unit's `maxWeight` exactly, ensuring no shipment exceeds the defined brackets.
* An `overflowFactor` is defined, which specifies the additional cost per gram above the highest `upperThreshold`.

This approach allows pricing to extend beyond the last bracket without requiring an exhaustive weight table.

Optionally, price brackets can be differentiated by destination region using the `zone` field within each `pricing` object. A zone is defined by the ISO 3166-2 country code, followed by a dash and the first digits of the destination postal code (for example, `DE-50` for Cologne, Germany). This allows different prices to apply based on the delivery location. This is particularly relevant for freight and pallet shipments, where regional pricing is standard practice among carriers, but it also applies to parcel shipments.

In addition, one or more surcharges can be configured in `surchargesPerPackagingUnits` and added to the net shipping price. Two surcharge types are supported:

* `ABSOLUTE_SURCHARGE_TYPE` adds a fixed monetary amount per unit. Typical examples include a fixed handling fee for manual processing or special workflow steps, or a fixed fuel surcharge per shipment where the carrier does not apply percentage-based rates.
* `RELATIVE_SURCHARGE_TYPE` adds a percentage of the net freight price. Typical examples include a percentage-based fuel surcharge or an environmental levy.

**Example parcel cost calculation**

Use the tabs below to click through the example scenario.

{% tabs %}
{% tab title="Definitions and restrictions" %}
We'll set the following definitions:

* **Maximum** **dimension**:
  * Maximum length: 120 cm
  * Maximum width: 60 cm
  * Maximum height: 60 cm
* **Maximum weight:** 31.5 kg
* **Volume buffer**: 5% (for packaging material)

{% code title="api/packagingUnits" %}

```json
"dimensions": {
      "maxWidth": 600,
      "maxHeight": 600,
      "maxLength": 1200
    },
    "maxWeight": 31500,
    "volumeBufferInPercent": 5,
```

{% endcode %}
{% endtab %}

{% tab title="Pricing details" %}

* **Pricing tiers**
  * Up to 2 kg: €3.00
  * Up to 5 kg: €4.00
  * Up to 10 kg: €7.00
  * Up to 31.5 kg: €11.00
* **Environmental surcharge per unit**: €1.50

{% code title="api/packagingUnits" %}

```json
"packagingPricingDetails": {
            "pricing": [
                {
                    "prices": [
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 300
                            },
                            "upperThreshold": 2000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 400
                            },
                            "upperThreshold": 5000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 700
                            },
                            "upperThreshold": 10000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 1100
                            },
                            "upperThreshold": 31500
                        }
                    ]
                }
            ],
            "surchargesPerPackagingUnits": [
                {
                    "type": "ABSOLUTE_SURCHARGE_TYPE",
                    "tenantSurchargeType": "Environmental surcharge",
                    "amount": {
                        "currency": "EUR",
                        "decimalPlaces": 2,
                        "value": 150
                    }
                }
            ]
        }
```

{% endcode %}
{% endtab %}

{% tab title="Items to pack" %}
**1 x item 1**

* 10 cm x 10 cm x 20 cm
* Weight per unit: 1.5 kg

**1x item 2**

* 20 cm x 40 cm x 80 cm
* Weight per unit: 6.1 kg

{% code title="listings.attributes for item 1" %}

```json
"attributes": [
                    {
                        "key": "weightPerUnit",
                        "value": "1500",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "height",
                        "value": "100",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "width",
                        "value": "100",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "length",
                        "value": "200",
                        "type": "NUMBER",
                        "category": "dimensions"
                    }
                ]
```

{% endcode %}
{% endtab %}

{% tab title="Result" %}

* 2 items need to be packed
* Items add up to a total weight of 7.6 kg (1.5 kg (item 1) + 6.1 kg (item 2)
* 7.6 kg has the corresponding pricing tier of up to 10 kg
* The up to 10 kg pricing tier is €7.00
* Add the mandatory environmental surcharge of €1.50

Total calculated costs: €7.00 + €1.50 = **€8.50**
{% endtab %}
{% endtabs %}

#### **Pallet**

**Definitions and restrictions**

This packaging unit type can be used for pallet-based shipment for heavier or bulk freight. In addition to three-dimensional constraints, a `volumetricWeightFactor` is required because freight carriers charge based on whichever is greater — actual weight or volumetric (dimensional) weight. The factor converts physical volume into a comparable weight value for cost calculation.

fulfillmenttools calculates the volumetric weight by dividing the packaging units' volume by the carrier‑specific `volumetricWeightFactor` (very common: 5000 or 6000). Routing and cost calculation use this value whenever the volumetric weight exceeds the actual weight, ensuring that carrier constraints and billing rules are applied consistently.

$$
volumetric Weight  = \frac{(length ⋅width⋅
height)}{volumetricWeightFactor}
$$

Additionally, a pallet may optionally define `maxItemQuantity` and `volumeBufferInPercent`, which are evaluated in the same way as for the parcel configuration.

**Pricing structure and calculation logic**

The shipping cost for a pallet unit follows the same zone-matching, weight-bracket, and surcharge logic as parcel units, with one additional step. Before the applicable price bracket is determined, fulfillmenttools calculates the shipment's volumetric weight using the mandatory `volumetricWeightFactor`. The greater of the actual weight and the volumetric weight is then used to select the price bracket. This reflects standard freight carrier practice, in which oversized but lightweight shipments are billed based on their dimensional weight rather than their actual weight. Multi-currency pricing, the `overflowFactor`, and `surchargesPerPackagingUnits` apply in the same way as for parcel units.

**Example pallet cost calculation**

Use the tabs below to click through the example scenario.

{% tabs %}
{% tab title="Definitions and restrictions" %}
We'll set the following definitions:

* **Maximum** **dimension**:
  * Maximum length: 120 cm
  * Maximum width: 80 cm
  * Maximum height: 180 cm
* **Maximum weight:** 2000 kg
* **Volume buffer**: 5% (for packaging material)

{% code title="api/packagingUnits" %}

```json
"dimensions": {
      "maxWidth": 800,
      "maxHeight": 1800,
      "maxLength": 1200
    },
    "maxWeight": 2000000,
    "volumeBufferInPercent": 5,
```

{% endcode %}
{% endtab %}

{% tab title="Pricing details" %}

* **Pricing tiers**
  * Up to 100 kg: €30.00
  * Up to 200 kg: €40.00
  * Up to 300 kg: €48.00
  * ...
  * Up to 2000 kg: €200.00
* **Environmental surcharge per unit**: €1.50

{% code title="api/packagingUnits" %}

```json
"packagingPricingDetails": {
            "pricing": [
                {
                    "prices": [
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 3000
                            },
                            "upperThreshold": 100000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 4000
                            },
                            "upperThreshold": 200000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 4800
                            },
                            "upperThreshold": 300000
                        },
                        ...
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 20000
                            },
                            "upperThreshold": 2000000
                        }
                    ]
                }
            ],
            "surchargesPerPackagingUnits": [
                {
                    "type": "ABSOLUTE_SURCHARGE_TYPE",
                    "tenantSurchargeType": "Environmental surcharge",
                    "amount": {
                        "currency": "EUR",
                        "decimalPlaces": 2,
                        "value": 150
                    }
                }
            ]
        }
```

{% endcode %}
{% endtab %}

{% tab title="Items to pack" %}
**10 x item 1:**

* 100 cm x 15 cm x 5 cm
* Weight per unit: 25 kg

**40 x item 2**

* 60 cm x 20 cm x 1 cm
* Weight per unit: 1 kg

{% code title="listings.attributes for item 1" %}

```json
"attributes": [
                    {
                        "key": "weightPerUnit",
                        "value": "25000",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "height",
                        "value": "1000",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "width",
                        "value": "150",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "length",
                        "value": "50",
                        "type": "NUMBER",
                        "category": "dimensions"
                    }
                ]
```

{% endcode %}
{% endtab %}

{% tab title="Result" %}

* 50 items need to be packed
* The volumetric weight is lower than the real weight, so the real weight is used
* Items add up to a total weight of 290 kg (250 kg (10 x item 1 (25 kg)) + 40 kg (40 x item 2 (1kg))
* 290 kg has the corresponding pricing tier of up to 300 kg
* The up to 300 kg pricing tier is €48.00
* Add the mandatory environmental surcharge of €1.50

Total calculated costs: €48.00 + €1.50 = **€49.50**
{% endtab %}
{% endtabs %}

#### Bulky goods

**Definitions and restrictions**

This packaging unit type can be used for oversized or irregularly shaped items (for example, doors, bicycles, car tires, and so on) that can't be packed using a standard three‑dimensional box. Instead of height, length, and width, carriers for bulky goods typically apply girth‑based constraints, which express the combined circumference and longest dimension of a shipment.

For packaging units of this type, the maximum allowable girth (`maxGirth`) must be defined.

In addition, carriers also enforce restrictions on maximum length (`maxLength`) and maximum weight (`maxWeight`). Optionally, a maximum number of items (`maxItemQuantity`) can be specified to limit how many articles may be consolidated into a single bulky‑goods shipment.

$$
girth = length + 2  (width + height)
$$

**Pricing structure and calculation logic**

The shipping cost for a bulky goods unit is calculated using the same zone-matching, weight-bracket, and surcharge model as parcel units. Because bulky goods are defined by `maxLength` and `maxGirth` rather than three-dimensional box measurements, volumetric weight can't be derived, and no `volumetricWeightFactor` is applied.

Multi-currency pricing, the `overflowFactor`, and all configured `surchargesPerPackagingUnits` apply in the same way as for parcel units.

**Example bulky good cost calculation**

{% tabs %}
{% tab title="Definitions and restrictions" %}
We'll set the following definitions:

* **Maximum** **dimension**:
  * Maximum length: 200 cm
  * Maximum girth: 300 cm
* **Maximum weight:** 31.5 kg

{% code title="api/packagingUnits" %}

```json
{
    "dimensions": {
        "maxLength": 2000,
        "maxGirth": 3000,
        "maxWeight": 31500
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Pricing details" %}

* **Pricing tiers**
  * Up to 31.5 kg: €25.00

{% code title="api/packagingUnits" %}

```json
{
    "packagingPricingDetails": {
        "pricing": [
            {
                "prices": [
                    {
                        "price": {
                            "currency": "EUR",
                            "decimalPlaces": 2,
                            "value": 2500
                        },
                        "upperThreshold": 31500
                    }
                ]
            }
        ]
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Items to pack" %}
**1 x item 1:**

* 140 cm x 60 cm x 7 cm
* Weight per unit: 19 kg

{% code title="listings.attributes for item 1" %}

```json
"attributes": [
                    {
                        "key": "weightPerUnit",
                        "value": "1900",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "height",
                        "value": "1400",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "width",
                        "value": "600",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "length",
                        "value": "70",
                        "type": "NUMBER",
                        "category": "dimensions"
                    }
                ]
```

{% endcode %}
{% endtab %}

{% tab title="Result" %}

* 1 item needs to be packed
* The `maxGirth` is 300 cm
* The girth of the item to pack is 274 cm (140 cm + 2(60 cm + 7 cm))
* The item is within the `maxGirth`
* The price is fixed at €25.00

Total calculated costs: **€25.00**
{% endtab %}
{% endtabs %}

#### Two-person handling

**Definitions and restrictions**

This packaging unit type is suitable for heavy or large items that require two-person delivery (for example, furniture). Three-dimensional constraints apply as with parcels. An additional optional `maxVolume` field is available for carriers that enforce a total cubic volume limit independent of individual dimensions. Also, a `maxItemQuantity` restriction can be applied here.

**Pricing structure and calculation logic**

Volume-based pricing tiers define the shipping cost for two-person handling. For the surcharge model, the optional `overflowFactor` and all configured `surchargesPerPackagingUnits` are evaluated analogously to the other `packagingUnitTypes`. The optional `maxVolume` constraint on the unit determines whether a given set of items is eligible for this packaging unit. Still, it doesn't effect the cost calculation itself.

**Example two-person handling cost calculation**

{% tabs %}
{% tab title="Definitions and restrictions" %}
We'll set the following definitions:

* **Maximum** **dimension**:
  * Maximum length: 400 cm
  * Maximum width: 230 cm
  * Maximum height: 200 cm
* **Maximum weight:** 200 kg
* **Maximum volume:** 4 CBM

{% code title="api/packagingUnits" %}

```json
{
    "dimensions": {
        "maxWidth": 2300,
        "maxHeight": 2000,
        "maxLength": 4000
    },
    "maxWeight": 31500,
    "maxVolume": 4000000000
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Pricing details" %}

* **Pricing tiers**
  * Up to 0.2 CBM: €20.00
  * Up to 0.4 CBM: €30.00
  * Up to 0.6 CBM: €37.00
  * Up to 0.8 CBM: €43.00
  * Up to 1.0 CBM: €48.00
  * Every additional 0.1 CBM: €2.00
* **Environmental surcharge per unit**: €1.50
* **Pre‑carriage costs per started CBM**: €6.00

{% code title="api/packagingUnits" %}

```json
"packagingPricingDetails": {
            "surchargesPerPackagingUnits": [
                {
                    "tenantSurchargeType": "Environmental surcharge",
                    "type": "ABSOLUTE_SURCHARGE_TYPE",
                    "amount": {
                        "currency": "EUR",
                        "decimalPlaces": 2,
                        "value": 150
                    }
                }
            ],
            "costCoefficient": {
                "value": {
                    "currency": "EUR",
                    "decimalPlaces": 2,
                    "value": 600
                },
                "measurementUnit": "CUBIC_METER"
            },
            "pricing": [
                {
                    "prices": [
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 2000
                            },
                            "upperThreshold": 200000000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 3500
                            },
                            "upperThreshold": 400000000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 3700
                            },
                            "upperThreshold": 600000000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 4300
                            },
                            "upperThreshold": 800000000
                        },
                        {
                            "price": {
                                "currency": "EUR",
                                "decimalPlaces": 2,
                                "value": 4800
                            },
                            "upperThreshold": 1000000000
                        }
                    ],
                    "overflowFactor": {
                        "price": {
                            "currency": "EUR",
                            "decimalPlaces": 2,
                            "value": 2000
                        },
                        "factor": 100000000
                    }
                }
            ]
        }
```

{% endcode %}
{% endtab %}

{% tab title="Items to pack" %}
**1 x item 1:**

* 200 cm x 100 cm x 60 cm
* Weight per unit: 68 kg

{% code title="listings.attributes for item 1" %}

```json
"attributes": [
                    {
                        "key": "weightPerUnit",
                        "value": "68000",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "height",
                        "value": "2000",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "width",
                        "value": "1000",
                        "type": "NUMBER",
                        "category": "dimensions"
                    },
                    {
                        "key": "length",
                        "value": "600",
                        "type": "NUMBER",
                        "category": "dimensions"
                    }
                ]
```

{% endcode %}
{% endtab %}

{% tab title="Result" %}

* 1 item needs to be packed
* The `maxVolume` is 4 CBM
* The volume of the item to pack is 1.2 CBM (200 cm x 100 cm x 60 cm = 1.2 CBM)
* The item is within the `maxVolume`
* The up to 1 CBM pricing tier is €48.00
* Every extra 0.1 CBM is €2.00 (2 x €2.00 = €4.00)
* Add the pre‑carriage costs per started CBM (2 x €6.00 = €12.00)
* Add the mandatory environmental surcharge of €1.50

Total calculated costs: €48.00 + €4.00 + €12.00 + €1.50 = **€65.50**
{% endtab %}
{% endtabs %}

## Create a PackagingUnitDetail by its ID

> This part of the API is in Beta status. For details please check the \<a href="<https://docs.fulfillmenttools.com/documentation/developer-docs/api/core-concepts/api-release-life-cycle#beta>" target="\_blank">api-release-life-cycle documentation\</a>.\<br />\<br />Creates a single PackagingUnitDetail.

```json
{"openapi":"3.0.1","info":{"title":"fulfillmenttools","version":"VERSIONLESS"},"tags":[],"servers":[{"url":"https://{tenant}.api.fulfillmenttools.com","variables":{"tenant":{"default":"your-tenant-name"}}}],"security":[{"BearerToken":[]}],"components":{"securitySchemes":{"BearerToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"PackagingUnitDetailForCreation":{"properties":{"nameLocalized":{"$ref":"#/components/schemas/LocaleStringConstrained"},"carrierRef":{"description":"The reference to the carrier associated with the packagingUnit.","type":"string"},"details":{"anyOf":[{"$ref":"#/components/schemas/PalletDetails"},{"$ref":"#/components/schemas/ParcelDetails"},{"$ref":"#/components/schemas/BulkyGoodsDetails"},{"$ref":"#/components/schemas/TwoManHandlingDetails"}]},"tenantPackagingUnitId":{"description":"The tenant specific identifier for the packagingUnit.","type":"string"}},"required":["nameLocalized","tenantPackagingUnitId","carrierRef","details"],"title":"PackagingUnitDetailForCreation","type":"object","description":"PackagingUnitDetailForCreation"},"LocaleStringConstrained":{"properties":{},"title":"LocaleStringConstrained","type":"object","description":"LocaleStringConstrained"},"PalletDetails":{"properties":{"dimensions":{"$ref":"#/components/schemas/PackagingUnitDetailDimensions"},"maxItemQuantity":{"description":"The maximum number of items that can fit in the packagingUnit.","type":"number"},"maxWeight":{"description":"The maximum weight in grams that the packagingUnit can hold.","type":"number"},"packagingPricingDetails":{"$ref":"#/components/schemas/PackagingPricingDetails"},"type":{"description":"The type of the packagingUnit.","enum":["PALLET","TWO_MAN_HANDLING","PARCEL","BULKY_GOODS"],"type":"string"},"volumeBufferInPercent":{"description":"The volume buffer in percent for the packagingUnit.","type":"number"},"volumetricWeightFactor":{"description":"The volumetric weight factor for the packagingUnit.","type":"number"}},"required":["type","dimensions","maxWeight","volumetricWeightFactor","packagingPricingDetails"],"title":"PalletDetails","type":"object","description":"PalletDetails"},"PackagingUnitDetailDimensions":{"properties":{"maxHeight":{"description":"The max height of the packagingUnit in millimeters.","type":"number"},"maxLength":{"description":"The max length of the packagingUnit in millimeters.","type":"number"},"maxWidth":{"description":"The max width of the packagingUnit in millimeters.","type":"number"}},"required":["maxHeight","maxLength","maxWidth"],"title":"PackagingUnitDetailDimensions","type":"object","description":"PackagingUnitDetailDimensions"},"PackagingPricingDetails":{"properties":{"costCoefficient":{"allOf":[{"$ref":"#/components/schemas/PackagingUnitCostCoefficient"}],"description":"Cost coefficient for two-man handling"},"pricing":{"items":{"$ref":"#/components/schemas/PackagingUnitDetailPricingByZone"},"maxItems":500,"type":"array"},"surchargesPerPackagingUnits":{"description":"The surcharge applied per packagingUnit.","items":{"discriminator":{"mapping":{"ABSOLUTE_SURCHARGE_TYPE":"#/components/schemas/PackagingUnitDetailAbsoluteSurcharge","RELATIVE_SURCHARGE_TYPE":"#/components/schemas/PackagingUnitDetailRelativeSurcharge"},"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/PackagingUnitDetailRelativeSurcharge"},{"$ref":"#/components/schemas/PackagingUnitDetailAbsoluteSurcharge"}]},"maxItems":500,"type":"array"}},"required":["pricing"],"title":"PackagingPricingDetails","type":"object","description":"PackagingPricingDetails"},"PackagingUnitCostCoefficient":{"properties":{"measurementUnit":{"enum":["GRAM","CUBIC_METER"],"type":"string"},"value":{"$ref":"#/components/schemas/PackagingUnitsMoney"}},"required":["value","measurementUnit"],"title":"PackagingUnitCostCoefficient","type":"object","description":"PackagingUnitCostCoefficient"},"PackagingUnitsMoney":{"properties":{"currency":{"description":"The ISO 4217 currency code, e.g. EUR for Euro.","type":"string"},"decimalPlaces":{"default":2,"description":"The number of decimal places used by the currency, e.g. 2 for Euro.","type":"number"},"value":{"description":"The monetary value in the smallest currency unit","type":"number"}},"required":["currency","value"],"title":"PackagingUnitsMoney","type":"object","description":"PackagingUnitsMoney"},"PackagingUnitDetailPricingByZone":{"properties":{"overflowFactor":{"$ref":"#/components/schemas/PackagingUnitDetailOverflowFactor"},"prices":{"items":{"$ref":"#/components/schemas/PackagingUnitDetailPricesByWeight"},"maxItems":500,"type":"array"},"zone":{"description":"The shipping zone for which the pricing applies. Please proivide the ISO 3166-2 Country Code, followed by a dash and the first digits of the postal code, e.g. DE-50 for Cologne, Germany.","type":"string"}},"required":["prices"],"title":"PackagingUnitDetailPricingByZone","type":"object","description":"PackagingUnitDetailPricingByZone"},"PackagingUnitDetailOverflowFactor":{"properties":{"factor":{"description":"The factor appliable when the overflow factor is exceeded","type":"number"},"price":{"$ref":"#/components/schemas/PackagingUnitsMoney"}},"required":["price","factor"],"title":"PackagingUnitDetailOverflowFactor","type":"object","description":"PackagingUnitDetailOverflowFactor"},"PackagingUnitDetailPricesByWeight":{"properties":{"price":{"$ref":"#/components/schemas/PackagingUnitsMoney"},"upperThreshold":{"description":"The weight threshold in grams up to which this price applies.","type":"number"}},"required":["price","upperThreshold"],"title":"PackagingUnitDetailPricesByWeight","type":"object","description":"PackagingUnitDetailPricesByWeight"},"PackagingUnitDetailRelativeSurcharge":{"properties":{"percentage":{"description":"The percentage of the surcharge.","type":"number"},"tenantSurchargeType":{"description":"The tenant specific identifier for the surcharge type.","type":"string"},"type":{"allOf":[{"$ref":"#/components/schemas/PackagingUnitDetailSurchargeType"}],"description":"The type of surcharge, which is RELATIVE in this case."}},"required":["tenantSurchargeType","type","percentage"],"title":"PackagingUnitDetailRelativeSurcharge","type":"object","description":"PackagingUnitDetailRelativeSurcharge"},"PackagingUnitDetailSurchargeType":{"description":"The type of surcharge, which is RELATIVE in this case.","enum":["ABSOLUTE_SURCHARGE_TYPE","RELATIVE_SURCHARGE_TYPE"],"title":"PackagingUnitDetailSurchargeType","type":"string"},"PackagingUnitDetailAbsoluteSurcharge":{"properties":{"amount":{"$ref":"#/components/schemas/PackagingUnitsMoney"},"tenantSurchargeType":{"description":"The tenant specific identifier for the surcharge type.","type":"string"},"type":{"allOf":[{"$ref":"#/components/schemas/PackagingUnitDetailSurchargeType"}],"description":"The type of surcharge, which is ABSOLUTE in this case."}},"required":["tenantSurchargeType","type","amount"],"title":"PackagingUnitDetailAbsoluteSurcharge","type":"object","description":"PackagingUnitDetailAbsoluteSurcharge"},"ParcelDetails":{"properties":{"dimensions":{"$ref":"#/components/schemas/PackagingUnitDetailDimensions"},"maxItemQuantity":{"description":"The maximum number of items that can fit in the packagingUnit.","type":"number"},"maxWeight":{"description":"The maximum weight in grams that the packagingUnit can hold.","type":"number"},"packagingPricingDetails":{"$ref":"#/components/schemas/PackagingPricingDetails"},"type":{"description":"The type of the packagingUnit.","enum":["PALLET","TWO_MAN_HANDLING","PARCEL","BULKY_GOODS"],"type":"string"},"volumeBufferInPercent":{"description":"The volume buffer in percent for the packagingUnit.","type":"number"}},"required":["type","dimensions","maxWeight","packagingPricingDetails"],"title":"ParcelDetails","type":"object","description":"ParcelDetails"},"BulkyGoodsDetails":{"properties":{"maxGirth":{"description":"The maximum girth in millimeters of the packagingUnit.","type":"number"},"maxItemQuantity":{"description":"The maximum number of items that can fit in the packagingUnit.","type":"number"},"maxLength":{"description":"The maximum length in millimeters of the packagingUnit.","type":"number"},"maxWeight":{"description":"The maximum weight in grams that the packagingUnit can hold.","type":"number"},"packagingPricingDetails":{"$ref":"#/components/schemas/PackagingPricingDetails"},"type":{"description":"The type of the packagingUnit.","enum":["PALLET","TWO_MAN_HANDLING","PARCEL","BULKY_GOODS"],"type":"string"},"volumeBufferInPercent":{"description":"The volume buffer in percent for the packagingUnit.","type":"number"}},"required":["type","maxLength","maxGirth","maxWeight","packagingPricingDetails"],"title":"BulkyGoodsDetails","type":"object","description":"BulkyGoodsDetails"},"TwoManHandlingDetails":{"properties":{"dimensions":{"$ref":"#/components/schemas/PackagingUnitDetailDimensions"},"maxItemQuantity":{"description":"The maximum number of items that can fit in the packagingUnit.","type":"number"},"maxVolume":{"description":"The maximum volume in cubicle millimeters of the packagingUnit.","type":"number"},"maxWeight":{"description":"The maximum weight in grams that the packagingUnit can hold.","type":"number"},"packagingPricingDetails":{"$ref":"#/components/schemas/PackagingPricingDetails"},"type":{"description":"The type of the packagingUnit.","enum":["PALLET","TWO_MAN_HANDLING","PARCEL","BULKY_GOODS"],"type":"string"},"volumeBufferInPercent":{"description":"The volume buffer in percent for the packagingUnit.","type":"number"}},"required":["type","dimensions","maxWeight","packagingPricingDetails"],"title":"TwoManHandlingDetails","type":"object","description":"TwoManHandlingDetails"},"ApiError":{"items":{"$ref":"#/components/schemas/ErrorInner"},"type":"array","xml":{"name":"ApiError"},"title":"ApiError","description":"ApiError"},"ErrorInner":{"properties":{"description":{"type":"string"},"requestVersion":{"description":"The version provided within an invalid request.","format":"int64","type":"integer"},"summary":{"type":"string"},"version":{"format":"int64","type":"integer"}},"required":["summary"],"type":"object","title":"ErrorInner","description":"ErrorInner"}}},"paths":{"/api/packagingunits":{"post":{"deprecated":false,"description":"This part of the API is in Beta status. For details please check the <a href=\"https://docs.fulfillmenttools.com/documentation/developer-docs/api/core-concepts/api-release-life-cycle#beta\" target=\"_blank\">api-release-life-cycle documentation</a>.<br /><br />Creates a single PackagingUnitDetail.","operationId":"createPackagingUnitDetail","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackagingUnitDetailForCreation"}}},"required":true},"responses":{"200":{"description":"Successfully created the PackagingUnitDetail."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}},"description":"Your user is not allowed to operate against this API instance"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}},"description":"Your user, although recognized, is not authorized to use this"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}},"description":"The requested entity was not found"}},"summary":"Create a PackagingUnitDetail by its ID","tags":["PackagingUnits (DOMS)"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fulfillmenttools.com/documentation/by-pillar/advanced-order-routing/complex-routing-with-combinatorics/calculations-within-routing/transport-cost-calculation-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
