# API Driver

Bundled HTTP-shape verify-proof driver for JSON-API regression tests.
Uses Node 18+ built-in `fetch` — no external dependencies.

## When Aperant picks this driver

`/apt:verify-proof` auto-selects `api` when:

- The project exposes HTTP endpoints (Express/Fastify/Hono/Next-API).
- The required IDL capabilities are: `execute_js`, `assert_network`,
  `assert_output`, `assert_text`, `capture_logs`.

## Capabilities

| IDL verb | Behavior |
|----------|----------|
| `execute_js` | Evaluate a request-builder snippet (e.g. compute headers) |
| `assert_network` | Assert HTTP endpoint returns expected status/body |
| `assert_output` | Match pattern against captured response body |
| `assert_text` | Match pattern against any captured text artifact |
| `capture_logs` | Append request/response pairs to evidence file |

## Manifest

- **Priority:** 50 (below cli=60 — API tests are more specific).
- **Stability:** `ga`.
- **Trust:** `first_party_signed`.
- **Network posture:** `allowlist`. The allowlist is enforced at the
  workflow-runner layer (fetch wrapper consults
  `.aperant/config.json:verification.api.allowlist[]`).
- **Sandbox profile:** `read_only` — the driver doesn't write to the
  workspace; only emits evidence files under `proof_dir/`.
- **Transport:** `{ builtin: true }`.

## V1 scope — adapter is thin

`driver.mjs` is a v1 manifest-conformant adapter shim — each verb
validates its args and returns a VerbResult stub. Direct-dispatch via
`fetch` lands in `verify-proof-driver-transport-wiring-v2` (follow-up).
