API Verification Endpoints

Endpoints Overview

MethodPathAuthDescription
POST/api/verifyVerify a file hash against the blockchain
GET/api/verify/check/:hashQuick hash lookup
POST/api/verify/merkleVerify a Merkle proof independently

All verification endpoints are public — no authentication required. This is by design: anyone should be able to verify a timestamp without being a TimeProof user.

Quick Hash Check

The fastest way to check whether a hash exists on-chain:

GET /api/verify/check/:hash

Parameters

ParameterLocationDescription
hashURL pathThe SHA-256 hash to look up (64-character hex string)

Response (Found)

{
  "verified": true,
  "txHash": "0x7f8a19c3b42e...",
  "blockNumber": 54321,
  "timestamp": "2026-02-03T12:00:00Z",
  "network": "amoy"
}

Response (Not Found)

{
  "verified": false,
  "message": "Hash not found in blockchain records"
}

Use Case

This endpoint answers one question: “Was this file hash recorded on the blockchain?” It’s the fastest verification method — ideal for automated checks in CI/CD pipelines, audit scripts, or intake workflows.

Full Verification

For a more thorough verification that includes additional metadata:

POST /api/verify
Content-Type: application/json

Request Body

{
  "hash": "e3b0c44298fc1c149afbf4c8996fb924...",
  "fileName": "contract-v3.pdf"
}

Parameters

FieldTypeRequiredDescription
hashstringYesSHA-256 hash of the file
fileNamestringNoOriginal filename (for matching against records)

Response

The response includes the transaction hash, block number, anchoring timestamp, and network — everything needed to cross-reference on Polygonscan.

Merkle Proof Verification

For files that were part of a batch, verify the Merkle proof independently:

POST /api/verify/merkle
Content-Type: application/json

Request Body

{
  "fileHash": "e3b0c44298fc1c149afbf4c8996fb924...",
  "merkleRoot": "0x123...",
  "proof": ["0xabc...", "0xdef...", "0x789..."]
}

Parameters

FieldTypeRequiredDescription
fileHashstringYesSHA-256 hash of the specific file
merkleRootstringYesThe Merkle root anchored on-chain
proofarrayYesArray of proof hashes (from the certificate)

How It Works

The server walks the Merkle proof: starting from your file hash, it combines it with each proof element and hashes the pair. If the final result equals the Merkle root, the proof is valid — your file was mathematically included in the batch.

This is a pure mathematical verification. The server doesn’t look up any database records — it simply computes the proof. This means you could implement the same logic locally if you wanted complete independence from TimeProof’s server.

Response (Valid)

{
  "valid": true,
  "fileHash": "e3b0c44298fc1c149afbf4c8996fb924...",
  "merkleRoot": "0x123...",
  "message": "Merkle proof is valid"
}

Response (Invalid)

{
  "valid": false,
  "message": "Merkle proof does not match the provided root"
}

Integration Examples

Python — Verify a File

import hashlib
import requests

# Compute SHA-256
with open("contract-v3.pdf", "rb") as f:
    file_hash = hashlib.sha256(f.read()).hexdigest()

# Quick check
response = requests.get(
    f"http://localhost:5050/api/verify/check/{file_hash}"
)
result = response.json()

if result["verified"]:
    print(f"Verified! TX: {result['txHash']}")
    print(f"Anchored: {result['timestamp']}")
else:
    print("Hash not found on blockchain")

JavaScript — Verify in Node.js

import { createHash, readFileSync } from 'crypto';

const fileBuffer = readFileSync('contract-v3.pdf');
const hash = createHash('sha256').update(fileBuffer).digest('hex');

const res = await fetch(
  `http://localhost:5050/api/verify/check/${hash}`
);
const result = await res.json();

if (result.verified) {
  console.log(`Verified at block ${result.blockNumber}`);
}

Shell — Quick Verification

# Compute hash
HASH=$(sha256sum contract-v3.pdf | cut -d' ' -f1)

# Verify
curl "http://localhost:5050/api/verify/check/$HASH"

Verification Logic for Self-Implementation

If you want to verify completely independently (without calling the TimeProof API), here’s the algorithm:

  1. Compute the file’s SHA-256 hash — this is your leaf hash
  2. Get the transaction data from the blockchain — query Polygonscan or a JSON-RPC node for the transaction’s input data
  3. Decode the Merkle root from the smart contract call data
  4. Walk the Merkle proof from your certificate:
    • Start with the leaf hash
    • For each proof element, concatenate (ordered by position) and SHA-256 hash the pair
    • The final result should equal the Merkle root from the transaction
  5. Compare timestamps — the block timestamp is the provable “existed before” time

This can be implemented in any language that supports SHA-256 and HTTP requests (for blockchain queries).

Error Handling

StatusMeaningAction
200Success (check verified field)Read the response body
400Invalid hash formatEnsure hash is 64 hex characters
404Endpoint not foundCheck the URL path
500Server errorRetry after a brief delay

Use the live product for timestamping and verification.

The company site owns the technical reference. The app handles runtime workflows.