Webhooks

OpenSeal tells your system when something happens to an envelope by POSTing a small, signed JSON event to an HTTPS endpoint you register. Events carry ids and statuses only; your system fetches the details it needs with its own credentials.

Subscribe

A subscription names the URL, the event types (or * for all), and references to one to four secrets. Secrets are provisioned by the operator, as an environment variable or a file the worker can read, so they never travel through the API. A secret is whsec_ followed by base64 of at least 16 random bytes. Optionally, limit the subscription to one envelope.

curl https://sign.example.com/api/v1/webhooks \
  -H "Authorization: Bearer $OPENSEAL_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: crm-webhook-1" \
  -d '{
    "url": "https://crm.example.com/hooks/openseal",
    "event_types": ["envelope.completed", "envelope.declined", "recipient.completed"],
    "secret_refs": ["OPENSEAL_WEBHOOK_SECRET_CRM"]
  }'

Needs the webhooks:manage scope. GET /api/v1/webhooks/{id}/deliveries lists every attempt with its outcome.

Event types

Events mirror the audit trail's types that matter to integrators:

  • Envelope: envelope.sent, envelope.delivered, envelope.completing (sealing has started), envelope.completed, envelope.declined, envelope.voided, envelope.expired, envelope.corrected, envelope.purged
  • Recipient: recipient.sent, recipient.delivered, recipient.auth_failed, recipient.completed, recipient.declined, recipient.reassigned, recipient.bounced

Designed but not emitted yet: recipient.finish_later, template.* and bulk_send.completed.

Payload

{
  "id": "0193a1b2-…",
  "type": "envelope.completed",
  "created_at": "2026-11-12T09:14:03Z",
  "account_id": "0193a1b2-…",
  "data": {
    "envelope_id": "0193a1b2-…",
    "status": "completed",
    "version": 7,
    "recipient_id": "0193a1b2-…"
  }
}

No names, email addresses, subjects, field values or documents are sent, so a misconfigured endpoint leaks nothing about the agreement. recipient_id appears on recipient events. Every attempt of one event sends the same bytes.

Verify the signature

Deliveries follow the Standard Webhooks scheme. Three headers come with each request:

  • webhook-id: the event delivery's id, the same on every retry; use it to ignore duplicates.
  • webhook-timestamp: the attempt's Unix time; reject anything more than five minutes old.
  • webhook-signature: v1, and the base64 HMAC-SHA256 of id.timestamp.body, once per active secret, separated by spaces (so secrets can be rotated).
import base64, hashlib, hmac, time

def verify(secret: str, headers: dict, body: bytes) -> bool:
    key = base64.b64decode(secret.removeprefix("whsec_"))
    msg_id, ts = headers["webhook-id"], headers["webhook-timestamp"]
    if abs(time.time() - int(ts)) > 300:
        return False
    signed = f"{msg_id}.{ts}.".encode() + body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    return any(
        hmac.compare_digest(expected, part.split(",", 1)[1])
        for part in headers["webhook-signature"].split()
        if part.startswith("v1,")
    )

Compute the HMAC over the raw request body exactly as received, before any JSON parsing.

Delivery and retries

  • Any 2xx answer within 10 seconds counts as delivered. Redirects are not followed.
  • Otherwise the worker retries with exponential back-off (from 30 seconds, doubling, capped at 12 hours, with jitter) for 15 attempts, about three days.
  • Delivery is at least once: the same event may arrive twice with the same webhook-id. Order is not guaranteed; compare version to discard stale events.

Where webhooks may go

Only https:// URLs to public addresses. Private, loopback, link-local (including cloud metadata), carrier-grade NAT, reserved and multicast addresses are refused, both when the address is resolved and again when the connection is made, so DNS rebinding cannot reach your internal network. An operator can allow a private range with OPENSEAL_WEBHOOK_ALLOW.

Built: editing, pausing and resuming a subscription, a test delivery, and manual redelivery, from the API and from Admin. Planned: disabling a subscription that has failed for five days, filters by sender or template, and optional mutual TLS to receivers.