Webhooks

Webhooks notify your server about events themselves: just accept a POST request. Each request is signed with a webhook secret, and the signature must be verified.

Setup

Вебхуками можно управлять и по API: создавать, менять, удалять, проверять подпись тестовым событием, менять секрет и смотреть журнал доставок. Нужны права webhooks:read и webhooks:write.

POST /webhooks → · Трекинг: события по вебхуку →

Events

EventDescription
shipment.createdOrder created.
shipment.status_changedOrder status changed.
shipment.deliveredOrder delivered.
shipment.cancelledOrder cancelled.
extra_charge.createdAdditional payment appeared for the order.
balance.topupBalance topped up.
shipment.tracking_updatedПоявились новые контрольные точки перевозчика (статус, описание, место, время).
pingTest event from the dashboard, always subscribed.

Request format

The request body is JSON with fields id (unique event number like evt_…), type (event type), created_at (ISO 8601 time), and data (event data).

JSON
{
    "id": "evt_9f1c2a7b3d4e5f60",
    "type": "shipment.delivered",
    "created_at": "2026-12-11T14:02:12+00:00",
    "data": {
        "id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
        "reference": "ORDER-10452",
        "status": "delivered",
        "carrier": "UPS",
        "service": "Express Saver",
        "tracking_number": "1Z999AA10123456784",
        "price_cents": 4120,
        "currency": "USD",
        "from": {
            "name": "Acme Store",
            "company": "Acme Inc",
            "line1": "350 5th Ave",
            "line2": "",
            "city": "New York",
            "state": "NY",
            "postal_code": "10001",
            "country": "US"
        },
        "to": {
            "name": "Anna Schmidt",
            "company": "",
            "line1": "Unter den Linden 1",
            "line2": "",
            "city": "Berlin",
            "state": "",
            "postal_code": "10117",
            "country": "DE"
        },
        "declared_value_cents": 5000,
        "chargeable_weight_g": 800,
        "label_available": true,
        "eta_from": "2026-12-10",
        "eta_to": "2026-12-12",
        "source": "api",
        "created_at": "2026-12-04T10:15:30+00:00",
        "delivered_at": "2026-12-11T14:02:10+00:00",
        "cancelled_at": null
    }
}

The contents of data depend on the event and are described below. Ignore unknown fields: new fields may appear. Request headers:

HTTP
POST /your/hook HTTP/1.1
Content-Type: application/json
User-Agent: shipto-webhooks/1
X-Shipto-Event: shipment.delivered
X-Shipto-Delivery: 1842
X-Shipto-Signature: t=1796379330,v1=5b1c0d...e9a2
NameDescription
X-Shipto-EventEvent type, duplicates type.
X-Shipto-DeliveryDelivery number. The same for repeated sends.
X-Shipto-SignatureПодпись: t=<время unix>,v1=<подпись>.

Data composition

Events are sent within a minute after a change. data contains only what you already see in the API and dashboard: no carrier service data or internal calculations in events. Amounts are in cents.

