SDK Reference

Complete API reference for the BuildPaid governance platform. HMAC-SHA256 signed responses. Multi-hash provenance anchoring.

Authentication

All endpoints require a Bearer token in the Authorization header.

Authorization: Bearer bp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Governance Scan

POST /api/kernel-core

{ "action": "full_scan", "project_id": "prj_xxx" }

Response:
{
  "scan_verdict": "CLEAN | WARNING | BLOCKED",
  "contradictions": { "count": 0, "items": [] },
  "temporal": { "count": 0, "items": [] }
}

Runs contradiction detection (7 types), temporal governance (6 rules), and adequacy scoring.

Governance Compilation

POST /api/dependency-graph

{ "action": "compile_for_draw", "project_id": "prj_xxx" }

Response:
{
  "compilation": {
    "verdict_status": "READY | BLOCKED",
    "layers_executed": 6,
    "trace": [{ "engine": "pral", "layer": 4, "status": "FIRED" }],
    "evidence_available": ["pral_verdict", "adequacy_vector"]
  }
}

Capital Adequacy

POST /api/adequacy

{ "action": "project", "project_id": "prj_xxx" }

Response:
{
  "adequacy": {
    "overall": { "score": 83, "grade": "B" },
    "vector": {
      "lender":     { "score": 68, "grade": "C" },
      "contractor": { "score": 85, "grade": "B" },
      "project":    { "score": 90, "grade": "A" },
      "cashflow":   { "score": 75, "grade": "C" },
      "compliance": { "score": 92, "grade": "A" },
      "risk":       { "score": 88, "grade": "B" }
    }
  }
}

Simulation

POST /api/simulate

{ "action": "simulate_draw", "draw_id": "DRW-xxx" }

Response:
{
  "recommendation": "APPROVE | DELAY | REVIEW",
  "scenarios": [
    { "name": "Approve Now", "capital": {...}, "risk": {...} },
    { "name": "Delay 30 Days", ... },
    { "name": "Reject", ... }
  ]
}

Certification

POST /api/certification

{ "action": "issue", "project_id": "prj_xxx" }

Response:
{
  "certification": {
    "id": "CERT-xxx", "grade": "A", "score": 93,
    "badge_url": "https://app.buildpaid.ai/api/certification?action=badge&cert=CERT-xxx"
  }
}

Notarization

POST /api/notarization

{ "action": "notarize", "document_type": "LIEN_WAIVER",
  "document_id": "WAIV-xxx", "jurisdiction": "NY" }

Response:
{
  "notarization_id": "NOT-xxx",
  "multi_hash": { "sha256": "...", "sha3": "...", "blake2b": "..." }
}

Payment Execution

POST /api/payment-push

Governance-gated. Requires: FUNDABLE verdict, 3 signatures, executed waivers, notarization gate passed.

{ "draw_id": "DRW-xxx" }

Provenance Verification

POST /api/audit-verify

{ "hash": "9fb7534ad022..." }

Response: { "verdict": "AUTHENTIC" | "TAMPERED" }

Governance Rails

11 independent governance rails. Each returns posture (NOMINAL/ELEVATED/CRITICAL), score (0-100), findings, and a provenance hash.

// Scan all 11 rails at once
const response = await fetch('https://app.buildpaid.ai/api/governance-rails?action=scan_all', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { governance_posture, composite_score, rails, total_findings } = await response.json();
// governance_posture: "NOMINAL" | "ELEVATED" | "CRITICAL"
// rails: [{ name, posture, score, findings }]

// Scan a single rail
const workforce = await fetch('/api/workforce-rail').then(r => r.json());
// { rail: "WORKFORCE", posture: "CRITICAL", score: 52, findings: [...] }

// Available rails:
// /api/system-risk        — Kernel integrity, rail health, governance consistency
// /api/workforce-rail     — Labor compliance, workforce stability
// /api/schedule-rail      — Slippage, pace lag, overdue projects
// /api/safety-governance  — OSHA violations, incident tracking
// /api/insurance-rail     — COI coverage, expired certificates
// /api/environmental-rail — ESG, emissions, environmental compliance
// /api/procurement-rail   — Supply chain, material tracking
// /api/equipment-rail     — Utilization, maintenance, failure risk
// /api/weather-rail       — Climate risk, thermal scans
// /api/counterparty-rail  — Concentration risk, GC exposure
// /api/market-rail        — CO velocity, cost escalation

Governance Profiles

ProfileEnginesGatesGovernance RailsCertification Chain
Construction200+611 governance railsContractor → Architect → Lender
Treasury75ACH, Wire, SWIFT, RTPRequestor → Manager → Treasury
Insurance64ACH, WireAdjuster → Claims → Underwriter
Government76ACH, WirePM → Director → Comptroller
Supply Chain65ACH, SWIFTBuyer → Trade Finance → Bank