Skip to main content
V1 — RECOMMENDED MACHINE INTEGRATION SURFACE

HAIEC Assurance API & MCP

Run the canonical HAIEC Assurance workflow from AI agents, IDEs, applications, and CI systems. Machine interfaces can operate the workflow; they do not replace the deterministic Assurance engine.

API does not mean a reduced scan. The API invokes the same canonical HAIEC services as the dashboard — equivalent configuration produces an equivalent evaluation.

Integration surfaces: Assurance API v1 — recommended for programmatic integration. HAIEC Assurance MCP — available at /api/mcp (Streamable HTTP, Bearer API key); best for AI IDEs and agents. HAIEC CLI — Preview / Enterprise POC.

HAIEC Assurance MCP

Recommended for AI agents and IDEs

A bounded Streamable HTTP MCP interface over canonical HAIEC services. Use it when an AI agent should discover setup, run Assurance, retrieve evidence-bound results, guide resolution, or perform explicitly approved supported actions.

Endpoint: https://www.haiec.com/api/mcp

// Cursor: .cursor/mcp.json  (or Devin: .devin/mcp_config.json)
{
  "mcpServers": {
    "haiec": {
      "url": "https://www.haiec.com/api/mcp",
      "headers": { "Authorization": "Bearer ${env:HAIEC_API_KEY}" }
    }
  }
}

Current MCP workflow:

ASK → PREFLIGHT → RUN → UNDERSTAND → RESOLVE → RE-EVALUATE → ESTABLISH

Re-running the same source analysis does not close a gap that requires policy, IAM, deployment, identity, telemetry, or other external evidence. The agent should follow the deterministic resolution category returned by HAIEC.

Then ask your agent:

  • "Check whether HAIEC is ready to run — what setup am I missing?"
  • "Run HAIEC Assurance."
  • "What did HAIEC establish? What remains unknown?"
  • "What evidence is missing?"
  • "Explain the highest-consequence action paths."
  • "Use these logs as evidence — with my approval — and rerun HAIEC."
  • "What would resolve the open verification items?"
  • "This test endpoint is mine — run a runtime safety preflight."
  • "Start a HAIEC investigation" / "this is my first evidence" / "start collecting the next state."
  • "Continue my HAIEC investigation" — the agent rediscovers the persisted investigation; no IDs to remember.
  • "What changed?" / "Where does the proof stop?"

Investigations are persisted evidence timelines over user-declared states. The agent translates ordinary language into the explicit scenario binding, lists prior investigations on return (haiec_list_investigations), prepares scenario-bound live capture, and selects typed intake profiles (kpi, alarm, api_transaction, telecom profiles) that reuse the same canonical mappers as the REST intake routes. An investigation records received evidence — it is not an Assurance disposition.

MCP can perform supported AI System and source setup actions after explicit user approval. Third-party authorization such as GitHub App installation may still require a browser handoff. HAIEC never treats a caller-supplied repository URL or token as proof of trusted source authority.

Runtime testing is optional. HAIEC first performs a read-only runtime safety preflight. Execution requires explicit user authorization and confirmation, and unsupported or unproven-safe categories remain HELD.

Evidence ingestion stores qualified input for later Evaluation. An ingestion receipt does not mean an Assurance gap has been resolved.

Every MCP tool delegates to the canonical Assurance API boundary — same organization scope, same key scopes, same rate limits. MCP never accepts GitHub tokens or organization overrides. See Agent Integration.

How it works

Assurance runs are asynchronous: a full source scan, evidence collection, and evaluation takes minutes, not milliseconds. POST /assurance/runs therefore returns a runId immediately (HTTP 202). You poll the run status until an evaluationId appears, then retrieve the summary, report, and passport.

POST run → runIdpoll → evaluationIdGET summary / report / passport
Recommended

Connected GitHub — full remote coverage

One setup, then any client can trigger the full remote scan: your IDE, a terminal, CI orchestration, or a server application. GitHub repository credentials stay server-side between HAIEC and the GitHub App.

  1. 1Install the GitHub App and select the repositories you authorize
  2. 2Connect the repository to an AI System — a verified SOURCE_REPOSITORY asset
  3. 3Generate an Assurance API key
  4. 4Add server-side environment variables (HAIEC_API_KEY, HAIEC_AI_SYSTEM_ID, HAIEC_SOURCE_ASSET_ID)
  5. 5Run from your IDE or application via POST /api/v1/assurance/runs
  6. 6Open the Evaluation in the Dashboard — same canonical result as a dashboard run

Other analysis paths

Local / IDE PREVIEW

Source stays on your machine; the local scanner submits qualified evidence. Coverage is bounded relative to the remote stack — an Enterprise POC distribution.

