SDK npm package is not published yet and API environments may be unavailable.View status
Guide · Ananke Trust

Verify a document

Verify an Ananke Trust document's integrity and status. Covers both SDK and raw API approaches, result interpretation, and frontend display advice.

Use case

You have a document reference (e.g. TRF-ABCD1234) or a document file, and you want to confirm it is authentic, untampered, and currently valid.

Prerequisites

  • A document reference or the document's content hash
  • The SDK installed (optional — verification also works with plain HTTP)

Note: Verification endpoints do not require an API key. They are public by design.

1. Choose your verification input

InputWhen to use
ReferenceYou have the document reference code (e.g. from the credential itself).
HashYou have the document file and want to verify it hasn't been modified.

2. Verify by reference

SDK — Verify by reference
const result = await client.trust.verify.byReference("TRF-ABCD1234");

console.log(result.verdict);      // "valid"
console.log(result.status);       // "Active"
console.log(result.issuerName);   // "Acme Corp"
console.log(result.recipientName);// "Jane Doe"
console.log(result.issuedAt);     // "2026-03-18T10:00:00Z"
curl — Verify by reference
curl -X POST https://api.anankelabs.net/v1/trust/verify/by-reference \
  -H "Content-Type: application/json" \
  -d '{ "reference": "TRF-ABCD1234" }'

3. Verify by hash

Compute the SHA-256 hash of the document content and submit it:

SDK — Verify by hash
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";

const pdf = readFileSync("./certificate.pdf");
const hash = createHash("sha256").update(pdf).digest("hex");

const result = await client.trust.verify.byHash(hash);
console.log(result.verdict);  // "valid" | "revoked" | "not_found"

4. Interpret the result

VerdictMeaningUser action
validDocument is authentic and currently active.Show green success state with document details.
suspendedDocument is authentic but temporarily disabled.Show amber warning — document may be reinstated later.
revokedDocument is authentic but permanently invalidated.Show red error — document is no longer valid.
expiredDocument is authentic but past its expiration date.Show grey or amber state noting expiration.
not_foundNo matching document exists.Show neutral state — input may be incorrect.

5. Display the result

Map the verification result to your UI:

React component mapping
function VerificationResult({ result }) {
  switch (result.verdict) {
    case "valid":
      return (
        <div className="bg-green-50 border-green-200 p-6 rounded-lg">
          <h2>✓ Document Verified</h2>
          <p>Issued by {result.issuerName}</p>
          <p>Recipient: {result.recipientName}</p>
          <p>Issued: {new Date(result.issuedAt).toLocaleDateString()}</p>
        </div>
      );
    case "suspended":
      return (
        <div className="bg-amber-50 border-amber-200 p-6 rounded-lg">
          <h2>⚠ Document Suspended</h2>
          <p>This document has been temporarily disabled by the issuer.</p>
        </div>
      );
    case "revoked":
      return (
        <div className="bg-red-50 border-red-200 p-6 rounded-lg">
          <h2>✕ Document Revoked</h2>
          <p>This document has been permanently invalidated.</p>
        </div>
      );
    case "not_found":
      return (
        <div className="bg-neutral-50 border-neutral-200 p-6 rounded-lg">
          <h2>No Match Found</h2>
          <p>No document matching this reference was found.</p>
        </div>
      );
  }
}

Edge cases

  • Network failure — Show a loading state, then retry with exponential backoff. Never show "invalid" on network error.
  • Replaced documents — A revoked document that has been replaced may include a pointer to the new version.
  • Multiple verifications — Each verification is recorded in the verification history for the issuer's analytics.

Next steps