Skip to content
TrueSealed
Guide menu · Webhooks

API guide

Webhooks

Get told when documents are issued, revoked or checked.

How it works

#
  1. An organization admin opens API and webhooks, chooses Add endpoint, and picks which events to send.
  2. When one of those events happens, we send a POST with a JSON body to the endpoint.
  3. Your server checks the signature, answers 2xx quickly, and then does its work.

Endpoints must be https addresses on the public internet. Each has its own signing secret, starting whsec_, shown on request on the same page.

Headers

Content-Type
application/json
User-Agent
TrueSealed-Webhooks/1
TrueSealed-Event
The event type, such as document.issued.
TrueSealed-Event-Id
The event id, the same on every retry.
TrueSealed-Signature
t=<unix time>,v1=<signature>

Events

#

Every event has the same envelope: id, type, created_at and data. Open one to see a full example.

document.issued A document was issued: from your organization's area, a bulk issue, a PDF upload or the API. data is the document.
document.issued
{
    "id": "evt_k3j9x0q2m8w1v7c5b4n6z2a1",
    "type": "document.issued",
    "created_at": "2026-03-01T09:30:02+00:00",
    "data": {
        "id": "rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "object": "document",
        "type": "generated",
        "status": "valid",
        "title": "Certificate in First Aid",
        "recipient_name": "Ada Lovelace",
        "recipient_email": "[email protected]",
        "fields": {
            "grade": "Distinction"
        },
        "issued_at": "2026-03-01",
        "expires_at": "2028-03-01",
        "revoked_at": null,
        "revoked_reason": null,
        "template_id": "01m7p0nr39388waqvbw0radjxa",
        "replaces": null,
        "verification_url": "https://truesealed.com/v/rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "file_sha256": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
        "created_at": "2026-03-01T09:30:00+00:00"
    }
}
document.revoked A document was revoked. data is the document, with revoked_at and revoked_reason. A correction sends document.revoked for the old document and document.issued for the new one.
document.revoked
{
    "id": "evt_k3j9x0q2m8w1v7c5b4n6z2a1",
    "type": "document.revoked",
    "created_at": "2026-03-01T09:30:02+00:00",
    "data": {
        "id": "rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "object": "document",
        "type": "generated",
        "status": "revoked",
        "title": "Certificate in First Aid",
        "recipient_name": "Ada Lovelace",
        "recipient_email": "[email protected]",
        "fields": {
            "grade": "Distinction"
        },
        "issued_at": "2026-03-01",
        "expires_at": "2028-03-01",
        "revoked_at": "2026-04-12T14:05:00+00:00",
        "revoked_reason": "Issued in error",
        "template_id": "01m7p0nr39388waqvbw0radjxa",
        "replaces": null,
        "verification_url": "https://truesealed.com/v/rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "file_sha256": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
        "created_at": "2026-03-01T09:30:00+00:00"
    }
}
document.verified Someone checked a document: by scanning its QR code, opening its link, or uploading the PDF. data is the document plus a verification object. Only the method, the result and the country are sent; nothing else about the person is ever stored or sent.
document.verified
{
    "id": "evt_k3j9x0q2m8w1v7c5b4n6z2a1",
    "type": "document.verified",
    "created_at": "2026-03-01T09:30:02+00:00",
    "data": {
        "id": "rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "object": "document",
        "type": "generated",
        "status": "valid",
        "title": "Certificate in First Aid",
        "recipient_name": "Ada Lovelace",
        "recipient_email": "[email protected]",
        "fields": {
            "grade": "Distinction"
        },
        "issued_at": "2026-03-01",
        "expires_at": "2028-03-01",
        "revoked_at": null,
        "revoked_reason": null,
        "template_id": "01m7p0nr39388waqvbw0radjxa",
        "replaces": null,
        "verification_url": "https://truesealed.com/v/rut4qvhw55lxp5zjzeduxv3qhkqkdqi2",
        "file_sha256": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
        "created_at": "2026-03-01T09:30:00+00:00",
        "verification": {
            "object": "verification",
            "method": "qr_scan",
            "result": "valid",
            "country": "LK",
            "occurred_at": "2026-03-02T08:14:27+00:00"
        }
    }
}
batch.finished A bulk issue finished. data has the counts of documents issued and rows that failed. status is completed, or failed when no row could be issued.
batch.finished
{
    "id": "evt_k3j9x0q2m8w1v7c5b4n6z2a1",
    "type": "batch.finished",
    "created_at": "2026-03-01T09:30:02+00:00",
    "data": {
        "id": "01m7temf1teydh8swh02mamqj1",
        "object": "batch",
        "title": "March graduates",
        "status": "completed",
        "total_rows": 120,
        "issued": 118,
        "failed": 2,
        "completed_at": "2026-03-01T10:02:41+00:00"
    }
}
ping Sent only when you choose Send test event, to check your receiver.
ping
{
    "id": "evt_k3j9x0q2m8w1v7c5b4n6z2a1",
    "type": "ping",
    "created_at": "2026-03-01T09:30:02+00:00",
    "data": {
        "message": "Test event from TrueSealed"
    }
}

Checking signatures

#

Anyone can send a request to your endpoint, so check every one before trusting it. The TrueSealed-Signature header holds:

  • t, the time it was signed, in seconds since 1970.
  • v1, the HMAC-SHA256 of t, a full stop, and the raw body, keyed with your endpoint's secret, in hexadecimal.

Compute the same value and compare them in constant time. Use the body exactly as it arrived, before any JSON parsing, and refuse anything signed more than five minutes ago, so an old request cannot be replayed.

A receiver that checks signatures

<?php

// $body is the raw request body, before any JSON decoding.
function truesealedSignatureIsValid(string $header, string $body, string $secret): bool
{
    parse_str(str_replace(',', '&', $header), $parts);
    $time = (int) ($parts['t'] ?? 0);
    $expected = hash_hmac('sha256', $time.'.'.$body, $secret);

    return abs(time() - $time) <= 300
        && hash_equals($expected, (string) ($parts['v1'] ?? ''));
}

$body = file_get_contents('php://input');
$header = $_SERVER['HTTP_SEALCHECK_SIGNATURE'] ?? '';

if (! truesealedSignatureIsValid($header, $body, getenv('TRUESEALED_WEBHOOK_SECRET'))) {
    http_response_code(400);
    exit;
}

$event = json_decode($body, true);
// Ignore repeats: you may already have handled $event['id'].
http_response_code(200);

Signature checker

#

Paste a request your server received to see whether it really came from us. Checked in your browser. Nothing you paste here is sent anywhere.

Answering and retries

#
  • Answer fast. Any 2xx within 10 seconds counts as received. Do slow work after answering, for example in a queue.
  • We retry. Any other answer, a timeout or a refused connection is a failure. We try again after 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours and 12 hours, then mark the delivery failed. An admin can send any delivery again from API and webhooks.
  • Expect repeats. The same event can arrive more than once. Store the ids you have handled and skip repeats.
  • Expect any order. Events can arrive out of order. Use created_at, or fetch the document, when order matters.
  • No redirects. A 3xx answer is a failure; give the final address.
  • History. Deliveries are listed on the API and webhooks page for 30 days.