Book a parcel

Book a shipment with one request, and get back the IDs you need to print a label and track the parcel.

The basics

Every booking answers four questions:

Question Field
Who is booking? shopId: your shop. Use 16 in pre-prod.
How should it travel? transportSolutionId: a transport solution, which is a list of delivery methods in order of preference. See Delivery methods.
From whom, to whom? parties: the sender (consignor), the receiver (consignee) and, optionally, a service point.
What's being sent? items: one entry for each parcel.

Send the booking to POST /parcels/v1/bookings. The same endpoint handles every kind of shipment: shop to consumer (B2C), consumer to consumer (C2C) and returns (C2B). Only the parties and the transport solution change.

Make your first booking

This is the smallest booking that works: a shop sending one parcel to a consumer's home.

curl -X POST "https://api.pre.helthjem.no/parcels/v1/bookings" \
  -H "Authorization: Bearer your_token" \
  -H "Content-Type: application/json" \
  -H "idempotency-key: 9b2e4c71-5d3a-4f8e-b6a1-2c7d9e0f1a34" \
  -d '{
    "shopId": 16,
    "transportSolutionId": 1,
    "parties": [
      {
        "type": "consignee",
        "name": "Ola Nordmann",
        "countryCode": "NO",
        "postalName": "Oslo",
        "zipCode": "0468",
        "address": "Kongsberggata 18",
        "phone1": "12345678",
        "email": "test@example.com"
      },
      {
        "type": "consignor",
        "name": "Test shop",
        "countryCode": "NO",
        "postalName": "Oslo",
        "zipCode": "0480",
        "address": "Sandakerveien 121",
        "phone1": "12345678"
      }
    ],
    "items": [
      {
        "itemNumber": 1,
        "weight": 1000,
        "length": 12,
        "width": 12,
        "height": 12,
        "contents": "Shoes"
      }
    ]
  }'

Replace your_token with your access token. See Authentication.

The response tells you what Helthjem booked:

{
    "orderId": 89828037,
    "shipmentId": "(401)70724762337121945",
    "freightProductId": 1,
    "items": [
        {
            "itemNumber": 1,
            "trackingReference": "(00)370724762337121953",
            "properties": {
                "shortItemIdentifier": "...1953"
            }
        }
    ],
    "additionalServices": []
}

This response is trimmed to the fields you need next.

Read the response

Three fields matter after a booking:

Field What it tells you What to do with it
freightProductId Which delivery method Helthjem chose. With TS 1, 1 means home delivery. If home delivery isn't possible, it falls back to 95 (parcel locker), 55 (Helthjem service point) or 3 (PostNord service point). Show the customer how their parcel is coming.
shipmentId The ID of the whole shipment. Store it. Use it, without (401), to get the label or cancel the booking.
items[].trackingReference The ID of each parcel. Store it. Use it, without (00), to track the parcel.

See Identifiers for every ID in the response.

Never book twice

The idempotency-key header in the example makes the booking safe to retry. A booking creates a real shipment, so a retry after a timeout could otherwise create a second one.

  • Create one key for each shipment, and store it with your order before you send the request.
  • If the request times out or returns a 5xx error, send it again with the same key. You get the original booking back, not a duplicate.
  • If you change the request, for example to fix a validation error, use a new key.

See Idempotency & retries.

Fill in the parties

Each party has a type, and each type needs different fields:

type Who Required fields
consignee The receiver name, address, zipCode, postalName, countryCode, phone1, email
consignor The sender name, address, zipCode, postalName, countryCode, phone1
servicePoint A service point or parcel locker (optional) id, countryCode

The receiver's phone1 and email aren't just required fields. Helthjem uses them to send the receiver delivery notifications. Add a reference (max 35 characters) to any party to store your own customer or order number.

Write the whole street address in address, including the entrance and apartment number, for example Kongsberggata 18 H0201. Send zipCode as a string, so 0468 keeps its leading zero.

Deliver to a service point

To send the parcel to a service point the consumer picked, add that service point as a third party. Get its ID from Find nearby PUDO locations, and book with a service point solution such as transportSolutionId: 62.

{
    "type": "servicePoint",
    "id": "30694",
    "countryCode": "NO"
}

The response then shows "freightProductId": 55 and includes the service point's name and address in parties, so you can show them in the order confirmation:

{
    "type": "servicePoint",
    "id": "30694",
    "name": "Joker Toftes Gate",
    "countryCode": "NO",
    "postalName": "OSLO",
    "zipCode": "0556",
    "address": "TOFTES GATE 12"
}

Describe the parcels

Field Required Description
itemNumber Yes The parcel's number in the shipment, starting at 1.
weight No Weight in grams.
length, width, height No Dimensions in centimetres.
contents No A short description (max 100 characters).
contentValue No The value of the contents.

Weight and size decide which delivery methods are possible. A parcel over 5 kg can't go home delivery or to a parcel locker, so a fallback solution moves it on to a service point. See the limits in Delivery methods.

Other options

Field Use it to
shipmentId Use your own ID, for example your order number. Each value can be used only once. Leave it out to let Helthjem assign one.
desiredDeliveryDate Set a delivery or pickup date, as a string in YYYYMMDD format. Required for home pickup in C2C and returns.
messageToCarrier Leave a note for the courier.
messageToConsignee Leave a note for the receiver.
additionalServices Add extra services, as key and value pairs.

Fulfilment orders

If Helthjem picks and packs your goods from its warehouse, book a fulfilment order. Add two things to a normal booking:

{
    "additionalServices": [
        {
            "key": "ASB",
            "value": "HHWMS"
        }
    ],
    "items": [
        {
            "itemNumber": 1,
            "weight": 1000,
            "contents": "Shoes",
            "articles": [
                {
                    "articleNumber": "100200300",
                    "articleName": "Testitem",
                    "quantity": 1
                }
            ]
        }
    ]
}

The order reaches the warehouse system within 5 minutes of the booking.

C2C and returns

The request is the same. What changes is who the parties are.

Shipment consignor (sender) consignee (receiver) Label
C2C A consumer Another consumer None. The sender writes the returnCode from the response on the parcel.
Return Your customer Your shop A label or a returnCode, depending on the transport solution.

For home pickup, send the pickup date as desiredDeliveryDate. All return addresses must be in Norway.

The C2C integration and Returns integration guides walk through both flows from start to finish.

When the booking fails

errorKey What happened What to do
no.carrier.support Helthjem can't deliver to this address with this transport solution. Offer another delivery option. Don't retry the same request.
no.carrier.support.package.too.heavy / .too.big / .too.expensive The parcel is over a limit for every delivery method in the solution. Check the parcel against the limits, or use a solution with more fallbacks.
shipment.id.already.exists You've already used this shipmentId. The shipment probably exists already. Don't book it again.
invalid.format.desiredDeliveryDate The date isn't in YYYYMMDD format. Remove the dashes, for example 20261014.
over.max.length.of.idempotency.key The idempotency-key is over 40 characters. Use a shorter key, such as a UUID.

See Errors for every error key, and Test scenarios to trigger them in pre-prod.

Next steps

Last updated