Skip to main content

Verify Hash API

Public endpoint to verify that a document's validation hash is authentic. This endpoint does not require authentication and is designed to be called by anyone who has a document hash (e.g., printed on the document footer).

Verify Hash

GET /functions/v1/verify-hash?hash=<validation-hash>

Query Parameters

ParameterTypeRequiredDescription
hashstringYesThe SHA-256 validation hash to verify

Example Request

curl "https://<project-ref>.supabase.co/functions/v1/verify-hash?hash=a1b2c3d4e5f6789..."

Response (Verified — 200)

{
"verified": true,
"validation_hash": "a1b2c3d4e5f6789...",
"timestamp": "2026-04-13T10:00:00Z",
"rules_summary": {
"layers": [
{
"name": "Schema Validation",
"status": "passed"
},
{
"name": "Business Rules",
"status": "passed"
}
]
},
"documents_generated": ["COMMERCIAL_INVOICE", "PACKING_LIST"],
"route": {
"origin_country": "US",
"destination_country": "DE"
},
"message": "This document was validated on 4/13/2026 and has not been modified since."
}

Response (Not Found — 404)

{
"verified": false,
"message": "This hash is not recognized. The document may have been altered or the hash is invalid."
}

Response Fields

FieldTypeDescription
verifiedbooleantrue if the hash matches a known validation record
validation_hashstringThe hash that was verified (echoed back)
timestampstringISO 8601 timestamp of when validation occurred
rules_summaryobjectSummary of the validation layers and their results
documents_generatedarrayList of document types generated from this validation
route.origin_countrystringCountry of origin (ISO 3166-1 alpha-2)
route.destination_countrystringDestination country (ISO 3166-1 alpha-2)
messagestringHuman-readable verification message

Error Codes

HTTP StatusError CodeDescription
400KLV_VAL_001hash query parameter is required

Usage

The verification hash is embedded in the footer of every generated document. Recipients can verify document authenticity by:

  1. Scanning the QR code on the document (which encodes the verification URL)
  2. Visiting https://klervex.com/verify/<hash>
  3. Or calling this API endpoint directly

A verified: true response confirms that:

  • The document was generated by Klervex
  • The shipment data passed validation at the stated timestamp
  • The document has not been modified since generation