Skip to main content

Overview

Webhooks let your application receive instant notifications when a verification status changes. No polling required. When you create a verification, include a webhook_url and AnyCheck will POST a signed payload to that URL each time the status transitions.

Real-time updates

Status changes are delivered within seconds of the verification progressing.

HMAC-SHA256 signed

Every request includes a cryptographic signature so you can verify authenticity.

Per-verification

Each verification has its own webhook URL and optional secret. No global setup required.

Replay protection

Signatures include a timestamp. Reject requests older than 5 minutes to prevent replay attacks.

Registering a Webhook

Pass webhook_url (and optionally webhook_metadata.webhook_secret) when creating a verification:
The webhook_secret is used to sign outgoing payloads. Choose a random, high-entropy string (at least 32 characters). Keep it secret and never expose it in client-side code.

Webhook Events

AnyCheck sends a POST request to your webhook_url when the verification status transitions to any of the following:

Payload Structure

Every webhook delivers the following JSON body:

Security: Verifying the Signature

AnyCheck signs every webhook request with HMAC-SHA256. Two headers are included:

Verification steps

Step 1: Check the timestamp. Reject requests where the timestamp is more than 5 minutes old (or in the future by more than 5 minutes) to prevent replay attacks. Step 2: Reconstruct the signed string. Concatenate the timestamp and raw request body:
Step 3: Compute HMAC-SHA256. Use your webhook_secret as the key:
Step 4: Compare. Extract the sha256 portion from X-Webhook-Signature and compare using a constant-time equality check.

Code examples


Delivery Behavior

  • Timeout: AnyCheck waits up to 10 seconds for your endpoint to respond. If it times out or returns a non-2xx status, the delivery is considered failed.
  • No automatic retry: Failed deliveries are not retried. Design your endpoint to be idempotent and use the verification ID as a deduplication key. If you miss an event, fetch the current state via GET /verifications/{id}.
  • Async delivery: Webhooks are sent asynchronously in a background goroutine and do not block verification processing.

Best Practices

Your endpoint should return 200 OK immediately and process the payload in a background queue. If your handler takes longer than 10 seconds, AnyCheck will consider the delivery failed.
The same event may be delivered more than once in edge cases. Use verification_id + status as a deduplication key to avoid processing the same transition twice.
Skip signature verification only during local development. In production, always reject requests with an invalid or missing signature.
New event types may be added in the future. Write your handler to gracefully ignore any event value it does not recognize.
For critical use cases, pair webhooks with periodic polling (GET /verifications/{id}) to catch any missed events.