Webhooks and events
Register a webhook endpoint, verify the Roots-Signature header, handle retries, and process the eleven Roots event types.
Roots sends an HTTPS POST to your webhook endpoint when a person, account, counterparty, document, transfer, fee, or billing balance changes. Each delivery is signed, delivered at least once, and retried on failure.
Register an endpoint
Webhook endpoints are managed in the Client Portal, not through the bearer-token API. For each endpoint you set:
| Field | Rule |
|---|---|
url | Must use https. Must resolve to a public address. Redirects are not followed. |
event_types | 1–32 event types from the table below, or ["*"] alone for every event type. |
description | Optional, up to 200 characters. |
The endpoint id starts with whep_. Its signing secret starts with whsec_ and is shown once, when you create the endpoint or rotate its secret. Rotating replaces the secret immediately; deliveries from then on are signed with the new one.
The portal also sends a test event to an endpoint, shows each delivery with its attempts and last response code, and retries a failed delivery by hand. The delivery log is kept for 90 days.
Delivery
POST /roots-webhooks HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Roots-Webhooks/1.0
Roots-Signature: t=1786449600,v1=5f2b1c...
Roots-Event-Id: evt_3c9a1e7f0b2d4c6e8a1f3b5d7c9e0a2b
Roots-Event-Type: transfer.status.changed
Roots-Delivery-Id: ...
Roots-Attempt: 1| Header | Meaning |
|---|---|
Roots-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256>. |
Roots-Event-Id | The event id, the same as the body's id. |
Roots-Event-Type | The event type, the same as the body's type. |
Roots-Delivery-Id | This event's delivery to this endpoint. |
Roots-Attempt | 1 on the first attempt, then counts up. |
Any 2xx response acknowledges the delivery. Anything else, a connection error, or no response within 15 seconds counts as a failed attempt.
Delivery is at least once with no ordering guarantee. Dedupe on the event id, and do not assume a transfer.status.changed arrives after the transfer.created for the same transfer. Read the resource when order matters.
Retries
A failed attempt is retried on a fixed schedule. In sandbox the delays after each failed attempt are:
| After attempt | Next attempt in |
|---|---|
| 1 | 2 seconds |
| 2 | 5 seconds |
| 3 | 10 seconds |
| 4 | 20 seconds |
| 5 | 30 seconds |
After the sixth failed attempt the delivery is failed and is not retried again unless you retry it from the portal. An endpoint is disabled automatically after ten deliveries in a row end failed, with no 2xx in between; re-enable it in the portal once it is fixed.
Verify the signature
The signature is an HMAC-SHA256 over <t>.<raw body>, keyed with the whole endpoint secret, whsec_ prefix included. Verify against the raw request bytes, before any JSON parsing.
- Split
Roots-Signatureon,and readtandv1. - Compute
HMAC-SHA256(secret, t + "." + raw_body)as lowercase hex. - Compare it with
v1in constant time. - Reject the delivery if
tis too far from your clock. Five minutes is a reasonable tolerance.
import hashlib
import hmac
import time
def verify_roots_signature(raw_body: bytes, header: str, secret: str, tolerance_seconds: int = 300) -> bool:
parts = dict(item.split("=", 1) for item in header.split(","))
timestamp = int(parts["t"])
if abs(time.time() - timestamp) > tolerance_seconds:
return False
signed_payload = f"{timestamp}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed_payload, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])const crypto = require("crypto");
function verifyRootsSignature(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(",").map((item) => item.split("=", 2)));
const timestamp = Number(parts.t);
if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${timestamp}.`)
.update(rawBody)
.digest("hex");
const received = Buffer.from(parts.v1 ?? "", "hex");
const computed = Buffer.from(expected, "hex");
return received.length === computed.length && crypto.timingSafeEqual(received, computed);
}import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.HexFormat;
import java.util.Map;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public final class RootsSignature {
public static boolean verify(byte[] rawBody, String header, String secret, long toleranceSeconds)
throws NoSuchAlgorithmException, InvalidKeyException {
Map<String, String> parts = new HashMap<>();
for (String item : header.split(",")) {
String[] pair = item.split("=", 2);
if (pair.length == 2) parts.put(pair[0].trim(), pair[1].trim());
}
long timestamp;
byte[] received;
try {
timestamp = Long.parseLong(parts.getOrDefault("t", ""));
received = HexFormat.of().parseHex(parts.getOrDefault("v1", ""));
} catch (IllegalArgumentException e) {
return false;
}
if (Math.abs(System.currentTimeMillis() / 1000 - timestamp) > toleranceSeconds) return false;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
mac.update((timestamp + ".").getBytes(StandardCharsets.UTF_8));
return MessageDigest.isEqual(mac.doFinal(rawBody), received);
}
}package roots
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"strconv"
"strings"
"time"
)
func VerifyRootsSignature(rawBody []byte, header, secret string, tolerance time.Duration) bool {
parts := map[string]string{}
for _, item := range strings.Split(header, ",") {
if key, value, ok := strings.Cut(item, "="); ok {
parts[strings.TrimSpace(key)] = strings.TrimSpace(value)
}
}
timestamp, err := strconv.ParseInt(parts["t"], 10, 64)
if err != nil {
return false
}
age := time.Since(time.Unix(timestamp, 0))
if age > tolerance || age < -tolerance {
return false
}
received, err := hex.DecodeString(parts["v1"])
if err != nil {
return false
}
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(strconv.FormatInt(timestamp, 10) + "."))
mac.Write(rawBody)
return hmac.Equal(mac.Sum(nil), received)
}Because t is inside the signed value, a captured body cannot be replayed with a fresh timestamp.
Event envelope
Every delivery has the same envelope. data is the object the event is about; its shape depends on type.
{
"id": "evt_3c9a1e7f0b2d4c6e8a1f3b5d7c9e0a2b",
"type": "transfer.status.changed",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {}
}| Field | Meaning |
|---|---|
id | The event id, evt_…. Dedupe on it. |
type | The event type. |
occurred_at | When the change happened. |
data | The object, as the API returns it. |
test | true on a test send from the portal, whose id starts with evt_test_. Absent on real events. |
Event types
| Event type | Fires when | data |
|---|---|---|
person.created | A person is created. | PersonDetail |
person.review.completed | A person's review reaches an outcome: status becomes active when it cleared and inactive when it was denied. | PersonDetail |
person.onboarding_link.submitted | A business customer submitted the hosted KYB form you sent from the Client Portal. Sent on every submit, including after a new link reopened the form. | PersonOnboardingLinkSubmitted |
person.onboarding_link.review_failed | A link whose submit_mode is customer could not start review: results says, per person, whether requirements were unmet, the billing balance was too low, or review was unavailable. The link stays submitted, and you retry from the Client Portal. | PersonOnboardingLinkReviewFailed |
person.onboarding_link.parties_cleared | Every party on the link has cleared review. business_submitted is true when the business was sent to review on its own (submit_mode customer), false when that is your call (submit_mode client). | PersonOnboardingLinkPartiesCleared |
person.onboarding_link.parties_blocked | A party on the link was denied, so the business cannot proceed as structured. Sent on the first denial; a denial is final. | PersonOnboardingLinkPartiesBlocked |
account.created | An account is created. | AccountDetail |
account.status.changed | An account's status changes. | AccountDetail |
transfer.created | A transfer is created. | TransferDetail |
transfer.status.changed | A transfer moves to a new status, including returned, reversed and cancelled: there is no separate event type for any of them. failure says why when it is failed, returned, or reversed; a cancelled transfer has failure null and status_detail says where it was stopped. | TransferDetail |
counterparty.created | A counterparty is created, already screened: status is active when screening cleared it and blocked when not. | CounterpartyDetail |
counterparty.status.changed | A counterparty's status changes. | CounterpartyDetail |
document.uploaded | A document is uploaded. | DocumentSummary |
fee.charged | A fee is posted to the ledger. | FeeChargeDetail |
billing.balance.low | A fee takes your billing balance below its minimum. Requests that can incur a fee are refused with 400 insufficient_billing_balance until you top up. | BillingBalances |
reserve.low | Your billing balance or fraud reserve is running low or has fallen under its minimum. Sent once each time it gets worse. | ReserveAlert |
PersonDetail, AccountDetail, TransferDetail, CounterpartyDetail, DocumentSummary, and FeeChargeDetail are the same objects the API returns from the matching GET endpoint. The API reference's webhooks section has the full schema of every event.
The examples below are abbreviated. In a real event, data carries every field of the object, as in the API reference.
person.created and person.review.completed
{
"id": "evt_...",
"type": "person.review.completed",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "person_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"type": "individual",
"role": "customer",
"external_id": "cust-0042",
"details": {"first_name": "Jane", "last_name": "Doe"},
"mailing_address": {"line1": "1 Main St", "city": "Austin", "country": "US"},
"status": "active",
"status_detail": null,
"requirements": {"currently_due": [], "pending_verification": [], "errors": []},
"created_at": "2026-08-10T12:00:00+00:00",
"updated_at": "2026-08-10T12:00:00+00:00"
}
}account.created and account.status.changed
{
"id": "evt_...",
"type": "account.status.changed",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "acct_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"person_id": "person_...",
"label": null,
"currency": "usd",
"status": "active",
"status_detail": null,
"capabilities": {"receive": "active", "send": "active"},
"balance": {"available_minor": "0", "pending_minor": "0", "current_minor": "0"},
"created_at": "2026-08-10T12:00:00+00:00",
"active_at": "2026-08-10T12:00:00+00:00"
}
}transfer.created and transfer.status.changed
{
"id": "evt_...",
"type": "transfer.status.changed",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "xfer_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"source": {"type": "account", "id": "acct_...", "person_id": "person_...", "name": "Harbor Trading LLC", "label": "Operating"},
"destination": {"type": "account", "id": "acct_...", "person_id": "person_...", "name": "Harbor Trading LLC", "label": "Treasury"},
"direction": "internal",
"account_id": "acct_...",
"destination_account_id": "acct_...",
"rail": "internal",
"amount_minor": "5000",
"fee_quoted_minor": "0",
"fee_charged_minor": "0",
"fee_mode": "on_top",
"purpose": "treasury",
"status": "settled",
"status_detail": null,
"failure": null,
"rail_refs": {},
"created_by_identity_id": "ident_...",
"created_at": "2026-08-10T12:00:00+00:00",
"submitted_at": "2026-08-10T12:00:00+00:00",
"settled_at": "2026-08-10T12:00:01+00:00"
}
}counterparty.created and counterparty.status.changed
{
"id": "evt_...",
"type": "counterparty.status.changed",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "cpty_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"person_id": "person_...",
"counterparty_type": "individual",
"external_id": null,
"description": null,
"relationship_to_person": "customer",
"status": "active",
"status_detail": null,
"created_at": "2026-08-10T12:00:00+00:00",
"counterparty_information": {
"first_name": "Maria",
"last_name": "Hernandez",
"email": "[email protected]",
"mailing_address": {"line1": "1 Main St", "city": "Austin", "country": "US"}
},
"external_account_information": {
"external_account_type": "bank_account",
"supported_rails": ["ach"],
"account_subtype": "checking",
"account_number": "****5678",
"routing_number": "021000021"
}
}
}document.uploaded
{
"id": "evt_...",
"type": "document.uploaded",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "doc_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"subject_type": "person",
"subject_id": "person_...",
"type": "national_id_front",
"status": "uploaded",
"content_type": "image/jpeg",
"size_bytes": 51200,
"uploaded_at": "2026-08-10T12:00:00+00:00"
}
}fee.charged
{
"id": "evt_...",
"type": "fee.charged",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"id": "fee_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"event_type": "deposit.received",
"rule_code": "deposit-ach",
"rule_version": 2,
"payer": "customer",
"status": "posted",
"person_id": "person_...",
"account_id": "acct_...",
"transfer_id": "xfer_...",
"base_amount_minor": "125000",
"fees_customer_minor": "35",
"fees_client_minor": "10",
"fees_platform_minor": "25",
"source_event_id": "evt_...",
"related_txn_id": "fee_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"rail_refs": {"roots_sweep_transfer_id": "5001234"},
"occurred_at": "2026-08-10T12:00:00+00:00",
"created_at": "2026-08-10T12:00:01+00:00",
"posted_at": "2026-08-10T12:00:02+00:00"
}
}billing.balance.low
| Field | Meaning |
|---|---|
billing_minor | The billing balance Roots' fees are paid from. |
revenue_minor | Earned markup, movable into billing with POST /api/v1/billing/move-from-revenue. |
min_minor | The billing balance under which fee-incurring requests are refused. |
blocked | true when billing_minor < min_minor. |
{
"id": "evt_...",
"type": "billing.balance.low",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"billing_minor": "95000",
"revenue_minor": "4200",
"min_minor": "100000",
"blocked": true
}
}reserve.low
Fires when the billing balance or the fraud reserve gets worse: ok to low, ok to blocked, or low to blocked. It does not repeat while the reserve stays where it is, and fires again after the reserve has recovered to ok. See Manage your billing balance and fraud reserve.
| Field | Meaning |
|---|---|
reserve | billing or fraud. |
status | low: above the minimum but inside the alert margin. blocked: under the minimum, so requests that move money or incur a fee are refused until you top up. |
balance_minor | What the reserve holds now. |
required_minor | The minimum it must hold. |
shortfall_minor | How far under the minimum it is, else "0". |
alert_threshold_minor | The balance under which the reserve is low. |
{
"id": "evt_...",
"type": "reserve.low",
"occurred_at": "2026-08-10T12:00:00+00:00",
"data": {
"reserve": "fraud",
"status": "low",
"balance_minor": "540000",
"required_minor": "500000",
"shortfall_minor": "0",
"alert_threshold_minor": "600000"
}
}Build your receiver
- Verify
Roots-Signatureagainst the raw body. Reject anything that fails. - Persist the event, then answer
2xxquickly. Process asynchronously; a response slower than 15 seconds is a failed attempt. - Dedupe on
id. The same event can arrive more than once. - Read the current resource from the API before you release funds or report settlement.
- Ignore or route aside events with
"test": true.
Next steps
- Read Track transfer status for transfer states and failure codes.
- Read Security and data handling for storing the signing secret.
Updated 5 days ago