DocumentationCompletion webhooks

Completion webhooks

Event schema, HMAC authentication, acknowledgement and bounded retry semantics.

On this page

Completion events report terminal request state. The initial OCR POST remains synchronous; webhook delivery does not create a durable extraction queue or change admission limits. GET result retrieval is independent of webhook delivery.

Endpoint constraints

PropertyConstraint
MethodPOST.
Content typeapplication/json.
TransportHTTPS with an explicitly allowlisted public hostname.
URLNo credentials, custom port, query string or fragment.
EligibilityJobs created after the current webhook configuration; no general historical backfill.
Signing credentialFull whsec_… string, separate from X-API-Key.

Event schema

{
  "event_id": "00000000-0000-4000-8000-000000000001",
  "request_id": "00000000-0000-4000-8000-000000000002",
  "status": "succeeded",
  "expires_at": "2026-10-01T12:00:00.000Z"
}

Synthetic identifiers and timestamp are shown above.

PropertyMeaning
event_idUnique event identifier, retained across delivery attempts.
request_idOriginal OCR request identifier.
statussucceeded or failed.
expires_atOriginal result expiry; delivery does not extend it.

The payload excludes photographs, OCR fields, API credentials, provider diagnostics and result URLs. Retrieval uses GET /api/v3/ine/{request_id} with the owning API key before expiry.

Signature contract

HeaderFormat
X-INE-Event-IDSame identifier as the signed body's event_id.
X-INE-TimestampUnix seconds.
X-INE-Signaturev1= followed by 64 lowercase hexadecimal HMAC characters.

The signature is HMAC-SHA256 over timestamp + "." + rawBody. The key is the complete UTF-8 secret string, including whsec_, without base64 decoding. JSON reserialization changes the signed bytes.

Verification requires a constant-time signature comparison, a timestamp within ±300 seconds of the receiver clock and equality between header and body event identifiers. Clock drift can fail freshness validation independently of signature validity.

The Node.js verifier accepts a raw Buffer of at most 4 KiB, a Web Headers instance and the signing secret. It returns the parsed event or null; it does not persist or deduplicate events.

import { verifyWebhook } from './webhook-node.mjs';

export function authenticateDelivery(rawBody, headers, signingSecret) {
  return verifyWebhook(rawBody, headers, signingSecret);
}

Body-size enforcement during HTTP ingestion remains a receiver constraint; the verifier's size check occurs after buffering.

Acknowledgement and idempotency

A 2xx response acknowledges delivery. Durable event storage and downstream enqueueing precede acknowledgement; a unique constraint on event_id supplies deduplication. Already persisted events also receive 2xx.

The sender has a five-second timeout. A receiver persistence failure can return 503 to remain eligible for retry. OCR retrieval and downstream processing are independent of the acknowledgement deadline.

Timestamp validation does not prevent replay within its acceptance window. Persistent event_id deduplication covers delivery replay. request_id identifies the result across the initial POST response and webhook, which can independently trigger downstream handling.

Delivery policy

Delivery attempts are bounded and may be duplicated. A minute scheduler makes up to six total attempts, never beyond the result's expires_at. Nominal delays after consecutive failures are 1, 4, 16, 64 and 256 minutes, subject to scheduler execution and expiry. Delivery to an unavailable receiver is not guaranteed.

Receiver outcomeBehavior
Any 2xxDelivered.
3xxRedirect blocked; event abandoned.
4xx, except 408 and 429Event abandoned.
408, 429, 5xx, network failure or timeoutRetry while attempts and expiry permit.

A callback may follow an already completed POST. A lost acknowledgement can produce another delivery after successful receiver processing. GET remains available for a known request until expiry.

Configuration rotation or revocation cancels pending events for the previous configuration. An in-flight request may complete. Event status describes processing state, not document authenticity or identity.