# Receive webhooks

> Kontiga is document fraud detection by Bynn Intelligence for insurers, letting agents, lenders and HR screening teams: every document is compared with a proprietary library of more than 300 million original documents, gathered over 20 years.

Documentation index: https://kontiga.com/llms.txt

Section: Guides. URL: https://kontiga.com/docs/guides/receive-webhooks

Get each event at your own https address as it happens, check that it came from Kontiga, answer fast, and try it all with the test inbox before you deploy. The compatible document webhooks are checked with Kontiga's public key.

Updated November 30, 2026

## Add an endpoint

An endpoint is an https address of yours on a public host, for Kontiga's own events or for the compatible document events, live or test. Its signing secret is in the answer once: store it with your other secrets.

API:

```bash
curl -X POST https://api.kontiga.com/v1/webhook_endpoints \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://claims.example.com/kontiga/events",
    "events": [
      "document.checked",
      "document.failed"
    ],
    "mode": "test"
  }'
```

CLI:

```bash
kontiga webhooks create \
  --url https://claims.example.com/kontiga/events \
  --events document.checked,document.failed \
  --mode test
```

MCP tool `create_webhook_endpoint`:

```json
{
  "name": "create_webhook_endpoint",
  "arguments": {
    "url": "https://claims.example.com/kontiga/events",
    "events": [
      "document.checked",
      "document.failed"
    ],
    "mode": "test"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.webhooks.create({
  url: "https://claims.example.com/kontiga/events",
  events: ["document.checked", "document.failed"],
  mode: "test",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.webhooks.create(
    url="https://claims.example.com/kontiga/events",
    events=["document.checked", "document.failed"],
    mode="test",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Webhooks.Create(ctx, &kontiga.WebhooksCreateParams{
	Url:    "https://claims.example.com/kontiga/events",
	Events: []string{"document.checked", "document.failed"},
	Mode:   "test",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.webhooks().create(WebhooksCreateParams.builder()
    .url("https://claims.example.com/kontiga/events")
    .events(List.of("document.checked", "document.failed"))
    .mode("test")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Webhooks.CreateAsync(new WebhooksCreateOptions
{
    Url = "https://claims.example.com/kontiga/events",
    Events = new[] { "document.checked", "document.failed" },
    Mode = "test",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->webhooks->create([
    'url' => 'https://claims.example.com/kontiga/events',
    'events' => ['document.checked', 'document.failed'],
    'mode' => 'test',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.webhooks.create(
  url: "https://claims.example.com/kontiga/events",
  events: ["document.checked", "document.failed"],
  mode: "test"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .webhooks()
    .create(kontiga::webhooks::CreateParams {
        url: "https://claims.example.com/kontiga/events".into(),
        events: vec!["document.checked".into(), "document.failed".into()],
        mode: "test".into(),
        ..Default::default()
    })
    .await?;
```

> **Live and test never mix** A test endpoint gets test events only, a live endpoint live events only. A sample you send on purpose goes to any endpoint.

## What arrives

