iBOX API

Building reliably

Webhooks

We send a signed HTTPS request to your server as each parcel moves, so you do not have to ask.

Adding an endpoint

In the merchant portal, open Settings → Webhooks and add an HTTPS URL that is reachable from the internet. You get a signing secret, beginning whsec_, once: store it with your API key. Every enabled endpoint receives every event.

What we send

http
POST /your/endpoint HTTP/1.1
Content-Type: application/json
User-Agent: iBox-Webhooks/1.0
X-iBox-Event: shipment.ready_for_pickup
X-iBox-Delivery: 5d2c0b8e-…
X-iBox-Timestamp: 1794470400
X-iBox-Signature: 6f1a…

{
  "id": "9b3e…",
  "event": "shipment.ready_for_pickup",
  "occurred_at": "2026-11-13T10:02:11.000Z",
  "data": {
    "tracking_number": "IBX2513276175",
    "from_status": "deposited_in_locker",
    "to_status": "ready_for_pickup"
  }
}

A shipment event's data names the parcel by tracking_number and the step it took, from_status to to_status, in the detailed statuses GET /v1/shipments/{id} returns.

EventWhen
shipment.bookedThe parcel is booked.
shipment.label_createdIts label was printed for the first time.
shipment.handover_receivedAn iBOX courier has it.
shipment.arrived_at_stationIt reached the locker's area.
shipment.depositedIt is in the locker.
shipment.ready_for_pickupThe customer has been sent their pickup code.
shipment.picked_upThe customer collected it.
shipment.pickup_expiredIt was not collected in time and is coming back.
return.requestedA return was started.
return.depositedThe return is in a locker.
return.collectedAn iBOX courier collected the return.
shipment.returned_to_merchantIt is back with you.

Verifying the signature

X-iBox-Signature is the hex HMAC-SHA256 of the timestamp, a dot, and the raw request body, keyed with your signing secret. Check it before trusting anything in the request, compare in constant time, and refuse timestamps more than five minutes old so a captured request cannot be replayed.

javascript
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyIboxWebhook(rawBody, headers, secret) {
  const timestamp = headers["x-ibox-timestamp"];
  const signature = headers["x-ibox-signature"] ?? "";
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;

  const expected = createHmac("sha256", secret)
    .update(`${timestamp}.${rawBody}`)
    .digest("hex");
  const a = Buffer.from(signature, "hex");
  const b = Buffer.from(expected, "hex");
  return a.length === b.length && timingSafeEqual(a, b);
}

Use the raw body

Sign-check the bytes you received, before parsing. Re-serialising parsed JSON changes spacing and key order, and the signature will not match.

Responding, and retries

  • Answer with any 2xx within 10 seconds. Do the work afterwards, not before answering.
  • Anything else is retried up to five attempts in all: 5 minutes, 30 minutes, 2 hours and 6 hours after the previous one. After that the delivery is marked failed.
  • A delivery can arrive more than once. Use X-iBox-Delivery (or the payload id) to ignore one you have already handled.
  • Events can arrive out of order. If order matters, compare occurred_at, or fetch the parcel's current state from the API.