- Qubitara eSign
- Developers
- Webhooks
Webhooks
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.
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"
}'{
"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
secretonce. 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 |
|---|---|---|
| A request is created (draft), in the app or via API | Signature Request Created |
| A request is sent to recipients | Signature Request Sent |
| A reminder (manual or auto) is emailed | Not decided |
| A recipient opens the document | Not decided |
| One recipient completes their fields | Document Signed |
| A recipient declines (only if declining is part of the release) | Not decided |
| All signers have signed; completed PDF available | Not decided |
| The sender voids the request | Revoked (badge observed; its trigger was not) |
| The signing deadline passes | Not decided |
| A template is created | Not decided |
| A request is created from a template | Not decided |
| An organization member is invited | Not decided |
| An invited member accepts | Not decided |
| A member's role changes (manual or via group role mapping) | Not decided |
| A member is removed | Member Removed |
| A user is created by SCIM | User Provisioned (SCIM) |
| A SCIM user is updated | Not decided |
| A SCIM user is deactivated or deleted | Deleted badge or Member Removed (not decided which) |
| A group is created or its membership changes | Group Synced (SCIM) |
| An Aadhaar eSign transaction completes | Not decided |
| An Aadhaar eSign transaction fails | Not decided |
| 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.
{
"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 |
|---|---|
| Event type, for example |
| Same as |
|
|
|
|
|
|
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:
Read the raw request body as bytes. Do not parse the JSON and write it again before you hash.
Split
X-Qubitara-Signatureintotandv1(andv0if present).Reject the message if
|now - t| > 300seconds.Compute
HMAC_SHA256(secret, t + "." + raw_body)as lowercase hex.Compare the result with
v1. Use a constant-time comparison. During secret rotation, also acceptv0against your previous secret.Parse the JSON only after these checks pass.
Node.js (Express, raw body)#
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)#
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 "", 200Every 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
2xxwithin 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_atand the resourcestatusin 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
idas the key for your processing. The same value is inX-Qubitara-Event-Id.The
idstays 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
200at 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:
Click Rotate secret on the endpoint, or call
POST /webhooks/{id}/rotate-secret.For the next 24 hours, deliveries carry both
v1(new secret) andv0(old secret).Deploy the new secret. Keep accepting
v0until 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 awebhook.testevent 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-Idandrequest_idof failures, so that support can trace them.
Next steps#
Signature requests: the resource that most events describe.
Embedded signing: use browser events together with webhooks.
Audit trail: the record in the app that the events match.