Skip to main content

Webhooks at a glance

The Talonic webhook contract on one page: HMAC-SHA256 signing, up to 4 delivery attempts, idempotent handling by delivery ID, event names, and the event feed.

Webhooks let Talonic tell your server the moment something finishes, instead of your code polling for it. Each delivery is an HTTPS POST with a JSON body, signed with your secret, retried on failure, and carrying a delivery ID you use to handle repeats safely. This page summarises the contract for developers wiring Talonic into their own systems; the linked pages carry the detail.

Subscribe

Create a webhook configuration with POST /v1/webhooks (the events:write scope, or legacy write), naming the URL and the events you want. For a single extraction you can instead pass webhook_url on POST /v1/extract. URLs must be publicly reachable HTTPS: localhost and private network addresses are refused at delivery time. See Create a webhook configuration.

Event names

Event names are dotted, stable strings. The ones most integrations use:

  • document.extracted, extraction.complete, extraction.failed: a document was read and its fields are available, or extraction failed.
  • run.completed, run.failed, run.cancelled: a Spec run from POST /v1/run or POST /v1/pipelines finished, failed or was stopped. run.completed carries records[].
  • process.completed, process.failed: a processing run from POST /v1/process finished or failed.
  • review.approved, delivery.sent, delivery.failed: a record was approved, or an outbound delivery succeeded or failed.
  • app.run.completed, app.review.raised, app.review.resolved, app.action.execute: App runs, reviews and actions.

The full list, with payloads, is on Webhook events; the machine-readable catalog is GET /v1/delivery/catalog/signals.

Signing

When the configuration has a signing secret, every delivery carries X-Talonic-Signature: sha256=<hex>, the HMAC-SHA256 of the raw request body keyed with that secret. Recompute it over the exact bytes you received, before parsing the JSON, and compare in constant time. Other headers: X-Talonic-Event (the event name), X-Talonic-Delivery (the delivery ID), User-Agent: Talonic-Webhooks/1.0. See Webhook security for sample values to test against.

Node — verify, acknowledge, then process

import crypto from 'node:crypto';
import express from 'express';

const app = express();
const seen = new Set<string>(); // use a persistent store in production

app.post('/webhooks/talonic', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('X-Talonic-Signature') ?? '';
  const expected = crypto.createHmac('sha256', process.env.TALONIC_WEBHOOK_SECRET!)
    .update(req.body).digest();
  const received = Buffer.from(header.replace(/^sha256=/, ''), 'hex');
  if (received.length !== expected.length || !crypto.timingSafeEqual(received, expected)) {
    return res.status(401).end();
  }

  const deliveryId = req.get('X-Talonic-Delivery')!;
  res.status(200).end();                 // acknowledge within 30 seconds
  if (seen.has(deliveryId)) return;      // a retry of a delivery you already handled
  seen.add(deliveryId);

  const event = JSON.parse(req.body.toString('utf8'));
  // enqueue event.event + event.data for your own processing
});

Retries and idempotent handling

A delivery succeeds when your endpoint answers 2xx within 30 seconds. Otherwise Talonic tries again, up to 4 attempts in total, roughly 2, 4 and 8 seconds apart. Redirects count as failures and are not followed. Every attempt of the same delivery carries the same X-Talonic-Delivery ID, so store the IDs you have handled and skip repeats. Acknowledge first and do the work afterwards, so slow processing never turns into a duplicate delivery. See Webhook retry policy.

Recovering missed events

The retry window is short, but events are not lost when deliveries are. GET /v1/events lists the same events newest first, filterable by event_type and since; pass after with the last ID you processed to read forward from there, and resume from next_cursor. Sweep it on a schedule to close any gap left by downtime. See Event feed.

Never act on a webhook body alone for anything that moves money or data. Fetch the run, document or record it names and act on that.

Frequently asked questions

How do I verify a Talonic webhook is genuine?+
Compute HMAC-SHA256 over the raw request body with your signing secret and compare it in constant time with the value after sha256= in X-Talonic-Signature. Do this before parsing the JSON, since re-serialising changes the bytes.
What happens if my endpoint is down?+
Talonic makes up to 4 attempts, roughly 2, 4 and 8 seconds apart, each with a 30-second timeout. After that, read GET /v1/events from the last event ID you processed to recover what you missed.
Can I receive the same webhook twice?+
Yes, a retry repeats a delivery your endpoint may already have handled. Every attempt carries the same X-Talonic-Delivery ID, so record the IDs you have processed and skip repeats.