Skip to content
Docs
Qubitara eSign

Webhooks

Updated Version 1ESIGN-51

A webhook is a message that eSign sends to your server when something happens. This page is for developers who want to learn about changes without polling (asking the API again and again). Changes can be to a signature request, a document, a member or a SCIM sync. The page describes the planned webhook rules.

Register an endpoint#

An endpoint is the URL on your server that receives the events. The plan is that you manage endpoints in two places: under Settings → SYSTEM → Integrations in the app, and through the API.

bash
curl -X POST "https://<org>.esign.qubitara.com/api/v1/webhooks" \
  -H "Authorization: Bearer $QUBITARA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://app.example.com/hooks/esign",
    "events": ["signature_request.sent", "document.signed", "signature_request.finalized", "signature_request.voided", "signature_request.expired"],
    "description": "Contracts service"
  }'
json
{
  "id": "wh_01J8Z7HOOK",
  "url": "https://app.example.com/hooks/esign",
  "events": ["signature_request.sent", "document.signed", "signature_request.finalized", "signature_request.voided", "signature_request.expired"],
  "secret": "whsec_4f0c9e...b21",
  "status": "active",
  "created_at": "2026-09-28T09:00:00Z"
}

The planned endpoints are POST /webhooks, GET /webhooks, GET /webhooks/{id}, PATCH /webhooks/{id} and DELETE /webhooks/{id}.

  • The API shows the secret once. Save it.

  • Your endpoint must use HTTPS.

  • The plan is that "events": ["*"] subscribes to every event.

Event catalog#

Event names use the form resource.action. They match the badges and descriptions under Audit Trail and Audit Logs. Examples are "Signature Request Created", "Signature Request Sent", "Document Signed", "User Provisioned (SCIM)", "Group Synced (SCIM)" and "Member Removed".

This catalog is indicative. Every name is planned and may change. "Not decided" in the last column means the audit trail entry is not known.

Event

Fires when

Audit trail equivalent

signature_request.created

A request is created (draft), in the app or via API

Signature Request Created

signature_request.sent

A request is sent to recipients

Signature Request Sent

signature_request.reminded

A reminder (manual or auto) is emailed

Not decided

document.viewed

A recipient opens the document

Not decided

document.signed

One recipient completes their fields

Document Signed

document.declined

A recipient declines (only if declining is part of the release)

Not decided

signature_request.finalized

All signers have signed; completed PDF available

Not decided

signature_request.voided

The sender voids the request

Revoked (badge observed; its trigger was not)

signature_request.expired

The signing deadline passes

Not decided

template.created

A template is created

Not decided

template.used

A request is created from a template

Not decided

member.invited

An organization member is invited

Not decided

member.joined

An invited member accepts

Not decided

member.role_changed

A member's role changes (manual or via group role mapping)

Not decided

member.removed

A member is removed

Member Removed

scim.user_provisioned

A user is created by SCIM

User Provisioned (SCIM)

scim.user_updated

A SCIM user is updated

Not decided

scim.user_deprovisioned

A SCIM user is deactivated or deleted

Deleted badge or Member Removed (not decided which)

scim.group_synced

A group is created or its membership changes

Group Synced (SCIM)

aadhaar_esign.completed

An Aadhaar eSign transaction completes

Not decided

aadhaar_esign.failed

An Aadhaar eSign transaction fails

Not decided

webhook.test

You click Send test event

none

Payload#

The plan is that every delivery is an HTTP POST with Content-Type: application/json. The body holds one event object.

json
{
  "id": "evt_01J8Z8EVENT",
  "type": "document.signed",
  "created_at": "2026-09-28T09:20:31Z",
  "organization": "qubitara",
  "api_version": "v1",
  "data": {
    "signature_request": {
      "id": "sr_01J8Z1ABCXYZ",
      "title": "Mutual NDA - Acme Co.",
      "status": "sent",
      "template_id": null,
      "recipients": [
        { "id": "rcp_01J8Z2AAA", "role": "signer", "order": 1, "name": "Asha Rao", "email": "[email protected]",
          "status": "signed", "signed_at": "2026-09-28T09:20:31Z", "signature_type": "electronic",
          "client_user_id": "user-8842" },
        { "id": "rcp_01J8Z2CCC", "role": "signer", "order": 2, "name": "Ben Ito", "email": "[email protected]",
          "status": "action_required" }
      ]
    },
    "recipient": { "id": "rcp_01J8Z2AAA", "email": "[email protected]" },
    "actor": { "type": "recipient", "id": "rcp_01J8Z2AAA", "ip": "203.0.113.10" }
  }
}

The planned headers on each delivery:

Header

Value

X-Qubitara-Event

Event type, for example document.signed

X-Qubitara-Event-Id

Same as id in the body; stable across retries

X-Qubitara-Signature

t=<unix seconds>,v1=<hex HMAC-SHA256>[,v0=<hex HMAC with previous secret>]

X-Qubitara-Delivery-Attempt

1, 2, ...

User-Agent

Qubitara-eSign-Webhooks/1.0

For member.* and scim.* events, data is planned to hold a member or user object (id, email, role, status). For scim.group_synced, it is planned to hold a group object (id, display_name, member_count, mapped_role).

Verify the signature#

The plan is that eSign signs each delivery with HMAC-SHA256. The signed text is <timestamp>.<raw body> and the key is the secret of your endpoint. The timestamp is in the header. It stops replay: an attacker cannot send an old message again.

