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
- In the dashboard, under the “API” section, “Webhooks” tab: specify the URL and events.
- URL must be
https://and publicly accessible only (internal addresses andlocalhostare prohibited). No more than 10 webhooks per account. - The secret
whsec_…is shown once upon creation, save it (e.g., in an environment variable). - The test button sends a
pingtest event: this lets you verify that the URL and signature work.
Вебхуками можно управлять и по API: создавать, менять, удалять, проверять подпись тестовым событием, менять секрет и смотреть журнал доставок. Нужны права webhooks:read и webhooks:write.
POST /webhooks → · Трекинг: события по вебхуку →
Events
| Event | Description |
|---|---|
shipment.created | Order created. |
shipment.status_changed | Order status changed. |
shipment.delivered | Order delivered. |
shipment.cancelled | Order cancelled. |
extra_charge.created | Additional payment appeared for the order. |
balance.topup | Balance topped up. |
shipment.tracking_updated | Появились новые контрольные точки перевозчика (статус, описание, место, время). |
ping | Test 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).
{
"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:
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| Name | Description |
|---|---|
X-Shipto-Event | Event type, duplicates type. |
X-Shipto-Delivery | Delivery 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.
| Event | Description |
|---|---|
shipment.created | Order 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_changed | The 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.delivered | The same order, status equals delivered, delivered_at is filled. Sent once, in addition to shipment.status_changed. |
shipment.cancelled | The same order, status equals cancelled, cancelled_at is filled. Sent once, in addition to shipment.status_changed. |
extra_charge.created | Additional 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.topup | Top-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). Повторные точки событий не создают, подробности в разделе «Трекинг». |
{
"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"
}
}{
"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"
}
}{
"id": "evt_9f1c2a7b3d4e5f60",
"type": "balance.topup",
"created_at": "2026-12-11T14:02:12+00:00",
"data": {
"amount_cents": 10000,
"currency": "USD",
"balance_cents": 12500
}
}{
"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.
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);import hashlib
import hmac
import os
import time
from flask import Flask, abort, request
app = Flask(__name__)
@app.post("/hook")
def hook():
body = request.get_data() # raw bytes, verify before parsing JSON
header = request.headers.get("X-Shipto-Signature", "")
parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
timestamp, signature = parts.get("t", ""), parts.get("v1", "")
secret = os.environ["SHIPPICKUP_WEBHOOK_SECRET"].encode()
expected = hmac.new(secret, timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
if not timestamp or not hmac.compare_digest(expected, signature) or abs(time.time() - int(timestamp)) > 300:
abort(400)
event = request.get_json()
# Deduplicate by event["id"], then handle event["type"] and event["data"].
return "", 200import crypto from "node:crypto";
import express from "express";
const app = express();
// express.raw keeps the exact bytes of the body: verify before parsing JSON.
app.post("/hook", express.raw({ type: "application/json" }), (req, res) => {
const header = String(req.get("X-Shipto-Signature") || "");
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const body = req.body.toString("utf8");
const expected = crypto
.createHmac("sha256", process.env.SHIPPICKUP_WEBHOOK_SECRET)
.update(`${parts.t}.${body}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300;
const same =
typeof parts.v1 === "string" &&
parts.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
if (!fresh || !same) return res.status(400).send("invalid signature");
const event = JSON.parse(body);
// Deduplicate by event.id, then handle event.type and event.data.
res.sendStatus(200);
});These checks are already in ready-made clients: verifyWebhook (PHP, Node.js) and verify_webhook (Python).
Response and redelivery
- Respond with a 2xx status within 5 seconds. Anything else, including timeout, is considered a failure.
- On failure, we retry sending: up to 5 attempts total with increasing pauses (1, 4, 9, and 16 minutes). After the fifth failed attempt, delivery is marked as "undelivered."
- The dashboard shows a delivery log with your server’s response code; any delivery can be resent manually.
- Retries and manual sends come with the same event
id: store processedids and do not perform the action twice. - Redirects (3xx) are not followed and considered failures: specify the final address without redirects.
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.