Local / IDE guide

CI/CD PREVIEW / ENTERPRISE POC

Run the supported local scanner in your CI runner, submit the qualified build evidence with scan:submit, then start the same Assurance Run. GitHub Action v2 is staged pending the local distribution decision.

Runtime endpoint

Behavioral/runtime testing against a reachable endpoint — no source repository required.

Every supported path converges into the same persisted Assurance Evaluation, report, and Passport — but analyzer coverage differs by source mode. Unavailable evidence is recorded as a limitation, never as PASS.

How to use the API

1.Create an API key

In the dashboard: Settings → Developer → API Keys → create an Assurance key. The secret is shown once — copy it and store it as an environment variable. Never place it in frontend or browser code.

HAIEC_API_KEY=haiec_live_xxx

Assurance keys carry scan:submit scan:create scan:read report:read system:read source:read — the minimum needed for local/IDE submission plus remote-source runs.

2.Select an AI System

Evaluations are system-bound. In the dashboard: AI Inventory → select your system and copy its aiSystemId — or discover systems via API (GET /api/v1/systems, scope system:read).

3.Confirm an evaluation source

In the dashboard: AI System → Connected Assets. Source repositories move through REGISTERED → CONNECTED → VERIFIED — only VERIFIED sources are eligible for fresh scans. Copy the sourceAssetId and default branch, or list them via GET /api/v1/systems/{systemId}/evaluation-sources.

4.Start an assurance run

curl -X POST https://www.haiec.com/api/v1/assurance/runs \
  -H "Authorization: Bearer $HAIEC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: build-$BUILD_ID" \
  -d '{
    "aiSystemId": "SYSTEM_ID",
    "engines": {
      "static": {
        "enabled": true,
        "executionMode": "api",
        "sourceAssetId": "SOURCE_ASSET_ID",
        "branch": "main"
      }
    }
  }'

# 202 Accepted
# { "runId": "run_…", "status": "CREATED", "links": { "self": "…" }, … }

5.Poll the run

curl -H "Authorization: Bearer $HAIEC_API_KEY" \
  https://www.haiec.com/api/v1/assurance/runs/RUN_ID

Poll every 10–30s with a bounded retry budget. status progresses through the engine chain; stage shows the current engine. When the pipeline completes, evaluation.evaluationId appears and links populate. A failed run reports a structured failure object — it is never silently absent.

6.Retrieve results

curl -H "Authorization: Bearer $HAIEC_API_KEY" \
  https://www.haiec.com/api/v1/assurance/evaluations/EVAL_ID/summary
curl -H "Authorization: Bearer $HAIEC_API_KEY" \
  https://www.haiec.com/api/v1/assurance/evaluations/EVAL_ID/report
curl -H "Authorization: Bearer $HAIEC_API_KEY" \
  https://www.haiec.com/api/v1/assurance/evaluations/EVAL_ID/passport

Summary — compact result for application logic. Report — full evidence-bearing assurance output. Passport — portable machine-readable artifact for the exact evaluation. The disposition (ALLOW / REVIEW / BLOCK) is bounded to the evaluated scope and available evidence — it is not a certification.

Endpoint reference

