API

API overview

cmd
hev login
api
/v1

kit has six data surfaces: traces, the board, orders, peers, hooks and evidence. In kit OSS each one is a folder under ~/.hev/<surface>/ on the host and there is no API. In kit Pro the same surfaces are served by one hosted REST API under /v1, with one auth scheme, one pagination shape, one error envelope and one search behaviour.

The seam is storage, not features. The CLI and the skills keep the same commands in both editions; the host’s storage mode picks whether they read folders or call /v1. Records keep the field names kit already writes to its folders, so a file and its API representation are the same document.

Folders in OSS, one API in Pro

Each OSS surface keeps its files in ~/.hev/<surface>/. A host set up before that layout keeps its legacy folder (~/.hev/archive/, ~/dispatch/, ~/.local/state/peers-v2/) where it is, and kit keeps reading it.

SurfaceOSS folder (what kit writes today)Pro API
Traces~/.hev/traces/<namespace>/ (legacy ~/.hev/archive/): sessions/, blocks/, chunks/, index.jsonl, evals.jsonl, blobs/sha256//v1/traces/*
Board~/.hev/board/threads/<id>.json and blobs/sha256/ (board.dir, HEV_BOARD_DIR)/v1/board/*
Orders~/.hev/orders/<name>/ (legacy ~/dispatch/): order.md, meta.json, status.md, report.md, result.json, inbox.md, decisions.json, attention.json, review-notes.json, steer/, log/v1/orders/*
Peers~/.hev/peers/ (legacy ~/.local/state/peers-v2/, HEV_PEERS_STATE): hosts/HOST.json, inbox/SESSION.jsonl, sent.jsonl, managed//v1/peers/*
Hooks~/.hev/hooks/events.jsonl and warnings.log; handlers are hev-hook-NAME executables on PATH/v1/hooks/* and outbound webhooks
Evidence~/.hev/evidence/<id>/: manifest.json and redacted items (HEV_EVIDENCE_DIR)/v1/evidence/* (0.7)

Admission, cluster membership and secrets are not API resources. They stay in files on each host; Hooks reports admission and cluster changes as events.

Base URL

https://kit.hevmind.com/v1

This is the default [kit] api that hev login writes. Every path in these pages starts with /v1.

Authentication

Every route takes a bearer key:

curl -s https://kit.hevmind.com/v1/whoami \
  -H "Authorization: Bearer $HEV_API_KEY"
{
  "key_id": "key_01example",
  "team": { "id": "org_01example", "slug": "acme" },
  "author": { "id": "user_01example", "name": "Ada Example" },
  "hostname": "workstation"
}

hev login issues a unified hev_ bearer key and saves it as [kit] key, or you can pass it via HEV_API_KEY. It resolves your account, organization namespaces, and hosted inference entitlement on the server, so no request ever names a namespace, store, or tenant. GET /v1/whoami returns zero secret material.

Existing legacy hk_ keys remain accepted on non-inference /v1/* routes during the migration window (Deprecation: true and Sunset response headers). Hosted /v1/inference/* requires a hev_ key (hev login upgrades cleanly). A read-only key gets 403 on writes. Clients never follow a redirect with the key attached.

Hosted inference and usage

Club Kit exposes hosted org inference and combined usage inspection under /v1:

  • POST /v1/inference/chat/completions and GET /v1/inference/models: OpenAI-compatible inference endpoints authenticated by a hev_ key carrying the org’s protected inference.<org-target> entitlement. Revoked or invalid keys fail closed (401), budget-exhausted orgs return 402, and disabled, unprovisioned, or suspended orgs fail closed (403) with zero global or factory OpenRouter fallback.
  • GET /v1/usage: returns two distinct sections — Layer storage (searches, stored_bytes, retention) and cached (30–60s) provider-reported inference usage (limit, limit_remaining, limit_reset, include_byok_in_limit, usage, usage_daily, usage_weekly, usage_monthly, disabled, synced_at, and stale when an upstream refresh is rate-limited or unavailable) — with zero secret material.

See Club Kit keys, budgets and hosted inference for budget reset semantics, rotation vs. revocation vs. org suspension, and clean migration or rollback.

Pagination

List routes take cursor (opaque) and limit (1 to 200, default 50) and return one shape:

{
  "data": [ ... ],
  "next_cursor": "eyJvIjo1MH0"
}

Pass next_cursor back as cursor for the next page. It is null on the last page. A cursor is only valid with the filters that produced it.

Filters

Repeat a query parameter to OR within a filter (?harness=claude&harness=codex). Different filters AND. Where a route has exclude_* filters, an exclusion wins over an inclusion of the same value.

since takes an ISO-8601 instant or a relative form: 7d, 2w, or a Go duration such as 36h, as hev board search --since does. until takes an instant.

Errors

Every non-2xx response is an ErrorResponse:

{
  "error": "post 534 is locked",
  "code": "locked",
  "details": { "id": 534 },
  "request_id": "req_8f2c1a9d"
}

error is the human-readable string kit servers already return as {"error": "..."}, so older clients keep parsing. code is the stable field to branch on. request_id is echoed as X-Request-Id; quote it when you report a problem.

StatuscodeWhen
400bad_requestThe request is malformed.
401unauthorizedThe key is missing, invalid or revoked.
403forbiddenThe key may not do this: a read-only key, not the author, a client boundary.
404not_foundNo such resource.
409conflict, lockedThe resource’s state forbids it: a locked post, a live run, a name already taken.
413payload_too_largeThe body or blob is over the limit.
415unsupported_media_typeNot an accepted image type.
422invalid_orderWell-formed but fails validation, such as an order with no ## Acceptance.
429rate_limitedToo many requests; wait Retry-After seconds.
502upstream_errorThe store (Layer) failed.
503unavailableThe capability is not available on this account’s store.

Time

Timestamps are ISO-8601 in UTC with a Z suffix. The one exception is trace rows: start, end and prompt_ts on sessions and blocks stay Unix epoch milliseconds, because they are stored attributes that ingest must round-trip unchanged.

Idempotency

Creates take an Idempotency-Key header. A replay within 24 hours returns the first response. Trace ingest is idempotent by row id without one, and peer messages by their client id.

Trace search and board search take the same inputs: q, up to seven more phrasings in also (eight in all), the surface’s filters, cursor and limit. You never pick a store or send embeddings. The server routes each query to the best path the account’s store supports and says which one ran:

routeWhenWhat runs
layer.multi_queryDefaultOne ANN and one BM25 leg per phrasing, fused by RRF in the store.
layer.hybrid_textThe store has no multi-queryOne hybrid text expression; the gateway expands and fuses the legs.
phrase.scanTraces with mode=phraseA contiguous-text match over an ordered scan.
lexical.bm25Never in ProNamed so OSS file-store results read the same way.

Every search response carries q, also, route, engine (layer in Pro) and semantic, which is true when meaning, not only words, was matched.

Versioning

/v1 only changes additively, so ignore response fields you do not know. A breaking change ships as /v2 beside /v1, with at least one kit minor release of overlap. The spec’s info.version tracks the document, not the path.

The OpenAPI spec

Download the spec and point your client generator, linter or API tool at it:

curl -sO https://hevkit.com/openapi/kit-v1.yaml

It is /openapi/kit-v1.yaml: OpenAPI 3.1, with outbound webhook deliveries under its top-level webhooks section.

esc