Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Guides Webhooks Set up webhooks

Set up webhooks

Register your webhook endpoints, check each request's signature, handle retries, duplicates and order, and find events your server missed.

14 min read

Gravv sends an HTTPS POST to your webhook URL each time an event happens, such as a transfer completing, a deposit landing, a card being frozen or a customer passing KYC. This page covers what every event has in common: how to register your URL, check signatures, handle retries, duplicates and order, and find the events your server missed. The event catalogue lists each event and its fields.

Example. Chidi's 50.00 USD deposit lands while your server is down for a release. Gravv's delivery of transfer.inflow.completed fails, and Gravv tries again later. Your server comes back after the last attempt, so the event ends failed. You list the failed transfer events, read the stored event, and credit Chidi the 50.00 USD once, because you keep the event_id of every event you have already processed.

Register your webhook endpoints

You add endpoints in the Dashboard. There is no public API for it. Follow the steps in Webhooks.

•
Up to 2 endpoints in each environment. Sandbox and live each take up to 2 endpoints. Each endpoint has its own URL, description, secret and list of events. Events about sandbox activity go to the sandbox endpoints.
•
Pick the events, or take them all. Choose which event types an endpoint receives, such as transfer.inflow.completed. An endpoint with no events picked receives every event. When both endpoints take an event, each gets its own delivery, with the same event_id, and each is retried on its own.
•
A public https URL. The Dashboard saves an http URL, but every delivery to it fails. Gravv refuses addresses on a private network. Do not redirect the URL, because a redirect turns the POST into a GET without a body.
•
The secret. The Dashboard generates a secret for each endpoint that starts with whsec_. The whole value, whsec_ included, is the signing key. Gravv signs requests with HMAC-SHA256, and you cannot choose another method. To change it, roll the secret.
•
Changes take up to 5 minutes. After you add, change or delete an endpoint, some events can still follow the old setup for up to 5 minutes.
•
Send a test event. The Dashboard sends a signed webhook.test event to an endpoint, even one that is turned off, and shows your server's answer. Each endpoint also shows its delivery rate over the last 7 days and its own deliveries.
•
When an event goes to the newest endpoint. Two cases ignore the event list you picked and use your newest endpoint that is on: an event that arrives while Gravv cannot read your endpoint settings for a moment, and a manual resend of an event queued before you had several endpoints. Any other manual resend goes to the endpoint the event was queued for. If your endpoints take different events, make each one ignore event types it did not ask for, and return 200 for them.
•
Endpoints that keep failing are turned off. When no delivery to an endpoint has succeeded for 3 days, counted from its first failure, Gravv turns it off and emails your business's Owners and Admins. Events for an endpoint that is off are recorded but not sent. Turn it back on in the Dashboard once your server is fixed. An endpoint Gravv support turned off can only be turned back on by Gravv support.

Webhook payload structure

Every event has the same envelope. Only event_data changes with the event type.

transfer.inflow.completed
{
"tenant_id": "dfa96ede-fc13-43cf-8328-8b910d1cd1d2",
"transaction_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"event_category": "transfer",
"event_type": "transfer.inflow.completed",
"event_group_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"timestamp": "2026-10-13T08:02:11Z",
"event_data": {
"account_id": "4f3e2d1c-0b9a-4876-9543-210fedcba987",
"amount": "50",
"currency": "USD",
"narration": "Savings top-up",
"sender_account_number": "0123456789",
"sender_bank": "Example Bank",
"sender_name": "Chidi Okafor",
"session_id": "",
"status": "completed",
"transaction_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
},
"event_id": "c0ffee00-1234-4abc-9def-001122334455",
"idempotency_key": "6c1f0a9e2b7d4c3a8e5f1b0d9c7a6e4f2d3b1a0c9e8f7d6c5b4a3f2e1d0c9b8a"
}
FieldTypeDescription
event_idstringThis event's own id. It stays the same on every retry and resend of the event, so deduplicate on it
tenant_idstringYour business
transaction_idstringThe transaction the event is about, or "" when there is none
event_categorystringThe category, such as transfer, cards or customer. Webhook history filters by it
event_typestringThe full type, such as transfer.inflow.completed
event_group_idstringThe same for every event about one thing: one transfer, deposit, card or customer. The catalogue says which id it is for each family
timestampstringWhen Gravv sent the event, in ISO 8601. It is not always the time of the change
event_dataobjectThe event's own fields. See the catalogue
idempotency_keystringOnly on some events. On transfer events it gives the order. See ordering

Keys in event_data arrive in alphabetical order, and the characters <, > and & in strings arrive escaped as \u003c, \u003e and \u0026. Your JSON parser handles both. They matter only for the signature, which is why you check it on the bytes you received.

Each request carries these headers. Read header names without regard to case.

