How a rule works
Each rule is made up of:
| Part↕ | Description↕ |
|---|---|
| Condition | When the rule applies, based on the shipment's data (see the condition fields below). |
| Actions | What the rule changes on the shipment when the condition matches (see the actions below). |
| Starts at | The date the rule becomes effective. If empty, the rule is disabled. |
| Ends at | The date the rule stops being effective. If empty, the rule has no end date. |
Condition fields
These are the read-only facts about a shipment that a condition can reference. Conditions can compare against them, but actions cannot change them.
Weight and dimensions
| Field↕ | Type↕ | Description↕ |
|---|---|---|
weight | Number | Total weight of the shipment. |
weight_unit | String | Unit of weight (for example, lb, kg, oz). |
dimension_unit | String | Unit of dimensions (for example, in, cm). |
Geography
| Field↕ | Type↕ | Description↕ |
|---|---|---|
ship_to_country | Country | Destination country. |
ship_from_country | Country | Origin country. |
ship_to_state | String | Destination state or province code. |
ship_to_postal_code | String | Destination postal code. |
Shipment flags
| Field↕ | Type↕ | Description↕ |
|---|---|---|
is_domestic | Boolean | true when the origin and destination country match. |
Customs and compliance
| Field↕ | Type↕ | Description↕ |
|---|---|---|
ddp | Boolean | Whether the shipment is DDP (duties prepaid). |
ddu | Boolean | Whether the shipment is DDU (duties unpaid). |
base_currency | Currency | Base currency of the merchant. |
hs_codes | String list | All HS codes in the shipment. |
countries_of_origin | String list | Countries of origin for all items. |
Monetary amounts
| Field↕ | Type↕ | Description↕ |
|---|---|---|
items_total | Money | Total value of the items. |
shipping_total | Money | Shipping cost. |
duty_total | Money | Total duty amount. |
tax_total | Money | Total tax amount. |
grand_total | Money | Grand total (items_total + shipping_total + duty_total + tax_total). |
Item data
| Field↕ | Type↕ | Description↕ |
|---|---|---|
sku_list | String list | All SKUs on the order. |
item_count | Number | Total number of items in the shipment. |
Actions
When a rule matches, its actions assign values to the fields below. After all actions run, the changed values are applied back to the shipment.
| Action↕ | Type↕ | What it does↕ |
|---|---|---|
service_level | String | Sets the shipment's service level by code or ID. |
package_type | String | Sets the packaging type on every carton. |
signature_required | Boolean | When true, requires a direct signature on each carton; when false, sets no signature. |
insurance | Boolean | When true, insures the shipment for the full items_total; when false, sets the declared value to 0. |
customs_description | String | Sets the customs description on all items in the shipment. |
How actions are applied
- An action only takes effect if it changes the existing value.
- A
package_typevalue that doesn't match a known packaging type is skipped. - If one rule fails (for example, an invalid expression), it is skipped and logged. It does not block other rules or fail the shipment.
Examples
A few common ways merchants use shipment automation rules:
- Require a signature and set a packaging type on shipments over a certain weight.
- Add insurance to high-value DDP shipments.
- Set a customs description for items in a specific product category.
- Upgrade the service level for shipments to a specific destination.
Setting up rules
To get shipment automation rules created for your account, contact your Zonos representative. Share the conditions you want to match and the actions you want applied, and the Zonos team will configure the rules for you.
Auditing applied rules
Every time a rule is applied to a shipment, Zonos records an applied-rule entry capturing the before and after values of the affected fields. These entries are available on the shipment so you can audit exactly which rules ran and what they changed.
Shipment automation rules
Automatically modify shipments as they are created, based on conditions you define.
Shipment automation rules adjust a shipment as it is created, based on its data. Define a rule once and Zonos applies it to every matching shipment—no setting the service level, packaging, or signature by hand on each one.
Each rule is a pair of expressions:
Rules run automatically whenever shipments are created.