All Collections
API
Waybill / Routing Label - RESTful API
Waybill / Routing Label - RESTful API

Generate waybill and routing labels for bulk shipments.

Jan Petersen avatar
Written by Jan Petersen
Updated over a week ago

Bulk shipments require a waybill and corresponding routing labels.

This guide will go through how to generate these through the API.

This is currently supported for Bring and PostNord Denmark (Samsending/Bulksplit).

Carrier flows

Each carriers has a special flow of handling waybill and routing labels.

PostNord Denmark

PostNord Denmark require a direct relation between the shipment and the waybill when booking the shipments of the waybill. This means that a waybill must be opened before booking any bulk shipments.

So the flow is as follows:

  1. Create a waybill with status "open".

  2. Book the shipments with service "Samsending" / "Bulksplit".

  3. Close the waybill.

The waybill that is returned also include a invoice for all shipments included.

Bring

In order to produce an invoice for bulk shipments, shipments must have a direct relation to the waybill. This means that a waybill must be opened before booking any bulk shipments.

So the flow is as follows:

  1. Create a waybill with status "open".

  2. Book the shipments using bulk products.

  3. Close the waybill.

Note! You are still this able to close the waybill without any relation to get waybill and routing labels, but an open waybill is required to book bulk shipments for Bring.

Request body

This section does not cover the full request body. Please refer to our API specification for a detailed view of the request body.

The waybill requires sender, receiver addresses. For Bring, loading and delivery addreses are also available. The system will use sender for loading and receiver for delivery if they're left out, although loading date is still required
Knowing this (packages will be explained in the next section) the minimal request body for Bring looks as follows:

{
"carrier_code": "bring",
  "sender": {
    "name": "Min Virksomhed ApS",
    "address1": "Strandvejen 6",
    "zipcode": "5240",
    "city": "Odense NØ",
    "country_code": "DK"
  },
  "receiver": {
    "name": "Lene Hansen",
    "address1": "Skibhusvej 52",
    "zipcode": "5000",
    "city": "Odense C",
    "country_code": "DK"
  },
  "loading": {
    "date": "2019-01-30T14:54:29+01:00"
  }
  "packages": [
    {
      "product_code": "BRI_PPB",
      "package_type": "PARCEL",
      "amount": 3,
      "weight": 1000
    }
  ]
}

As mentioned in the earlier section, you must open a waybill before booking shipments when using PostNord Denmark. When opening a waybill only the addresses are required, since you are not aware of how many shipments is covered by the waybill:

{
"carrier_code": "pdk",
"status": "open",
"sender": {
"name": "Min Virksomhed ApS",
"address1": "Strandvejen 6",
"zipcode": "5240",
"city": "Odense NØ",
"country_code": "DK"
},
"receiver": {
"name": "Lene Hansen",
"address1": "Skibhusvej 52",
"zipcode": "5000",
"city": "Odense C",
"country_code": "DK"
}
}

After booking all bulk shipments you are then able to close the waybill with the packages array that was omitted in the original request:

{
"packages": [
{
"product_code": "PDK_M",
"package_type": "PARCEL",
"amount": 3,
"weight": 1000
}
]
}

The packages array

The packages array, as seen in the example earlier, contains the data of the pallets which are covered by the waybill. This is also the information required to generate routing labels.

"packages": [
  {
    "product_code": "BRI_PPB",
    "package_type": "PARCEL",
    "amount": 3,
    "weight": 1000
  }
]

Each object in the array contains product_code, package_type, amount and weight.

Product code
Product code is the code of the product which the package/pallet contains.
The available product codes are:

Using Bring there are 2 products available:

  • BRI_PPB - Pickup Parcel Bulk

  • BRI_BPB - Business Parcel Bulk

  • BRI_HDP - Home Delivery Parcel

Using PostNord Denmark 4 products are available:

  • PDK_M - Covers both MyPack Home and MyPack Collect

  • PDK_BP - PostNord Parcel

  • PDK_TB - Tracked Samsending

  • PDK_PL - PostNord Pallet

Should one of these give you an "invalid product code" error, your account may not have access to these products. If so, please contact customer service.

Package type
Package type is whether the pallet is a pallet of many parcel goods or the good is the whole pallet.
The available package types are:

  • PALLET - Pallet

  • PARCEL - Pallet containing parcels

Amount
Amount differs depending on the given package type.

If the package type is pallet, amount is the amount of pallets and this will generate the amount of routing labels. This means, if you have multiple pallet, of the same product and weight, you don't need multiple package objects.

If package type is parcel, amount is the amount of parcel on one pallet and this will generate one routing label. This means, if you want multiple pallet of parcels, you must give multiple package object.

Weight
Weight is the weight in grams of each pallet. So if the package type is parcel, the weight is of the whole pallet, and if it is pallet it's the weight of each pallet.

Response

If a valid request body is posted the following response will be returned:

{
  "id": 23,
  "reference": "CS000000000NO",
"status": "closed",
  "carrier_code": "bring",
"customer_number": "123456789",
  "created_at": "2018-06-16T08:25:44.557+02:00",
  "sender": {
    "name": "Min Virksomhed ApS",
    "address1": "Strandvejen 6",
    "address2": null,
    "zipcode": "5240",
    "city": "Odense NØ",
    "country_code": "DK"
  },
  "receiver": {
    "name": "Lene Hansen",
    "address1": "Skibhusvej 52",
    "address2": null,
    "zipcode": "5000",
    "city": "Odense C",
    "country_code": "DK"
  },
  "loading": {
    "name": "Lene Hansen",
    "address1": "Skibhusvej 52",
    "address2": null,
    "zipcode": "5000",
    "city": "Odense C",
    "country_code": "DK",
    "date": "2019-01-30T14:54:29+01:00"
  },
  "delivery": {
    "name": "Min Virksomhed ApS",
    "address1": "Strandvejen 6",
    "address2": null,
    "zipcode": "5240",
    "city": "Odense NØ",
    "country_code": "DK"
  },
  "shipment": {
    "id": 123456,
    "label_base64": "..."
  },
"invoice_base64": "..."
  "base64": "..."
}

Sender, receiver, loading and delivery will be the same as you have given. Reference is the reference which will appear on the waybill.

Waybill

The response object will contain base64 which is a PDF, as a Base64 encoded string. If the waybill is not closed, base64 will be set as null.

Routing labels

The shipment object the given packages which have been made into a shipment. It contains label_base64 which is a PDF of all the routing labels, as a Base64 encoded string. If the waybill is not closed, the shipment object will be set as null.

Consolidated invoice

The response object will contain invoice_base64 which is a PDF, as a Base64 encoded string. If the waybill is not closed, invoice_base64 will be set as null.

Did this answer your question?