HeaderValue
Content-Typeapplication/json
X-SignatureThe signature. See below
X-Signature-NextOnly in the 24 hours after you roll the secret: the signature with the new secret
X-Event-IDThe event's event_group_id, which every event about the same thing shares. It is not the event_id

Verify webhook signatures

X-Signature is the lowercase hexadecimal HMAC-SHA256 of the exact request body, keyed with your whole webhook secret, whsec_ included. In the 24 hours after you roll the secret, X-Signature-Next carries the same signature made with the new secret. Check them before you act on an event:

1.
Read the raw request body bytes before any JSON parsing. Parsing and serializing again changes the bytes and breaks the signature.
2.
Compute the HMAC-SHA256 of those bytes with your whole secret, as lowercase hexadecimal.
3.
Compare it in constant time with X-Signature, and with X-Signature-Next when the request has it.
4.
Process the event only if one of them matches. Return 401 when neither does.

Checking both headers from the start means a secret roll never breaks your check, whether you swap the new secret in before or after the old one stops.

Node.js (Express)Python (Flask)Go (net/http)
const crypto = require("crypto");
const express = require("express");
const app = express();
// express.raw keeps the exact bytes Gravv sent.
app.post("/hooks/gravv", express.raw({ type: "*/*" }), (req, res) => {
const secret = process.env.GRAVV_WEBHOOK_SECRET; // the whole value, including "whsec_"
const expected = Buffer.from(
crypto.createHmac("sha256", secret).update(req.body).digest("hex"),
"utf8",
);
// X-Signature-Next is only there for 24 hours after a secret roll.
const sent = [req.get("X-Signature"), req.get("X-Signature-Next")].filter(Boolean);
// timingSafeEqual throws on buffers of different lengths, so compare the lengths first.
const ok = sent.some((header) => {
const received = Buffer.from(header, "utf8");
return received.length === expected.length && crypto.timingSafeEqual(received, expected);
});
if (!ok) return res.status(401).end();
const event = JSON.parse(req.body.toString("utf8"));
// Skip event.event_id if you have processed it; otherwise store the event and queue it.
res.status(200).json({ received: true });
});
app.listen(3000);

Roll a secret

Roll an endpoint's secret in the Dashboard when you want a new one. You choose what happens to the old one:

•
Keep the old secret for 24 hours (the default, for a planned change). For 24 hours, X-Signature is still signed with the old secret and X-Signature-Next with the new one. After 24 hours, X-Signature carries the new secret and X-Signature-Next is gone.
•
Stop the old secret now (when it has leaked). Only the new secret signs, in X-Signature, from the moment you roll. Allow up to 5 minutes for the change to reach every delivery. Requests signed with the old secret after that did not come from Gravv.

So that a roll never breaks your check, compute the signature with the secret you hold and accept the request when it matches either X-Signature or X-Signature-Next, as the handlers above do. That works before you swap in the new secret and after.

Both Dashboards roll the secret. In the current Dashboard, generating a new secret for the webhook is a roll that keeps the old one for 24 hours. Stopping the old secret at once is only in the new Dashboard. Either way, you cannot roll again until the old secret's 24 hours are over, except to stop it now.

Example. You roll the secret at 10:00 and keep the old one. Your server still holds the old secret, so its signature matches X-Signature. At 14:00 you deploy the new secret, and its signature now matches X-Signature-Next. At 10:00 the next day X-Signature switches to the new secret, and your check keeps passing without another change.

The signature has no timestamp, so it does not stop someone from sending a captured request a second time. Deduplicate on event_id, and a replayed request has no effect.

A manual resend is signed like an automatic delivery. It carries X-Signature, and X-Signature-Next during a roll, so your signature check works on it without a change.

Delivery, retries, and idempotency

Gravv treats any 2xx response as delivered. Any other status, a timeout or no response is a failed attempt. Gravv follows a redirect as a GET without the body, so keep the URL free of redirects.

•
Respond within 30 seconds. Store the event, return 200, and do the work afterwards. Gravv keeps up to 64 KiB of your response, which you can read on the event route. Respond with a JSON object or an empty body.
•
Retries. Gravv retries a failed attempt, with growing gaps between attempts. The number of attempts can differ between sandbox and live. Read max_retries on Get webhook event. After the last attempt the event is failed, and nothing retries it automatically. Read it or resend it, as described below.
•
No URL, or a URL that is not public https. Every attempt fails before Gravv makes a call. The event records response_status_code 0, and each attempt shows in the calls with the text Not sent: Gravv could not prepare this delivery. It is retried automatically.
•
At least once. The same event can reach you more than once. Deduplicate on the body's event_id and treat a repeat as done. Do not deduplicate on X-Event-ID. Every event about the same transfer, card or customer shares it, so you would drop real updates.
•
Any order. Gravv delivers events in parallel, and retries mix with new events. For transfer events, idempotency_key is <reference>:<sequence>. Apply an event only when its sequence is higher than the last one you applied. For other events, compare the status in event_data with the state you hold. timestamp does not give the order.
•
Repeats of the same state. Gravv does not send an event that carries no idempotency_key and is identical to an earlier one for the same object. For example, when a card goes active, then freeze, then active again, Gravv sends no second active. After a change you make yourself, read the object.
•
Poll as a backup. Webhooks tell you that something changed, but the API holds the current state. Poll the objects you are waiting on from time to time, so a missed event costs you minutes, not days.