EventDescription
shipment.createdOrder with the same fields as in the GET /shipments/{id} response (except pickup): id, status, carrier, service, tracking_number, price_cents, currency, addresses, label_available, dates. Sent after label purchase.
shipment.status_changedThe same order plus the previous_status field (status before the change). Sent on every actual status change: label ready, in transit, delivered, cancelled. Repeating the same status does not create an event.
shipment.deliveredThe same order, status equals delivered, delivered_at is filled. Sent once, in addition to shipment.status_changed.
shipment.cancelledThe same order, status equals cancelled, cancelled_at is filled. Sent once, in addition to shipment.status_changed.
extra_charge.createdAdditional payment: id, shipment_id (order number as in API), amount_cents (amount to be paid from balance, as in the “Additional payments” section), currency, reason, status.
balance.topupTop-up: amount_cents, currency, balance_cents (balance immediately after top-up).
shipment.tracking_updatedТрекинг: shipment_id, tracking_number, reference, status (статус заказа после точек) и checkpoints (только новые точки: status, description, location, time). Повторные точки событий не создают, подробности в разделе «Трекинг».
shipment.status_changed
{
    "id": "evt_9f1c2a7b3d4e5f60",
    "type": "shipment.status_changed",
    "created_at": "2026-12-11T14:02:12+00:00",
    "data": {
        "id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
        "reference": "ORDER-10452",
        "status": "in_transit",
        "carrier": "UPS",
        "service": "Express Saver",
        "tracking_number": "1Z999AA10123456784",
        "price_cents": 4120,
        "currency": "USD",
        "from": {
            "name": "Acme Store",
            "company": "Acme Inc",
            "line1": "350 5th Ave",
            "line2": "",
            "city": "New York",
            "state": "NY",
            "postal_code": "10001",
            "country": "US"
        },
        "to": {
            "name": "Anna Schmidt",
            "company": "",
            "line1": "Unter den Linden 1",
            "line2": "",
            "city": "Berlin",
            "state": "",
            "postal_code": "10117",
            "country": "DE"
        },
        "declared_value_cents": 5000,
        "chargeable_weight_g": 800,
        "label_available": true,
        "eta_from": "2026-12-10",
        "eta_to": "2026-12-12",
        "source": "api",
        "created_at": "2026-12-04T10:15:30+00:00",
        "delivered_at": null,
        "cancelled_at": null,
        "previous_status": "label_ready"
    }
}
extra_charge.created
{
    "id": "evt_9f1c2a7b3d4e5f60",
    "type": "extra_charge.created",
    "created_at": "2026-12-11T14:02:12+00:00",
    "data": {
        "id": 118,
        "shipment_id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
        "amount_cents": 525,
        "currency": "USD",
        "reason": "Weight difference",
        "status": "new"
    }
}
balance.topup
{
    "id": "evt_9f1c2a7b3d4e5f60",
    "type": "balance.topup",
    "created_at": "2026-12-11T14:02:12+00:00",
    "data": {
        "amount_cents": 10000,
        "currency": "USD",
        "balance_cents": 12500
    }
}
shipment.tracking_updated
{
    "id": "evt_9f1c2a7b3d4e5f60",
    "type": "shipment.tracking_updated",
    "created_at": "2026-12-11T14:02:12+00:00",
    "data": {
        "shipment_id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
        "tracking_number": "1Z999AA10123456784",
        "reference": "ORDER-10452",
        "status": "in_transit",
        "checkpoints": [
            {
                "status": "in_transit",
                "description": "Departed from facility",
                "location": "Newark, NJ, US",
                "time": "2026-12-05T08:30:00+00:00"
            }
        ]
    }
}

Signature verification

The signature is an HMAC-SHA256 of the string “time.period.request body” using the webhook secret, in hexadecimal. Use the body exactly as received (before JSON parsing). Compare signatures with a timing-attack resistant function and reject requests older than 5 minutes.

HMAC
v1 = hex( HMAC_SHA256( secret, t + "." + raw_body ) )
<?php
// Read the raw body: verify the signature BEFORE decoding JSON.
$body = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_SHIPTO_SIGNATURE'] ?? '';
$secret = getenv('SHIPPICKUP_WEBHOOK_SECRET');           // whsec_..., shown once when the webhook is created

parse_str(str_replace(',', '&', $header), $parts);        // t=<unix time>,v1=<signature>
$timestamp = (string) ($parts['t'] ?? '');
$signature = (string) ($parts['v1'] ?? '');
$expected = hash_hmac('sha256', $timestamp . '.' . $body, (string) $secret);

if ($timestamp === '' || !hash_equals($expected, $signature) || abs(time() - (int) $timestamp) > 300) {
    http_response_code(400);
    exit('invalid signature');
}

$event = json_decode($body, true);
// Deduplicate by $event['id'], then handle $event['type'] and $event['data'].
http_response_code(200);

These checks are already in ready-made clients: verifyWebhook (PHP, Node.js) and verify_webhook (Python).

Response and redelivery

Webhook does not replace reconciliation

Notification may arrive late or not at all if your server was unavailable. Keep order status locally and if in doubt, request the current status via GET /shipments/{id}/tracking.