Narro docs
Loading…
Narro tells your server when something changes. Events are thin, signed, versioned and replayable.
Webhooks are optional: nothing in setup or going live needs them. Deliveries are signed with the endpoint's own secret, never your API key or your org signing secret.
Add endpoints in the Partner Hub (API, then Webhooks) or with POST /webhooks. Both manage the same list, so an endpoint added in one shows in the other. Each endpoint has its own signing secret, shown once when it is created, and never shown again: if you lose it, rotate it. Rotating a secret in the Hub makes a new one at once and the old one stops signing, so verify against a list of secrets and keep the new and the previous one in it while you switch (see Verify the signature). Rotating a secret needs two-step verification. An org can have 10 endpoints, each an https URL on port 443 or 8443 at a public host.
Calls made with a test key never send webhooks.
| Type | When |
|---|---|
network.changed | Something in a granted company's network changed. Coalesced per 15 minutes. |
consent.granted | A user granted your org a purpose. |
consent.revoked | A user revoked a grant. Stop using it. Narro already has. |
connection.revoked | A connection or token family was revoked. |
intake.batch.completed | Every record in a batch has a result. |
intake.record.reviewed | A record that was waiting in review was decided. |
outcome.recorded | An outcome you or Narro reported was stored. |
outcome.confirmation_requested | Narro asks you to confirm the other side of an outcome. |
outcome.confirmed | An outcome was confirmed by both sides, raising its credit to 1.0. |
investor.responded | An investor in a granted founder's CRM answered outreach. Needs crm:read in the grant. |
listing.changed | A granted company's record changed. Fetch it again, or read GET /changes. |
write.reviewed | A write your app made was reviewed: accepted, rejected or a revision conflict. |
upload.reviewed | A document your app added was reviewed. Accepted documents stay private until the founder shares them. |
Register endpoints with POST /webhooks. URLs must be https on a public host.
Events carry ids and counts only, never names or values. They say what changed and how to fetch it. Schema: https://thenarro.com/schemas/partner/narro.webhook/1.json.
{
"id": "evt_example",
"type": "network.changed",
"version": "1",
"createdAt": "2026-10-11T12:00:00Z",
"partnerId": "po_example",
"subject": { "nodeId": "n_example_company", "listingRef": "n_example_company" },
"data": { "changes": 3, "since": "2026-10-11T11:45:00Z", "fetch": { "capability": "answers.what_changed", "cursor": "cur_example" } }
}Every delivery has three headers:
Narro-Webhook-Id: evt_example
Narro-Webhook-Timestamp: 1760184000
Narro-Webhook-Signature: v1=<hex HMAC-SHA256(endpoint secret, id + "." + timestamp + "." + raw body)><Narro-Webhook-Id>.<Narro-Webhook-Timestamp>.<raw body bytes>.v1= and the hex.v1= value matches any of your secrets.The same code in seven languages. Each one takes the raw body, the headers and a list of secrets, and returns true only for a genuine delivery. Node.js, Python and Ruby run in our tests against the real webhook signer. PHP, Go, Java and .NET are not executed in our tests: they are checked step by step against the same signer, so run them in your own tests before you rely on them.
verify.mjs. Run in our tests against the real webhook signer.
// Verify a Narro Data API webhook (Node.js 18+).
// rawBody: the exact bytes received, before any JSON parsing (Express: express.raw({ type: 'application/json' })).
// headers: Node's req.headers (lower-case names). secrets: your endpoint signing secret(s), e.g.
// [process.env.NARRO_WEBHOOK_SECRET, process.env.NARRO_WEBHOOK_SECRET_PREVIOUS]; keep both during a rotation.
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verifyNarroWebhook(rawBody, headers, secrets, toleranceSeconds = 300, nowSeconds = Math.floor(Date.now() / 1000)) {
const id = String(headers['narro-webhook-id'] || '');
const timestamp = String(headers['narro-webhook-timestamp'] || '');
const signature = String(headers['narro-webhook-signature'] || '');
if (!id || !signature || !/^[0-9]{9,11}$/.test(timestamp)) return false;
if (Math.abs(nowSeconds - Number(timestamp)) > toleranceSeconds) return false;
const given = signature.split(',').map((part) => part.trim()).filter((part) => part.startsWith('v1=')).map((part) => Buffer.from(part.slice(3).toLowerCase()));
const signed = Buffer.concat([Buffer.from(`${id}.${timestamp}.`, 'utf8'), Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(String(rawBody), 'utf8')]);
for (const secret of [].concat(secrets).filter(Boolean)) {
const expected = Buffer.from(createHmac('sha256', secret).update(signed).digest('hex'));
if (given.some((candidate) => candidate.length === expected.length && timingSafeEqual(candidate, expected))) return true;
}
return false;
}
verify.py. Run in our tests against the real webhook signer.
# Verify a Narro Data API webhook (Python 3.8+).
# raw_body: the exact bytes received (Flask: request.get_data(); Django: request.body), before JSON parsing.
# headers: a mapping with the header names as sent (Flask and Django header objects ignore case).
# secrets: your endpoint signing secret(s), e.g. [os.environ["NARRO_WEBHOOK_SECRET"]]; keep the old one too during a rotation.
import hashlib
import hmac
import re
import time
def verify_narro_webhook(raw_body, headers, secrets, tolerance_seconds=300, now=None):
webhook_id = headers.get("Narro-Webhook-Id") or ""
timestamp = headers.get("Narro-Webhook-Timestamp") or ""
signature = headers.get("Narro-Webhook-Signature") or ""
if not webhook_id or not signature or not re.fullmatch(r"[0-9]{9,11}", timestamp):
return False
if abs((time.time() if now is None else now) - int(timestamp)) > tolerance_seconds:
return False
given = [part.strip()[3:].lower() for part in signature.split(",") if part.strip().startswith("v1=")]
signed = f"{webhook_id}.{timestamp}.".encode("utf-8") + raw_body
for secret in [secrets] if isinstance(secrets, str) else secrets:
if not secret:
continue
expected = hmac.new(secret.encode("utf-8"), signed, hashlib.sha256).hexdigest()
if any(hmac.compare_digest(expected, candidate) for candidate in given):
return True
return False
verify.php. Not executed in our tests: checked step by step against the real webhook signer. Run it in your own tests.
<?php
// Verify a Narro Data API webhook (PHP 7.4+).
// $rawBody: file_get_contents('php://input'), never the re-encoded JSON. $headers: getallheaders() (any case).
// $secrets: your endpoint signing secret(s), e.g. [getenv('NARRO_WEBHOOK_SECRET')]; keep the old one too during a rotation.
function verify_narro_webhook(string $rawBody, array $headers, array $secrets, int $toleranceSeconds = 300, ?int $now = null): bool
{
$headers = array_change_key_case($headers, CASE_LOWER);
$id = (string) ($headers['narro-webhook-id'] ?? '');
$timestamp = (string) ($headers['narro-webhook-timestamp'] ?? '');
$signature = (string) ($headers['narro-webhook-signature'] ?? '');
if ($id === '' || $signature === '' || !preg_match('/^[0-9]{9,11}$/', $timestamp)) {
return false;
}
if (abs(($now ?? time()) - (int) $timestamp) > $toleranceSeconds) {
return false;
}
$given = [];
foreach (explode(',', $signature) as $part) {
$part = trim($part);
if (strncmp($part, 'v1=', 3) === 0) {
$given[] = strtolower(substr($part, 3));
}
}
foreach ($secrets as $secret) {
if ($secret === '' || $secret === null || $secret === false) {
continue;
}
$expected = hash_hmac('sha256', $id . '.' . $timestamp . '.' . $rawBody, $secret);
foreach ($given as $candidate) {
if (hash_equals($expected, $candidate)) {
return true;
}
}
}
return false;
}
verify.rb. Run in our tests against the real webhook signer.
# Verify a Narro Data API webhook (Ruby 2.6+).
# raw_body: the exact bytes received (Rails: request.raw_post; Rack/Sinatra: request.body.read), before JSON parsing.
# headers: a Hash of header name => value (any case). secrets: your endpoint signing secret(s),
# e.g. [ENV['NARRO_WEBHOOK_SECRET']]; keep the old one too during a rotation.
require 'openssl'
def narro_secure_compare(a, b)
return false unless a.bytesize == b.bytesize
diff = 0
a.bytes.zip(b.bytes) { |x, y| diff |= x ^ y }
diff.zero?
end
def verify_narro_webhook(raw_body, headers, secrets, tolerance_seconds: 300, now: Time.now.to_i)
h = {}
headers.each { |name, value| h[name.to_s.downcase] = value.to_s }
id = h['narro-webhook-id'].to_s
timestamp = h['narro-webhook-timestamp'].to_s
signature = h['narro-webhook-signature'].to_s
return false if id.empty? || signature.empty? || timestamp !~ /\A[0-9]{9,11}\z/
return false if (now - timestamp.to_i).abs > tolerance_seconds
given = signature.split(',').map(&:strip).select { |part| part.start_with?('v1=') }.map { |part| part[3..-1].downcase }
signed = "#{id}.#{timestamp}.".b + raw_body.to_s.b
Array(secrets).compact.reject(&:empty?).any? do |secret|
expected = OpenSSL::HMAC.hexdigest('SHA256', secret, signed)
given.any? { |candidate| narro_secure_compare(expected, candidate) }
end
end
verify.go. Not executed in our tests: checked step by step against the real webhook signer. Run it in your own tests.
// Verify a Narro Data API webhook (Go 1.20+).
// rawBody: the exact request body (io.ReadAll(r.Body)), before JSON decoding. header: r.Header.
// secrets: your endpoint signing secret(s), e.g. os.Getenv("NARRO_WEBHOOK_SECRET"); keep the old one too during a rotation.
package narro
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"net/http"
"regexp"
"strconv"
"strings"
"time"
)
var narroTimestamp = regexp.MustCompile(`^[0-9]{9,11}$`)
func VerifyNarroWebhook(rawBody []byte, header http.Header, secrets []string, toleranceSeconds int64, now time.Time) bool {
id := header.Get("Narro-Webhook-Id")
timestamp := header.Get("Narro-Webhook-Timestamp")
signature := header.Get("Narro-Webhook-Signature")
if id == "" || signature == "" || !narroTimestamp.MatchString(timestamp) {
return false
}
ts, err := strconv.ParseInt(timestamp, 10, 64)
if err != nil {
return false
}
age := now.Unix() - ts
if age > toleranceSeconds || -age > toleranceSeconds {
return false
}
var given [][]byte
for _, part := range strings.Split(signature, ",") {
part = strings.TrimSpace(part)
if strings.HasPrefix(part, "v1=") {
if decoded, err := hex.DecodeString(part[3:]); err == nil {
given = append(given, decoded)
}
}
}
for _, secret := range secrets {
if secret == "" {
continue
}
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(id + "." + timestamp + "."))
mac.Write(rawBody)
expected := mac.Sum(nil)
for _, candidate := range given {
if hmac.Equal(expected, candidate) {
return true
}
}
}
return false
}
NarroWebhook.java. Not executed in our tests: checked step by step against the real webhook signer. Run it in your own tests.
// Verify a Narro Data API webhook (Java 11+).
// rawBody: the exact request body bytes, before JSON parsing. header: a case-insensitive lookup, e.g. request::getHeader.
// secrets: your endpoint signing secret(s), e.g. System.getenv("NARRO_WEBHOOK_SECRET"); keep the old one too during a rotation.
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.List;
import java.util.function.Function;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public final class NarroWebhook {
public static boolean verify(byte[] rawBody, Function<String, String> header, List<String> secrets, long toleranceSeconds, long nowSeconds) throws Exception {
String id = header.apply("Narro-Webhook-Id");
String timestamp = header.apply("Narro-Webhook-Timestamp");
String signature = header.apply("Narro-Webhook-Signature");
if (id == null || id.isEmpty() || signature == null || signature.isEmpty() || timestamp == null || !timestamp.matches("[0-9]{9,11}")) return false;
if (Math.abs(nowSeconds - Long.parseLong(timestamp)) > toleranceSeconds) return false;
byte[] prefix = (id + "." + timestamp + ".").getBytes(StandardCharsets.UTF_8);
for (String secret : secrets) {
if (secret == null || secret.isEmpty()) continue;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
mac.update(prefix);
byte[] expected = toHex(mac.doFinal(rawBody)).getBytes(StandardCharsets.US_ASCII);
for (String part : signature.split(",")) {
String p = part.trim();
if (p.startsWith("v1=") && MessageDigest.isEqual(expected, p.substring(3).toLowerCase().getBytes(StandardCharsets.US_ASCII))) return true;
}
}
return false;
}
private static String toHex(byte[] bytes) {
StringBuilder out = new StringBuilder(bytes.length * 2);
for (byte b : bytes) out.append(String.format("%02x", b));
return out.toString();
}
}
NarroWebhook.cs. Not executed in our tests: checked step by step against the real webhook signer. Run it in your own tests.
// Verify a Narro Data API webhook (.NET 6+).
// rawBody: the exact request body bytes (ASP.NET Core: Request.EnableBuffering(), then read Request.Body), before model binding.
// header: e.g. name => Request.Headers[name].ToString(). secrets: your endpoint signing secret(s),
// e.g. Environment.GetEnvironmentVariable("NARRO_WEBHOOK_SECRET"); keep the old one too during a rotation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
public static class NarroWebhook
{
public static bool Verify(byte[] rawBody, Func<string, string> header, IEnumerable<string> secrets, long toleranceSeconds = 300, long? nowSeconds = null)
{
var id = header("Narro-Webhook-Id");
var timestamp = header("Narro-Webhook-Timestamp");
var signature = header("Narro-Webhook-Signature");
if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(signature) || timestamp == null || !Regex.IsMatch(timestamp, "^[0-9]{9,11}$")) return false;
var now = nowSeconds ?? DateTimeOffset.UtcNow.ToUnixTimeSeconds();
if (Math.Abs(now - long.Parse(timestamp)) > toleranceSeconds) return false;
var given = signature.Split(',').Select(p => p.Trim()).Where(p => p.StartsWith("v1=")).Select(p => Encoding.ASCII.GetBytes(p.Substring(3).ToLowerInvariant())).ToList();
var signed = Encoding.UTF8.GetBytes($"{id}.{timestamp}.").Concat(rawBody).ToArray();
foreach (var secret in secrets.Where(s => !string.IsNullOrEmpty(s)))
{
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
var expected = Encoding.ASCII.GetBytes(Convert.ToHexString(hmac.ComputeHash(signed)).ToLowerInvariant());
if (given.Any(candidate => CryptographicOperations.FixedTimeEquals(expected, candidate))) return true;
}
return false;
}
}
id.network.changed is coalesced to at most one per company per 15 minutes.consent.revoked within 5 minutes.Any event from the last 7 days can be sent again, with the same ids. since is required, until is optional, and one call replays at most 1,000 events to the endpoint in the path.
curl -X POST https://api.thenarro.com/data/v1/webhooks/wh_example/replay \
-H "Authorization: Bearer narro_pk_test_EXAMPLEKEY0000000000000000" \
-H "Content-Type: application/json" \
-d '{ "since": "2026-10-10T00:00:00Z", "until": "2026-10-11T00:00:00Z" }'