BoldSign documents the same scheme for its webhooks (t=...,s0=... over timestamp.body, 5-minute tolerance). Qubitara eSign plans to use this pattern. Prior art: BoldSign, Validate and verify webhook events (opens in a new tab).

Follow these steps:

  1. Read the raw request body as bytes. Do not parse the JSON and write it again before you hash.

  2. Split X-Qubitara-Signature into t and v1 (and v0 if present).

  3. Reject the message if |now - t| > 300 seconds.

  4. Compute HMAC_SHA256(secret, t + "." + raw_body) as lowercase hex.

  5. Compare the result with v1. Use a constant-time comparison. During secret rotation, also accept v0 against your previous secret.

  6. Parse the JSON only after these checks pass.

Node.js (Express, raw body)#

js
import express from "express";
import crypto from "node:crypto";

const app = express();
const SECRET = process.env.QUBITARA_WEBHOOK_SECRET;        // current
const OLD_SECRET = process.env.QUBITARA_WEBHOOK_SECRET_OLD; // during rotation, optional

function verify(rawBody, header, tolerance = 300) {
  const parts = Object.fromEntries(header.split(",").map(p => p.trim().split("=")));
  const t = Number(parts.t);
  if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > tolerance) return false;

  const check = (secret, sig) => {
    if (!secret || !sig) return false;
    const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest("hex");
    const a = Buffer.from(expected, "utf8"), b = Buffer.from(sig, "utf8");
    return a.length === b.length && crypto.timingSafeEqual(a, b);
  };
  return check(SECRET, parts.v1) || check(OLD_SECRET, parts.v0);
}

app.post("/hooks/esign", express.raw({ type: "application/json" }), async (req, res) => {
  if (!verify(req.body, req.get("X-Qubitara-Signature") ?? "")) return res.status(400).send("bad signature");

  const event = JSON.parse(req.body.toString("utf8"));
  if (await alreadyProcessed(event.id)) return res.sendStatus(200);   // idempotency

  await enqueue(event);            // do the real work asynchronously
  await markProcessed(event.id);
  res.sendStatus(200);             // respond fast
});

Python (Flask)#

python
import hmac, hashlib, time, os, json
from flask import Flask, request, abort

app = Flask(__name__)
SECRET = os.environ["QUBITARA_WEBHOOK_SECRET"].encode()
OLD_SECRET = os.environ.get("QUBITARA_WEBHOOK_SECRET_OLD", "").encode()

def verify(raw_body: bytes, header: str, tolerance: int = 300) -> bool:
    try:
        parts = dict(p.strip().split("=", 1) for p in header.split(","))
        t = int(parts["t"])
    except (ValueError, KeyError):
        return False
    if abs(time.time() - t) > tolerance:
        return False
    def check(secret: bytes, sig: str | None) -> bool:
        if not secret or not sig:
            return False
        expected = hmac.new(secret, f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
        return hmac.compare_digest(expected, sig)
    return check(SECRET, parts.get("v1")) or check(OLD_SECRET, parts.get("v0"))

@app.post("/hooks/esign")
def esign_hook():
    raw = request.get_data()                       # raw bytes, before any parsing
    if not verify(raw, request.headers.get("X-Qubitara-Signature", "")):
        abort(400)
    event = json.loads(raw)
    if already_processed(event["id"]):
        return "", 200
    enqueue(event)
    mark_processed(event["id"])
    return "", 200

Every header name and the signing scheme are planned and may change.

Delivery, retries and timeouts#

The planned behavior is:

  • Your endpoint must answer with any 2xx within 10 seconds. Do the real work later, in the background.

  • Delivery is at least once. The same event can arrive more than once.

  • If your endpoint answers with a status that is not 2xx, or does not answer in time, eSign tries again. The wait grows each time: about 1 min, 5 min, 30 min, 2 h, 6 h, 24 h. That is 6 retries over about 33 hours.

  • After 10 consecutive failed deliveries, the endpoint is marked disabled. An Owner or Admin receives an email and must turn it on again under Settings → Integrations.

  • Events arrive in about the order they happened, but the order is not guaranteed. Use created_at and the resource status in the payload, not the arrival order.

  • Each request holds one event. Events are not grouped.

Idempotency#

Idempotency means that your code gives the same result when the same event arrives twice.

  • Use the event id as the key for your processing. The same value is in X-Qubitara-Event-Id.

  • The id stays the same across automatic and manual retries.

  • Store the IDs you processed for at least 48 hours. This is longer than the retry window.

  • Return 200 at once for a duplicate, as the code above shows.

One change can produce more than one event type. For example, document.signed for the last signer is followed by signature_request.finalized. These events have different IDs.

Secret rotation#

Rotation means you replace the old secret with a new one. The planned steps are:

  1. Click Rotate secret on the endpoint, or call POST /webhooks/{id}/rotate-secret.

  2. For the next 24 hours, deliveries carry both v1 (new secret) and v0 (old secret).

  3. Deploy the new secret. Keep accepting v0 until the 24 hours end.

Testing#

  • Click Send test event on the endpoint page, or call POST /webhooks/{id}/test. The plan is that this delivers a webhook.test event with a signed sample payload.

  • The plan is that the endpoint page shows recent deliveries with status code, attempt count and response time, and a Redeliver button.

  • For local development, open your handler to the internet with a tunnel tool (for example an ngrok-style tool). Register the HTTPS tunnel URL. Remove it when you finish.

  • Log the X-Qubitara-Event-Id and request_id of failures, so that support can trace them.

Next steps#