MethodPathScope
POST/api/v1/assurance/runsscan:create
GET/api/v1/assurance/runsscan:read
GET/api/v1/assurance/runs/{runId}scan:read
GET/api/v1/assurance/evaluations/{evaluationId}/summaryreport:read
GET/api/v1/assurance/evaluations/{evaluationId}/reportreport:read
GET/api/v1/assurance/evaluations/{evaluationId}/agent-auditreport:read
GET/api/v1/assurance/evaluations/{evaluationId}/passportreport:read
GET/api/v1/evidence/binderssource:read
POST/api/ingest/structured · /api/ingest/log · /api/otlp/v1/*evidence:ingest
POST/api/v1/scansscan:submit
GET/api/v1/scans/{scanId}scan:read
GET/api/v1/assurance/evaluations/{evaluationId}/master-reportreport:read
GET/api/v1/assurance/evaluations/{evaluationId}/master-report/pdfreport:read
GET/api/v1/assurance/evaluations/{evaluationId}/report/pdfreport:read
GET/api/v1/systemssystem:read
GET/api/v1/systems/{systemId}/evaluation-sourcessource:read

Authentication: Authorization: Bearer haiec_live_…. Missing/invalid key → 401; missing scope → 403; cross-organization resources → 404 (non-enumerating). Errors are machine-readable: { "error": { "code", "message", "retryable" } }. OpenAPI: /openapi/assurance-v1.yaml. Agent/machine discovery: /.well-known/haiec-capabilities.json.

API objects

AI System

The customer-defined system being evaluated. Every assurance run and evaluation is bound to exactly one AI System.

Source Asset

A verified source repository bound to the AI System. Only VERIFIED, system-bound sources are eligible for fresh source scans. REPOSITORY_URL ≠ AI_SYSTEM_BINDING.

Assurance Run

The asynchronous execution that coordinates the configured engines (static, runtime, wizard) for one AI System.

Assurance Evaluation

The exact persisted evaluation produced by a run. Report artifacts are read from this record — never recomputed.

Disposition

HAIEC’s bounded conclusion — ALLOW / REVIEW / BLOCK — valid only within the evaluated scope and available evidence. UNKNOWN is never promoted to PASS.

Passport

Portable machine-readable representation of the exact evaluation and its assurance lineage.

Dashboard vs API

Dashboard — human-driven

  • Configure AI Systems and source assets
  • Verify repositories and grant consent
  • Run scans manually and inspect evidence visually
  • Review reports, PDFs, and verification links

API — machine-driven

  • CI/CD pipelines and product integrations
  • Scheduled or event-triggered scans
  • Polling and structured result retrieval
  • Same canonical pipeline — API_SCAN == DASHBOARD_SCAN

Examples

TypeScript

const res = await fetch("https://www.haiec.com/api/v1/assurance/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.HAIEC_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": buildId,
  },
  body: JSON.stringify({
    aiSystemId: process.env.HAIEC_AI_SYSTEM_ID,
    engines: { static: { enabled: true, executionMode: "api",
      sourceAssetId: process.env.HAIEC_SOURCE_ASSET_ID, branch: "main" } },
  }),
});
if (!res.ok) throw new Error((await res.json()).error.code);
const { runId } = await res.json();

// Poll with bounded retries (e.g. every 15s, up to ~20 min)
const run = await fetch(`${base}/api/v1/assurance/runs/${runId}`,
  { headers: { Authorization: `Bearer ${key}` } }).then(r => r.json());
const evalId = run.evaluation?.evaluationId; // then GET summary/report/passport

Python

import os, time, requests

BASE = "https://www.haiec.com"
H = {"Authorization": f"Bearer {os.environ['HAIEC_API_KEY']}"}

r = requests.post(f"{BASE}/api/v1/assurance/runs", headers={**H,
    "Idempotency-Key": build_id}, json={
    "aiSystemId": os.environ["HAIEC_AI_SYSTEM_ID"],
    "engines": {"static": {"enabled": True, "executionMode": "api",
        "sourceAssetId": os.environ["HAIEC_SOURCE_ASSET_ID"],
        "branch": "main"}},
})
r.raise_for_status()
run_id = r.json()["runId"]

for _ in range(80):                      # ~20 min at 15s intervals
    run = requests.get(f"{BASE}/api/v1/assurance/runs/{run_id}",
                       headers=H).json()
    if run["evaluation"]:
        break
    if run["failure"]:
        raise SystemExit(run["failure"]["message"])
    time.sleep(15)

eval_id = run["evaluation"]["evaluationId"]
summary = requests.get(
    f"{BASE}/api/v1/assurance/evaluations/{eval_id}/summary",
    headers=H).json()

Current limits

  • Private repositories: consent records are user-bound — API-key fresh scans on private repos return CONSENT_REQUIRED. Use the dashboard to grant consent, or use ci-attached mode to bind evidence your CI produced.
  • Provisioning: AI Systems and source verification are configured in the dashboard — the API exposes read-only discovery (GET /api/v1/systems*).
  • Connected GitHub: remote runs require a CONNECTED + VERIFIED Source Asset backed by an active organization-linked GitHub App installation. API keys alone do not grant repository access.
  • Webhooks: not yet available — poll run status (Phase 2).
  • Report PDF: the Master Report PDF is available over Bearer at /api/v1/assurance/evaluations/{evaluationId}/master-report/pdf; the secondary Assurance Evidence PDF remains at .../report/pdf — both with report:read.
  • Rate limits: run creation is limited per API key (429 + Retry-After on excess); orchestrator concurrency limits remain authoritative.

Get started

Create an Assurance key, pick an AI System, and follow the six steps above — or the end-to-end quickstart and full API guide.

Manage API Keys

Related SDKs

PILOT

@haiec/openai

OpenAI SDK wrapper — usage and cost instrumentation for AI Inventory. Not a scanner.

npm install @haiec/openai
View Documentation
PILOT

@haiec/anthropic

Anthropic SDK wrapper — usage and cost instrumentation for AI Inventory. Not a scanner.

npm install @haiec/anthropic
View Documentation