This documentation is in beta, and might contain errors. Contact us at integration@instabee.com with any questions.

Instabee API

Resolve sortCode

In the Locker Light flow, the sortCode returned by the Availability API is temporary. It carries checkout context about the selected locker, but it cannot be used on shipping labels. The final label (with the correct sort code) is only available after the Post Packing step.

Overview

Due to technical limitations, it is not possible to return a permanent sort code in the order creation response. Instead, the flow works like this:

  1. Checkout – The Availability API returns a temporary sortCode per delivery option
  2. Post Purchase – The temporary sortCode is sent untouched when creating the order
  3. Post Packing – Confirming packing returns the label URL and a labelCode

Step-by-Step Flow

Step 1: Checkout — Availability API returns a temporary sortCode

When you call the Availability API with product: "LOCKER_AREA", each delivery option in the response includes a temporary sortCode:

1{
2  "availabilityToken": "019d8c17-7f32-74bf-8257-bde6184c63db",
3  "deliveryOptions": [
4    {
5      "sortCode": "XA000w0VHcO",
6      "type": "LOCKER",
7      "brand": "Instabox",
8      "deliveryOption": "Central Station Stockholm",
9      "deliveryOptionWithEta": "Central Station Stockholm (today ~16:10)",
10      "eta": {
11        "certainty": "INTERVAL",
12        "etaInterval": {
13          "from": "2025-07-05T14:10:00.000Z",
14          "to": "2025-07-06T15:10:00.000Z"
15        },
16        "localEta": {
17          "date": "2025-05-13 - 2025-05-14",
18          "dayText": "1-2 Dagar"
19        }
20      },
21      "packBeforeDatetime": "2025-06-28T19:30:00.000Z",
22      "consolidation": false
23    }
24  ],
25  "preselection": "RECOMMENDED",
26  "responseExpiresAt": "2026-04-14T14:04:03.378Z",
27  "showAsOptionInCheckout": true
28}

Important: The sortCode (e.g. XA000w0VHcO) is a temporary sort code. It is not allowed to be used on labels. It must be sent exactly as received — do not truncate or modify it.

Step 2: Post Purchase — Send the temporary sortCode in the order

Pass the temporary sortCode in deliveryOption.sortCode when creating the order. Set parcelPackingConfirmed to false:

1{
2  "parcelPackingConfirmed": false,
3  "availabilityToken": "b4a9c200-c02a-4186-b3e8-6271a0be2190",
4  "brand": "instabox",
5  "product": "LOCKER_EXPRESS",
6  "parcelId": "PREFIX1234567890",
7  "recipient": {
8    "name": "Test Testsson",
9    "email": "test@instabee.com",
10    "phone": "0701234567",
11    "street": "Hälsingegatan 40",
12    "street2": "Floor 10",
13    "city": "Stockholm",
14    "countryCode": "SE"
15  },
16  "deliveryOption": {
17    "sortCode": "XA000w0VHcO"
18  },
19  "cart": {
20    "checkoutId": "XBO12-2923048",
21    "orderNumber": "12345"
22  }
23}

Response:

1{
2  "orderId": "019aba69-96d9-73b2-9e85-255206a693a0",
3  "parcelId": "PREFIX1234567890",
4  "links": {
5    "tracking": "https://track.instabox.io/XX01000000123456"
6  },
7  "state": "PENDING_PACKING"
8}

At this stage the order is reserved. The tracking link is available but no label is returned yet.

Step 3: Post Packing — Confirm packing to resolve the sortCode

Once the parcel is physically packed, confirm packing with parcelPackingConfirmed: true. Pass the availabilityToken and the same temporary sortCode:

1{
2  "availabilityToken": "b4a9c200-c02a-4186-b3e8-6271a0be2190",
3  "sortCode": "XA000w0VHcO",
4  "parcelPackingConfirmed": true
5}

Response:

1{
2  "orderId": "019aba69-96d9-73b2-9e85-255206a693a0",
3  "parcelId": "PREFIX1234567890",
4  "links": {
5    "label": "https://one-api-gateway.partners.production.psc.internal.ibx.dev/presigned/labels?token=eyJhbGciOiJIUzI1NiJ9...",
6    "tracking": "https://track.instabox.io/XX01000000123456"
7  },
8  "attributes": {
9    "labelCode": "IN30"
10  },
11  "state": "FINALIZED"
12}

The links.label URL contains the shipping label with the correct sort code printed on it. The attributes.labelCode field contains the resolved label code.

Key Points

Description
Temporary sortCodeReturned by the Availability API. Carries checkout context.
Cannot be used on labelsThe temporary sortCode must never be printed on a shipping label.
Must be sent untouchedPass the entire sortCode value as-is to the Create Order API.
Label resolved at Post PackingThe actual label (with correct sort code) is returned in the Post Packing response.
attributes.labelCodeThe resolved label code, returned in the Post Packing response.
  • Check Availability – Call the Availability API with LOCKER_AREA to get the temporary sortCode
  • Post Purchase – Create the order with the temporary sortCode
  • Post Packing – Confirm packing and receive the label

Command Palette

Search for a command to run...