The public API is centered on signed rooms: attested recall agreements between an owner and a participant.
Use an owner key (hmk_...) to create rooms, upload room agents, add room data,
and update room trust. Use an invite token from an hmroom:// link to inspect,
open, and run inside that room.
Disabled unless the operator sets HIVEMIND_SELF_SERVE_SIGNUP_ENABLED=true.
Creates a tenant owner key with $0.00 starting balance. Signup does not use
credit codes; users redeem credit codes separately after signup.
{
"name": "alice"
}Response includes the plaintext hmk_... key once:
{
"tenant_id": "t_...",
"name": "alice",
"api_key": "hmk_...",
"starter_credit_micro_usd": 0,
"balance_micro_usd": 0
}Owner-only. Returns the authenticated tenant's current balance and recent ledger entries.
Owner-only. Redeems an admin-minted credit code into an existing tenant. Credit codes are not signup codes and are never required to create the tenant.
{
"credit_code": "hmcc_..."
}Admin billing routes require Authorization: Bearer <HIVEMIND_ADMIN_KEY>.
POST /v1/admin/credit-codes: create a tracked credit code and return the plaintext code once.GET /v1/admin/credit-codes: list credit-code status without plaintext codes.POST /v1/admin/credit-codes/{code_id}/revoke: revoke an unused or active credit code.GET /v1/admin/billing: show every tenant's current balance, total credited, and total spent.GET /v1/admin/billing/ledger: show recent ledger entries across tenants.GET /v1/admin/billing/{tenant_id}: show one tenant's balance and ledger.POST /v1/admin/billing/{tenant_id}/credits: grant or debit tenant credit.GET /v1/admin/billing/prices,POST /v1/admin/billing/prices: inspect and configure provider/model prices.
Credit enforcement uses the existing HIVEMIND_BILLING_ENFORCE_CREDITS=true
switch, so operators should configure model prices before enabling it.
Admin routes require Authorization: Bearer <HIVEMIND_ADMIN_KEY>.
POST /v1/admin/tenants: create a tenant and return a one-timehmk_....GET /v1/admin/tenants: list tenants.DELETE /v1/admin/tenants/{tenant_id}: delete a tenant.POST /v1/admin/tenants/{tenant_id}/reset-key: reset a tenant key, with optional seal clearing and capability revocation.POST /v1/admin/tenants/register: adopt an existing tenant database.POST /v1/admin/rename-database: rename a tenant database through the SQL proxy admin channel.POST /v1/admin/migrate-to-roles: run the SQL-proxy role migration.POST /v1/admin/agents/sweep-broken: dry-run or delete agent registrations whose Docker images are missing after a redeploy.GET /v1/admin/llm-probe: probe configured LLM connectivity from the CVM.
Unauthenticated liveness probe. Returns {"ok": true} when the FastAPI
process is serving requests.
Authenticated service check. Returns service version and table count for a
valid owner/admin key. The CLI doctor command uses this for profile and
version checks.
Owner-only. Rotates the current tenant's hmk_... API key and returns the
plaintext replacement once.
Owner-only. Run a SQL statement against the tenant database. SELECTs return
rows; INSERT/UPDATE/DELETE/DDL are committed and return rowcount. Internal
tables (_hivemind_*, _billing_*, _credit_*, _tenants) and the
introspection schemas (information_schema, pg_catalog) are blocked at the
SQL parser. Used by the website's database browser and the bootstrap scripts
to seed tables before binding them to a room via allowed_tables.
{ "sql": "CREATE TABLE notes (id SERIAL, body TEXT)", "params": [] }{ "rows": [], "rowcount": 0 }Owner-only. List and revoke hmq_... capability tokens. Tokens are minted
implicitly when the owner creates a room — POST /v1/rooms returns the
plaintext token once, and the same lifecycle endpoints below let the owner
audit and revoke individual invites without tearing down the whole room.
GET /v1/tenant/tokens— list non-revoked tokens for the calling tenant. Returns{ "tokens": [{ "token_id", "kind", "label", "constraints", "created_at", "revoked_at" }, ...] }. No plaintext is ever returned.DELETE /v1/tenant/tokens/{token_id}— revoke a single token by itstoken_idprefix. Returns 404 if no matching live token exists.
Returns the authenticated caller role and tenant/capability identity.
Owner/query caller schema introspection for the active tenant database.
Owner compose-hash allowlist APIs used by trust tooling:
POST /v1/tenants/compose-pinGET /v1/tenants/compose-pinGET /v1/tenants/compose-pin/listDELETE /v1/tenants/compose-pin/{pin_id}
Create a signed room manifest and invite token.
{
"name": "diligence",
"rules": "Only answer aggregate questions.",
"policy": "Optional scope-agent policy text.",
"scope_agent_id": "abc123",
"query_mode": "uploadable",
"query_agent_id": null,
"query_visibility": "sealed",
"output_visibility": "querier_only",
"allowed_tables": ["watch_history"],
"egress": {
"llm_providers": ["openrouter"],
"allow_artifacts": true
},
"trust": {
"mode": "operator_updates",
"allowed_composes": []
}
}allowed_tables is always signed into the room manifest. Use an empty list, or
omit the field, for a room with no SQL table access. Obsolete manifests that are
missing this signed field are rejected at run time.
Response includes:
{
"room_id": "room_...",
"room": {"manifest": {}, "manifest_hash": "..."},
"token": "hmq_...",
"token_id": "...",
"link": "hmroom://..."
}Owner-only. Lists rooms for the authenticated tenant.
Returns owner-visible room metadata.
Returns the signed room envelope, scope-agent attestation, fixed query-agent attestation when present, and the live CVM attestation bundle. Clients should verify the room envelope against the owner public key embedded in the invite link before presenting private data or agent code.
Presents the current bearer and opens the room key in process memory. This is also performed by room data writes and room runs when needed.
Invite-token route used by clients to receive the wrapped room key after verification.
Owner-only. Adds encrypted room data.
{
"text": "private document text",
"metadata": {"source": "dataset"}
}Owner-only. Lists owner-visible room data after opening the room key.
Owner-only. Deletes a room registration.
Run the room's fixed query agent or a previously uploaded query agent allowed by
the manifest. If the room query visibility is inspectable, the plaintext
prompt is stored with the run history. If query visibility is sealed, only
the signed run attestation's prompt hash is retained.
{
"query": "What changed this month?",
"query_agent_id": "optional-for-uploadable-rooms",
"model": "optional",
"provider": "openrouter"
}Response:
{
"run_id": "...",
"query_agent_id": "...",
"scope_agent_id": "...",
"room_id": "room_...",
"status": "pending"
}Poll GET /v1/runs/{run_id}.
Upload and run a participant query agent in an uploadable room. Multipart form:
archive:.tar.gzcontaining the Dockerfile and agent source.nameprompt- optional
model,provider,memory_mb,max_llm_calls,max_tokens,timeout_seconds
The server applies the room query-agent visibility, egress allowlist, policy, output visibility, and run attestation binding.
Owner-only. Re-signs the same room with an updated deployment trust policy.
{
"mode": "owner_approved",
"allowed_composes": ["abc..."],
"append_live": true
}Owner-only. Upload a reusable scope, query, or mediator agent.
Multipart form:
archivenameagent_type:scope,query, ormediatorinspection_mode:fullorsealedprivate_paths: JSON list of archive paths excluded from public source digest
sealed agents cannot be read through the files API. Their source remains
available to internal rebuild and digest paths inside the CVM.
List room agents visible to the caller.
Return one room agent's metadata.
Returns agent config, source digests, image digest, inspection mode, and live CVM attestation.
List extracted source file paths and sizes. Sealed agents list paths but do not serve plaintext file bodies.
Fetch one inspectable source file. Sealed agents reject plaintext file reads.
Owner-only. Deletes a reusable room agent registration.
Returns run status, output when visible to the caller, artifacts when enabled, and the CVM-signed run attestation envelope.
The signed body includes the room id, room manifest hash, output visibility, allowed LLM providers, artifact setting, and output hash.
List recent runs visible to the caller.
Fetch a visible artifact for a run. Rooms allow artifact egress by default;
owners can disable it at room creation with allow_artifacts=false /
--no-artifacts.
Public dstack attestation bundle. Clients use this to verify the live CVM before presenting room data, invite tokens, or agent code.