Find and resend missed events

Four routes show what Gravv sent you, in the environment of the key you use. They need no Idempotency-Key.

RouteUse it to
GET /v1/webhooks/historyList delivery records, newest first, and find the failed ones
GET /v1/webhooks/event/{id}Read one record: the event as stored, attempts, delivery_attempts, max_retries and your endpoint's last response
GET /v1/webhooks/calls/{id}See each attempt, retries and successes included: your status code, the time taken and any connection error
POST /v1/webhooks/event/send/{id}Send one stored event to the endpoint it was queued for, now

Three different ids appear in these routes. Keep them apart:

IdWhere you find itWhat it is
Record iditems[].id in history, and id on the event routeThe delivery record. It is the {id} in the other three routes
event_id on the event routeGET /v1/webhooks/event/{id}The event_group_id, the same value as the X-Event-ID header
payload.event_idInside payload on the event routeThe event_id your endpoint received. Deduplicate on this one

History filters. All filters are optional, and you can combine them:

•
event_type takes the category, such as transfer (which includes deposits into accounts), inflow, collection, cards, customer, external_account, applications.accounts, account or feature_access. A full type such as transfer.inflow.completed returns nothing.
•
status is pending, processing, sent, failed or retrying. Any other value returns an empty list, not an error.
•
start_date and end_date take 2026-10-13T10:00:00Z, 2026-10-13 or 2026-10-13T10:00:00. A date alone means 00:00 that day, so end_date=2026-10-13 leaves out the 13th.
•
transaction_id matches the record's transaction. For a collection, that is the collection's id. For a transfer, it is the first id in associated_transactions, not the transfer reference.
•
page starts at 1. limit is 50 by default and at most 100.

Read the event and process it. payload on the event route is the event as Gravv stored it. You fetched it with your API key, so you can process it directly. Deduplicate on payload.event_id. Its keys are in a different order from the request Gravv sent you, so you cannot check a signature against it.

Or resend it. POST /v1/webhooks/event/send/{id} posts the stored event to the endpoint it was queued for and returns that endpoint's result. Only an event queued before you had several endpoints goes to your newest endpoint that is on. If you deleted the endpoint the event was queued for, the resend is refused. It takes no body. A scoped API key needs the webhook:create permission. The resend:

•
is signed like an automatic delivery, with X-Signature (and X-Signature-Next during a roll), and has the same body format;
•
returns HTTP 200 even when your endpoint refused it, so read status_code in the response;
•
puts the event back into automatic, signed retries when your endpoint refuses it;
•
sends the event again on every call.

Trace a transfer and resend a webhook and Set up webhooks and catch up on missed events walk through these routes with full requests.

Attempts. Gravv records every attempt, including a successful delivery and an attempt that failed before it was sent. attempts counts them all. The event route returns them in delivery_attempts, latest first, each with its response code, time, response headers, response body and error. It leaves out the request headers. For an attempt that failed before it was sent, error_message reads Not sent: Gravv could not prepare this delivery. It is retried automatically.

Errors. These routes return errors as HTTP 400 with {"data":null,"error":"<message>"}, including for an id that does not exist. A missing or wrong API key still gets 401, and too many requests get 429.

MessageWhyFix
invalid event ID format or invalid event IDThe {id} is not a UUIDUse items[].id from history
event not found, or event not found or not owned by tenantNo such record for your business, or it is in the other environmentCheck the id, and use a key for the same environment
event is already being processedGravv is delivering it right nowWait a moment and try again
the webhook endpoint this event was queued for was deletedYou deleted the endpoint the event was queued forAdd the endpoint again, or read payload and process it
no webhook URL configured for tenant <id> category <category>No URL is setSet the URL in the Dashboard
unsafe webhook url: webhook url must use https schemeThe URL is http, or privateRegister a public https URL
webhook delivery failed: <error>Your endpoint did not respond within 30 seconds, or refused the connectionFix the endpoint. Gravv schedules an automatic retry
failed to process event dataYour endpoint's last response was JSON but not an objectRespond with a JSON object or an empty body
circuit breaker open for webhooks: circuit breaker is openGravv's webhook service is failing brieflyTry again after about 30 seconds

A scoped key without webhook:create gets 403 on the resend, with required_any ["webhook:create"].

Event types

•
Event catalogue: every event Gravv sends, with its fields and an example.
Was this page helpful? Yes No