API Reference

API Documentation

Integrate the VeriTrust Zero-Knowledge protocol directly into your ERP or backend systems.

POST/api/sign

Sign PDF Document

Hashes and signs a raw PDF with ECDSA secp256k1, injecting the metadata back into the file.

Request Example
curl -X POST "http://localhost:8000/api/sign" \
  -F "file=@document.pdf" \
  -F "private_key_hex_str=YOUR_HEX_KEY" \
  -F "issuer_name=VeriTrust Corp"
Response Format
// Returns application/pdf binary
// Headers included:
X-VeriTrust-Hash: "a3f8c..."
X-VeriTrust-Signature: "304402..."
X-VeriTrust-PublicKey: "04a1b..."
POST/api/premium/issue/json

Zero-PDF Headless Sign

Signs a structured JSON payload for headless API-to-API transmission.

Request Example
curl -X POST "http://localhost:8000/api/premium/issue/json" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {"name": "John", "status": "verified"},
    "private_key_hex": "YOUR_HEX_KEY",
    "issuer_name": "API Corp"
  }'
Response Format
{
  "data": { "name": "John", "status": "verified" },
  "veritrust_metadata": {
    "version": "1.0",
    "hash": "...",
    "signature": "...",
    "public_key": "...",
    "issuerName": "API Corp"
  }
}
POST/api/analyze

AI Anomaly Detection

Scans a PDF for structural anomalies (missing dates, short content) before signing.

Request Example
curl -X POST "http://localhost:8000/api/analyze" \
  -F "file=@document.pdf"
Response Format
{
  "status": "warning",
  "warnings": [
    {
      "code": "MISSING_DATES",
      "message": "No temporal markers found.",
      "severity": "WARNING"
    }
  ]
}
POST/api/registry/register

Register Public Key

Registers an institution's public key in the central ledger for verification lookups.

Request Example
curl -X POST "http://localhost:8000/api/registry/register" \
  -H "Content-Type: application/json" \
  -d '{
    "public_key": "04a1b2c...",
    "institution_name": "National University"
  }'
Response Format
{
  "status": "success",
  "message": "Key registered for National University"
}