A `POST` with a JSON body: `{id, type, created_at, workspace, mode, data: {object}}`, where `data.object` is the object as the API answers it at that moment. The headers are `Content-Type: application/json`, `User-Agent: Kontiga-Webhooks/1.0`, `Kontiga-Event-Id` (the event's id) and `Kontiga-Signature`.

**A delivery**

```
POST /kontiga/events HTTP/1.1
Content-Type: application/json
User-Agent: Kontiga-Webhooks/1.0
Kontiga-Event-Id: evt_0193c1a2d0017a2b8c3d4e5f60718293
Kontiga-Signature: t=1764150522,v1=6b1e0c...

{"id":"evt_0193c1a2d0017a2b8c3d4e5f60718293","type":"document.checked","created_at":"2026-11-26T09:48:42.118Z","workspace":"ws_0193c1a2b3c44d5e8f9a0b1c2d3e4f50","mode":"test","data":{"object":{"id":"doc_0193c1a2d0017a2b8c3d4e5f60718294","object":"document","verdict":"review"}}}
```

## Verify the signature

`Kontiga-Signature` is `t=<unix seconds>,v1=<hex>`, where the hex is the HMAC-SHA256 of `<t>.<raw body>` keyed with the endpoint's secret. Check that `t` is within five minutes of your clock and that one `v1` matches, comparing in constant time. During a secret's roll a delivery carries one `v1` for each secret still valid, so either one verifies.

**A verifier**

Node.js:

```typescript
import crypto from "node:crypto";

// Verify a Kontiga webhook: the raw body (bytes, before any JSON parsing),
// the Kontiga-Signature header, and your endpoint's signing secret.
export function verifyKontiga(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = header.split(",").map((p) => p.trim());
  const t = Number(parts.find((p) => p.startsWith("t="))?.slice(2));
  const signatures = parts.filter((p) => p.startsWith("v1=")).map((p) => p.slice(3));
  if (!Number.isFinite(t) || signatures.length === 0) return false;
  if (Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
  return signatures.some((s) => {
    const given = Buffer.from(s, "hex");
    return given.length === expected.length && crypto.timingSafeEqual(given, expected);
  });
}
```

Python:

```python
import hashlib
import hmac
import time


def verify_kontiga(raw_body: bytes, header: str, secret: str, tolerance_seconds: int = 300) -> bool:
    """Verify a Kontiga webhook: the raw body, the Kontiga-Signature header and the endpoint's secret."""
    parts = [p.strip() for p in header.split(",")]
    t = next((p[2:] for p in parts if p.startswith("t=")), None)
    signatures = [p[3:] for p in parts if p.startswith("v1=")]
    if t is None or not t.isdigit() or not signatures:
        return False
    if abs(time.time() - int(t)) > tolerance_seconds:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(s, expected) for s in signatures)
```

**In a server**

```typescript
import express from "express";
import { verifyKontiga } from "./verify.js";

const app = express();

// Keep the raw bytes: the signature is over them, not over parsed JSON.
app.post("/kontiga/events", express.raw({ type: "application/json" }), (req, res) => {
  if (!verifyKontiga(req.body, req.get("Kontiga-Signature") ?? "", process.env.KONTIGA_WEBHOOK_SECRET)) {
    return res.status(400).send("bad signature");
  }
  const event = JSON.parse(req.body.toString("utf8"));
  // Answer at once; do the work after. An event can arrive twice: keep its id.
  res.sendStatus(200);
  queueWork(event);
});
```

## Answer fast, and once

- Answer with a 2xx within 10 seconds, then do the work. A redirect is not followed and counts as a failure.
- An event can arrive more than once. Keep the ids you have handled (`id`, the same as `Kontiga-Event-Id`) and skip a repeat.
- Events of different objects can arrive out of order. When the order matters, read the object again with the API.

## Retries and when an endpoint is turned off

- A failed delivery is tried again with waits that double from 1 minute, at most 6 hours apart, for 72 hours. A Retry-After header longer than the wait is honoured.
- A 410 Gone turns a Kontiga endpoint off at once.
- After 72 hours of failures with no success, an endpoint is turned off and its workspace's owners, admins and developers get one email.
- Once fixed, enable it again and send what failed again with one call:

API:

```bash
curl -X POST https://api.kontiga.com/v1/webhook_endpoints/whe_0193c1a2d0017a2b8c3d4e5f60718291/recover \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "since": "2026-11-24"
  }'
```

CLI:

```bash
kontiga webhooks recover whe_0193c1a2d0017a2b8c3d4e5f60718291 \
  --since 2026-11-24
```

MCP tool `recover_webhook_deliveries`:

```json
{
  "name": "recover_webhook_deliveries",
  "arguments": {
    "endpoint_id": "whe_0193c1a2d0017a2b8c3d4e5f60718291",
    "since": "2026-11-24"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.webhooks.recover("whe_0193c1a2d0017a2b8c3d4e5f60718291", {
  since: "2026-11-24",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.webhooks.recover("whe_0193c1a2d0017a2b8c3d4e5f60718291", since="2026-11-24")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Webhooks.Recover(ctx, "whe_0193c1a2d0017a2b8c3d4e5f60718291", &kontiga.WebhooksRecoverParams{
	Since: "2026-11-24",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.webhooks().recover("whe_0193c1a2d0017a2b8c3d4e5f60718291", WebhooksRecoverParams.builder()
    .since("2026-11-24")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Webhooks.RecoverAsync("whe_0193c1a2d0017a2b8c3d4e5f60718291", new WebhooksRecoverOptions
{
    Since = "2026-11-24",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->webhooks->recover('whe_0193c1a2d0017a2b8c3d4e5f60718291', [
    'since' => '2026-11-24',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.webhooks.recover("whe_0193c1a2d0017a2b8c3d4e5f60718291", since: "2026-11-24")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .webhooks()
    .recover("whe_0193c1a2d0017a2b8c3d4e5f60718291".into(), kontiga::webhooks::RecoverParams {
        since: "2026-11-24".into(),
        ..Default::default()
    })
    .await?;
```

## Try it with the test inbox

Every workspace has a test inbox: an address on Kontiga's host that keeps the last 100 requests of 7 days, each with whether its signature verifies. Send a sample of any event to your endpoint or to the inbox; it is a real signed request, logged as a test send.

API:

```bash
curl -X POST https://api.kontiga.com/v1/webhook_endpoints/whe_0193c1a2d0017a2b8c3d4e5f60718291/test \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "document.checked",
    "target": "inbox"
  }'
```

CLI:

```bash
kontiga webhooks test whe_0193c1a2d0017a2b8c3d4e5f60718291 \
  --type document.checked \
  --target inbox
```

MCP tool `send_test_webhook`:

```json
{
  "name": "send_test_webhook",
  "arguments": {
    "endpoint_id": "whe_0193c1a2d0017a2b8c3d4e5f60718291",
    "type": "document.checked",
    "target": "inbox"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.webhooks.test("whe_0193c1a2d0017a2b8c3d4e5f60718291", {
  type: "document.checked",
  target: "inbox",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.webhooks.test(
    "whe_0193c1a2d0017a2b8c3d4e5f60718291",
    type="document.checked",
    target="inbox",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Webhooks.Test(ctx, "whe_0193c1a2d0017a2b8c3d4e5f60718291", &kontiga.WebhooksTestParams{
	Type:   "document.checked",
	Target: "inbox",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.webhooks().test("whe_0193c1a2d0017a2b8c3d4e5f60718291", WebhooksTestParams.builder()
    .type("document.checked")
    .target("inbox")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Webhooks.TestAsync("whe_0193c1a2d0017a2b8c3d4e5f60718291", new WebhooksTestOptions
{
    Type = "document.checked",
    Target = "inbox",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->webhooks->test('whe_0193c1a2d0017a2b8c3d4e5f60718291', [
    'type' => 'document.checked',
    'target' => 'inbox',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.webhooks.test(
  "whe_0193c1a2d0017a2b8c3d4e5f60718291",
  type: "document.checked",
  target: "inbox"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .webhooks()
    .test("whe_0193c1a2d0017a2b8c3d4e5f60718291".into(), kontiga::webhooks::TestParams {
        r#type: "document.checked".into(),
        target: "inbox".into(),
        ..Default::default()
    })
    .await?;
```

API:

```bash
curl -X GET https://api.kontiga.com/v1/webhook_inbox \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga webhooks inbox
```

MCP tool `get_webhook_inbox`:

```json
{
  "name": "get_webhook_inbox",
  "arguments": {}
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.webhookInbox.get();
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.webhook_inbox.get()
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.WebhookInbox.Get(ctx)
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.webhookInbox().get();
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.WebhookInbox.GetAsync();
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->webhookInbox->get();
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.webhook_inbox.get
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .webhook_inbox()
    .get()
    .await?;
```

## Roll a secret

Give an endpoint a new secret, shown once. The old one keeps verifying for the overlap you choose, none to 7 days, so you can deploy the new one without missing an event.

API:

```bash
curl -X POST https://api.kontiga.com/v1/webhook_endpoints/whe_0193c1a2d0017a2b8c3d4e5f60718291/roll_secret \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "overlap": "24h"
  }'
```

CLI:

```bash
kontiga webhooks roll-secret whe_0193c1a2d0017a2b8c3d4e5f60718291 \
  --overlap 24h
```

MCP tool `roll_webhook_secret`:

```json
{
  "name": "roll_webhook_secret",
  "arguments": {
    "endpoint_id": "whe_0193c1a2d0017a2b8c3d4e5f60718291",
    "overlap": "24h"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.webhooks.rollSecret("whe_0193c1a2d0017a2b8c3d4e5f60718291", {
  overlap: "24h",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.webhooks.roll_secret("whe_0193c1a2d0017a2b8c3d4e5f60718291", overlap="24h")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Webhooks.RollSecret(ctx, "whe_0193c1a2d0017a2b8c3d4e5f60718291", &kontiga.WebhooksRollSecretParams{
	Overlap: "24h",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.webhooks().rollSecret("whe_0193c1a2d0017a2b8c3d4e5f60718291", WebhooksRollSecretParams.builder()
    .overlap("24h")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Webhooks.RollSecretAsync("whe_0193c1a2d0017a2b8c3d4e5f60718291", new WebhooksRollSecretOptions
{
    Overlap = "24h",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->webhooks->rollSecret('whe_0193c1a2d0017a2b8c3d4e5f60718291', [
    'overlap' => '24h',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.webhooks.roll_secret("whe_0193c1a2d0017a2b8c3d4e5f60718291", overlap: "24h")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .webhooks()
    .roll_secret("whe_0193c1a2d0017a2b8c3d4e5f60718291".into(), kontiga::webhooks::RollSecretParams {
        overlap: "24h".into(),
        ..Default::default()
    })
    .await?;
```

## Compatible document webhooks

An endpoint in the compatible format gets `document.analyzed`, `document.rejected` and `document.monitoring_event` exactly as Bynn sends them: the same body with its `jwt`, the same headers and `X-Bynn-Signature`, the same retries. A new compatible endpoint takes all three. Verify a delivery with Kontiga's RSA public key, read with no credential:

API:

```bash
curl -X GET https://api.kontiga.com/v1/webhooks/public_key
```

CLI:

```bash
kontiga webhooks public-key
```

MCP tool `get_webhook_public_key`:

```json
{
  "name": "get_webhook_public_key",
  "arguments": {}
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // no key needed
const result = await kontiga.webhooks.publicKey();
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # no key needed
result = kontiga.webhooks.public_key()
```

Go:

```go
client := kontiga.NewClient() // no key needed
result, err := client.Webhooks.PublicKey(ctx)
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // no key needed
var result = kontiga.webhooks().publicKey();
```

.NET:

```csharp
var kontiga = new KontigaClient(); // no key needed
var result = await kontiga.Webhooks.PublicKeyAsync();
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // no key needed
$result = $kontiga->webhooks->publicKey();
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # no key needed
result = kontiga.webhooks.public_key
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // no key needed
let result = kontiga
    .webhooks()
    .public_key()
    .await?;
```

**Verify X-Bynn-Signature**

```typescript
import crypto from "node:crypto";

// A compatible document webhook: X-Bynn-Signature is a JWT (RS256) whose
// sha256 claim is the hex SHA-256 of the raw body. Fetch the public key from
// GET /compat/v1/webhooks/public_key (or /v1/webhooks/public_key) and cache it.
export function verifyCompatible(rawBody, signatureHeader, publicKeyPem) {
  const [header, claims, signature] = signatureHeader.split(".");
  if (!header || !claims || !signature) return false;
  const ok = crypto.verify(
    "RSA-SHA256",
    Buffer.from(`${header}.${claims}`),
    publicKeyPem,
    Buffer.from(signature, "base64url"),
  );
  if (!ok) return false;
  const { sha256, exp } = JSON.parse(Buffer.from(claims, "base64url").toString("utf8"));
  const digest = crypto.createHash("sha256").update(rawBody).digest("hex");
  return sha256 === digest && exp * 1000 > Date.now();
}
```

A client that already verifies Bynn's webhooks keeps its code: fetch the key from Kontiga's base URL once, as it fetched Bynn's. The body's `jwt` verifies with the same key, and its `data` claim is the body without `jwt`.

> **One key signs every workspace's deliveries** Check that the body's `organization.id` is your own, and keep the `jti` of each delivery you have handled so a copy sent again is skipped. For a new receiver, Kontiga's own format is signed with a secret of its endpoint alone.
