REST API

Base URL: https://therobot.is/api/v1 (self-hosted: your deployment's origin). All bodies are JSON; all single-entity responses are wrapped ({ "agent": … }, { "memory": … }, { "credential": … }). Every endpoint below links to a full reference page with its parameters, response fields, an example request, and its error shapes.

Authentication

Two bearer schemes, by surface:

  • Management (/api/v1/agents, credentials CRUD): your Guardian JWT from register/login — machine keys never manage agents or credentials.
  • Memory (/api/v1/memory/agents/:key/…): either the owner's/admin's JWT, or an Authorization: Bearer trm_api_… key (a trm_mk_… token works too), which is bound server-side to its one agent and cannot address any other.

Agent registry

Method / pathPurposeAuth
GET/api/v1/agentsLists the agents the caller can see: a user gets the registry's assignment for them, an admin passing all=true gets every agent.JWT
POST/api/v1/agentsRegisters a new agent owned by the caller and returns its registry record.JWT
GET/api/v1/agents/:keyReturns one agent record. The owner or a global admin sees it; everyone else — including other agents' machines — gets the same 404.JWT
PATCH/api/v1/agents/:keyUpdates an agent's display_name, description or status. agent_key is immutable and ignored if sent.JWT
PATCH/api/v1/agents/:key/ownerMoves an agent to a new owner. The only post-creation write to owner_user_id, and the one registry action reserved for global admins.Admin JWT
GET/api/v1/agents/:key/credentialsLists the agent's machine credentials — metadata only. Revoked rows are included; token hashes are never echoed.JWT
POST/api/v1/agents/:key/credentialsMints a machine credential bound to the agent. The plaintext secret rides exactly this one response and is never retrievable again.JWT
DELETE/api/v1/agents/:key/credentials/:credential_idRevokes a credential. Revocation is immediate: the next request bearing the old bearer is a flat 401.JWT

Memory surface

Reads run under the agent tenancy gate (owner, global admin, or a bound credential). Writes additionally require owner/admin standing or a writes-enabled credential.

Method / pathPurposeAuth
GET/api/v1/memory/agentsLists agents that have memory state, with memory and edge counts and the current mood bucket. Tenancy-scoped: a credential sees exactly its bound agent, a user the agents assigned to them, an admin everything.Memory token or JWT (read)
GET/api/v1/memory/agents/:agent_id/graphReturns the agent's association subgraph: without seed the whole graph at or above min_weight (node-capped, strongest salience first); with seed the ≤hops neighborhood of that memory. Only nodes owned by the agent appear, and an edge only when both endpoints do.Memory token or JWT (read)
POST/api/v1/memory/agents/:agent_id/recall/previewSide-effect-free ranked recall: semantic, emotional and relational paths are each scored, fused (reciprocal-rank fusion), and returned with per-source contributions and the curation policy's verdict per candidate. Never reinforces.Memory token or JWT (write gate)
GET/api/v1/memory/agents/:agent_id/memoriesOwner-scoped, filterable, keyset-paginated memory list. Without an explicit state, pruned tombstones are excluded and every other state (including archived) is returned; by default the agent's org's open memories are included too.Memory token or JWT (read)
GET/api/v1/memory/agents/:agent_id/memories/:memory_idReturns one memory in full detail — all authored texts, mood components and hormone snapshot, contextual metadata, lifecycle counters, Accord provenance — plus its immediate association edges.Memory token or JWT (read)
POST/api/v1/memory/agents/:agent_id/memoriesCaptures a memory for the agent through the canonical write path (the same code the MCP remember tool runs). The owner is forced to the path agent; the Guardian may quarantine a write, which comes back 202 with memory: null, not a fake success.Memory token or JWT (write gate)
PATCH/api/v1/memory/agents/:agent_id/memories/:memory_idUpdates the mutable parts of a memory: decay and pinning, authored texts and standing (title, interpretation, record class, visibility, dispute), contextual labels — and, with an explicit scope, re-files the row between agent and org ownership. Material changes append to the record's ledger.Memory token or JWT (write gate)
POST/api/v1/memory/agents/:agent_id/memories/:memory_id/reinforceStrengthens a memory with a standard-step Hebbian reinforcement — the write-side twin of what recall already does implicitly.Memory token or JWT (write gate)
POST/api/v1/memory/agents/:agent_id/memories/:memory_id/denforceWeakens a memory with a standard-step Hebbian denforcement — the deliberate opposite of reinforce.Memory token or JWT (write gate)
POST/api/v1/memory/agents/:agent_id/memories/:memory_id/archiveArchives a memory, dropping it from recall. Archived rows stay listed so a client can restore them.Memory token or JWT (write gate)
POST/api/v1/memory/agents/:agent_id/memories/:memory_id/restoreBrings an archived memory back into the active lifecycle.Memory token or JWT (write gate)
PATCH/api/v1/memory/agents/:agent_id/edges/:edge_idSets an association edge's weight (clamped 0–1) with an audit reason. Changes flow into the graph projection, including removal once the weight falls below the graph's minimum.Memory token or JWT (write gate)
GET/api/v1/memory/agents/:agent_id/moodReads the agent's current emotional state: the VAD mood, the hormone snapshot and the derived mood bucket. Returns the neutral defaults when nothing has been stored yet.Memory token or JWT (read)
PUT/api/v1/memory/agents/:agent_id/moodWrites the agent's current emotional state (VAD mood + hormone analogues) and re-derives the mood bucket from it.Memory token or JWT (write gate)
GET/api/v1/memory/agents/:agent_id/compartmentsLists the agent's access compartments, ordered by slug.Memory token or JWT (read)
POST/api/v1/memory/agents/:agent_id/explain-pathsFor each target memory, the best graph path from the source memory as a hop chain — the recalled-because surface. Every hop names its edge type, weight and node.Memory token or JWT (write gate)

Errors

  • 422 — validation, as a per-field map: { "errors": { "agent_key": ["has invalid format"] } }.
  • 404 — { "error": "not found" }. At the agent level, unknown and foreign keys are deliberately the same answer — no existence leak.
  • 403 — authorization. A write against a recall-only credential returns exactly { "error": "writes are off for this credential" }.
  • 401 — missing/invalid bearer (or revoked credential).

Pagination

Only GET …/memories is paginated (keyset): limit (default 50, cap 200) and an opaque cursor. The response carries next_cursor — pass it back verbatim; null means the last page. Orderings are total orders (id tiebreaker), so pages neither skip nor repeat rows; an unparseable cursor returns an empty page rather than restarting, so a paging client terminates.