Skip to main content
The self-hosted deployment exposes the same HTTP surface as the managed Platform — it is the identical v2-agent-state function, just running on your Supabase project. Point a client at your own base URL and everything below behaves identically.
This is a replication API — it stores and serves encrypted snapshots and replication blocks. It is not a memory-extraction API. There are no /memories routes, no message-array ingestion, and no server-side search: embedding and semantic recall happen entirely on-device. See store_memory for where that actually lives.

Base URL

The function strips both the v2-agent-state function-name prefix and an optional /v2 prefix, so /snapshot and /v2/snapshot are equivalent. Older clients that send the /v2 form continue to work.

Authentication

Every route below requires a bearer token. There is no AUTH_DISABLED mode.
Routes fall into three auth classes:

Replication routes

These are the routes the SDKs use. All are API-key authenticated and subject to the trial gate.

Write a snapshot

  • POST /snapshot
Body is the sealed envelope — see POST /snapshot for the full field reference.

Restore

  • GET /snapshot/:agent_id/latest — most recent snapshot for an agent
  • GET /snapshot/:agent_id/:sequence — a specific point in history
  • GET /snapshot/:agent_id/lineage?limit=100 — the parent chain (default limit 100)

Differential replication

  • POST /replicate — push encrypted replication blocks
  • GET /head — latest confirmed sequence number and Merkle root
  • GET /replay?since=N — stream replication log from a sequence number

Layer-A reads (server-blind metadata)

  • GET /metadata — usage aggregates: envelope counts, byte totals, device count
  • GET /envelopes — paginated ciphertext envelope list

Dashboard and account routes

These exist on the same function but are authenticated by session JWT, not API key. They are used by the dashboard rather than the SDKs.

Team and enterprise routes

Cron and lifecycle routes

Authenticated by a cron secret, not a user token:
  • POST /retention/purge — daily retention sweep
  • POST /lifecycle/dispatch — lifecycle email sweep
  • POST /invitations/accept — accept an invitation (unauthenticated or session-authed)
  • POST /marketing/capture, POST /marketing/unsubscribe — marketing capture and unsubscribe

Errors

Unmatched paths return:
Errors use a consistent envelope: { "error": "<code>", ...details } with the appropriate HTTP status. See Errors for the full code reference.