/v1/webhook-subscriptionswebhooks:readListar suscripciones.
Operar · Webhooks
Cada suscripción pertenece a tu cliente y ambiente. La entrega es al menos una vez: debes verificar la firma y procesar cada identificador de evento de forma idempotente.
/v1/webhook-subscriptionswebhooks:readListar suscripciones.
/v1/webhook-subscriptionswebhooks:writeCrear y recibir el secreto.
/v1/webhook-subscriptions/{id}webhooks:writeModificar, pausar o rotar.
/v1/webhook-subscriptions/deliverieswebhooks:readConsultar entregas.
/v1/webhook-subscriptions/deliveries/{id}/retrywebhooks:writeReencolar una entrega.
El destino debe ser HTTPS público. Se rechazan URLs con credenciales, fragmentos, localhost o direcciones privadas. Cada cliente puede mantener hasta 20 suscripciones activas. Antes de cada entrega, el worker vuelve a resolver el destino y no sigue redirecciones.
curl --request POST \
--url "$API_BASE_URL/v1/webhook-subscriptions" \
--header "Authorization: Bearer $SENDINGBAY_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"url": "https://hooks.example.com/sendingbay",
"event_types": ["shipment.created", "shipment.modified", "shipment.incident_reported", "shipment.reverse_logistics_created", "tracking.updated"]
}'HTTP/1.1 201 Created
Cache-Control: no-store
Pragma: no-cache
{
"id": "3c5a3217-eb59-477c-a037-c2717ed41721",
"url": "https://hooks.example.com/sendingbay",
"event_types": ["shipment.created", "shipment.modified", "shipment.incident_reported", "shipment.reverse_logistics_created", "tracking.updated"],
"active": true,
"version": 1,
"created_at": "2026-09-10T12:00:00Z",
"updated_at": "2026-09-10T12:00:00Z",
"signing_secret": "<guardar-inmediatamente>"
}shipment.acceptedUna operación asíncrona fue aceptada.
shipment.createdEl envío quedó creado con referencia del transportista.
shipment.modifiedUna modificación canónica quedó aplicada y auditada.
shipment.reverse_logistics_createdLa recogida o devolución quedó confirmada; no incluye direcciones ni etiqueta.
shipment.incident_reportedEl transportista aceptó el reporte; no incluye la descripción.
tracking.updatedSe añadió un evento de seguimiento nuevo y deduplicado.
{
"id": "2eb8c30d-1981-41a2-b493-8d92e1bd8d8b",
"type": "tracking.updated",
"created_at": "2026-09-10T12:00:00Z",
"data": {
"shipment_id": "274a2a5d-fef4-4fc6-9057-39d8df258367",
"status": "in_transit",
"effective_at": "2026-09-10T11:58:00Z"
}
}El campo id se mantiene durante todos los reintentos. Registra los identificadores procesados y devuelve 2xxtambién cuando recibas un duplicado ya tratado correctamente.
Cada petición incluye Webhook-Id,Webhook-Timestamp en segundos Unix yWebhook-Signature con formato v1=<hex>. Firma el valor timestamp + "." + cuerpo HTTP exacto con HMAC-SHA256 y compara en tiempo constante.
import hashlib
import hmac
expected = hmac.new(
secret.encode(),
timestamp.encode() + b"." + raw_body,
hashlib.sha256,
).hexdigest()
valid = hmac.compare_digest(
signature.removeprefix("v1="),
expected,
)Los fallos de red y respuestas no 2xx utilizan backoff exponencial. Después de corregir la causa puedes reencolar manualmente una entrega agotada. El reintento responde con 202 y una cabecera Location que identifica la entrega reencolada.
curl --request POST \
--url "$API_BASE_URL/v1/webhook-subscriptions/deliveries/965fdb91-2473-4c91-97e3-8da401280992/retry" \
--header "Authorization: Bearer $SENDINGBAY_API_TOKEN"La lista de suscripciones no vuelve a incluir el secreto. Las entregas pueden filtrarse por subscription_id y admiten unlimit entre 1 y 200, con 100 por defecto.
curl --request GET \
--url "$API_BASE_URL/v1/webhook-subscriptions" \
--header "Authorization: Bearer $SENDINGBAY_API_TOKEN"curl --request GET \
--url "$API_BASE_URL/v1/webhook-subscriptions/deliveries?subscription_id=3c5a3217-eb59-477c-a037-c2717ed41721&limit=100" \
--header "Authorization: Bearer $SENDINGBAY_API_TOKEN"Cada entrega informa status, attempts,response_status, last_error,available_at y delivered_at. Los mensajes de error están sanitizados y no contienen el cuerpo completo del destino.
Envía la versión observada como expected_version. Al rotar, guarda el nuevo secreto de la respuesta. Las entregas ya creadas conservan su versión de secreto, por lo que siguen siendo verificables.
curl --request PATCH \
--url "$API_BASE_URL/v1/webhook-subscriptions/3c5a3217-eb59-477c-a037-c2717ed41721" \
--header "Authorization: Bearer $SENDINGBAY_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"expected_version": 1,
"rotate_secret": true
}'