Skip to main content
You can create shipping rules in your Sendcloud account and use them in conjunction with our API to automate your parcel processing workflow. Shipping rules are pre-defined actions which will automatically apply to created parcels or imported orders when they match a given condition. An example of a shipping rule would be:
  • If [parcel weight] is less than [10kg], ship with [PostNL Home address only 0-23kg]
There is a wide range of conditions and actions available which cover almost every aspect of parcel creation. For a quick guide on how to streamline your workflow with shipping rules, see our help center.

Apply shipping rules when creating parcels

When you create a parcel using the Create a parcel or parcels endpoint in the Parcels API, you can indicate whether you want to apply shipping rules with the apply_shipping_rules field. The benefit of this is that you can already indicate how you want to ship a parcel without having to manually input multiple different fields in your API request. For example, you can use shipping rules to determine the shipping method, sender address or insurance value you want to apply to parcels based on the to/from address, shipping country, which parcel items are included, and many other conditions. Depending on whether or not you choose to immediately request the label, shipping rule behaviour will change as described below:

Method 1: Create a parcel and immediately request a shipping label

In this scenario, you create a parcel, announce it with the carrier and create the shipping label, all in a single API call. This is done by including "request_label": true in the request body. This is described in more detail in our documentation on creating parcels via the API.
  1. In the request body, use the shipping method id for the “Unstamped letter” method. (At the time of writing, this is 8, but note that shipping method ids can change.)
    • This is the same method as for creating test labels, but in this case the shipping method will be overridden if a shipping rule is found that matches the parcel’s other properties.
  2. Set the apply_shipping_rules field to true.
  3. If the parcel properties match one or more shipping rules, then those rules will be applied and the label will be created alongside the parcel.
Request method and URL
POST https://panel.sendcloud.sc/api/v2/parcels
Request body
{
  "parcel": {
    "shipment": {
      "id": 8
    },
    "apply_shipping_rules": true,
    "request_label": true
    // ...other parcel fields
  }
}

Method 2: Create a parcel without a shipping label

In this scenario, you’ve already created a parcel in Sendcloud, and your shipping rules have already been applied. For example, you created a parcel using the Create a parcel or parcels endpoint, with "request_label": false in the request body so the label is not immediately requested. You can continue making changes to the parcel up until the point where you request the shipping label. To request the label for a parcel that already has shipping rules applied, make a PUT request to the Update a parcel endpoint with "request_label": true in the request body.
Request method and URL
PUT https://panel.sendcloud.sc/api/v2/parcels
Request body
{
  "parcel": {
    "id": 1,
    "request_label": true
  }
}

Overriding shipping rules

If you want to override any applied shipping rules, make a PUT request to the Update a parcel endpoint. In the example request body below, we will request the label for our parcel with "request_label": true, and override the applied shipping rule by updating the shipping method to “DHLForYou Drop-off”.’
Request method and URL
PUT https://panel.sendcloud.sc/api/v2/parcels
Request body
{
  "parcel": {
    "id": 1,
    "request_label": true,
    "shipment": {
      "id": 117,
      "name": "DHLForYou Drop Off"
    }
  }
}