Skip to content

Network API

Crate open/crates/oliviadb-server, binary oliviadb-server --config FILE: agent memory over HTTPS, REST/JSON with server-sent events for watches. Enterprise binary oliviadb-agent-server (crate oliviadb-enterprise/crates/oliviadb-agent-server) adds the replica's databases as layer-1 data under agent PSBs. Contract: [spec/oliviadb-api.openapi.json] (../spec/oliviadb-api.openapi.json) (OpenAPI 3.1, Apache-2.0), generated from the MCP tool catalogue, so request bodies are exactly the MCP tools' arguments and responses their structured results (a test fails when the file is stale).

One implementation, two transports

Each request is authenticated, becomes a session of the caller's identity over the process's shared core (oliviadb_mcp::Core: memory, the handle sealing key, watches, packs, confirmation nonces) and calls the same tool code as tools/call (oliviadb_mcp::Server::call_tool). Policies, masks, sealed handles (bound to the principal), the injection guard and the erasure step-up are the MCP server's. A Provider decides what a session sees besides memory: oliviadb-agent-server attaches the agent view of the principal's agent PSB with the caller's user attributes (views cached per principal and attributes).

Routes

route tool / meaning profile (scope)
POST /v1/memory/remember memory_remember (Idempotency-Key = step id when the body has none) memory
POST /v1/memory/recall memory_recall (valid_at, known_at, min_ts) read
POST /v1/memory/expand memory_expand read
POST /v1/memory/feedback memory_feedback memory
POST /v1/memory/facts, /facts/retract memory_assert, memory_retract memory
POST /v1/memory/consolidate memory_consolidate admin
POST /v1/admin/subjects/export, /erase export; erase: 202 with the confirmation URL and request_state, repeated after approval (purge: the recall index's purge after it) admin
POST /v1/admin/memory/index/purge memory_index_purge: flush and full compaction of the memory trees (spec memory-index.md, "Erasure") admin
POST /v1/state/put, /append, /delete, /get, /list, /namespaces, /search agent state: namespaced JSON documents (state_* tools) memory (writes) / read
GET /v1/path?p= the path language (memory and layer 1, ?as_of=, pages) read
GET /v1/data/catalog, POST /v1/data/recall layer-1 catalog and search read
POST /v1/watches, GET /v1/watches/{id}, GET /v1/watches/{id}/events watches; events as SSE (id: position, resume with Last-Event-ID) memory / read
GET /v1/changes?path=&from=&limit= the change stream (CDC) of layer 1, of native aggregates or of agent memory (path=MEMORY) under the paths: a JSON batch, or SSE with Accept: text/event-stream (id: position, resume with Last-Event-ID); see "Change stream" read
GET /v1/aggregates/<path> native aggregates: a node, a listing (limit, after, prefix), ?as_of=, ?tree=true; see "Native aggregates" read
POST, PATCH, DELETE /v1/aggregates/<path>, POST /v1/txn native aggregates: insert, update, delete, several writes as one transaction memory
GET /v1/lookup/<index>, POST /v1/search/<aggregate> native aggregates: entry through a declared index; ranked text within a token budget read
POST /v1/admin/aggregates/erase native aggregates: erase a data subject (crypto-shredding) admin
GET /v1/dli/<path> DL/I databases, read only: a segment (DBD/SEG/key/...), ?tree=true, a listing (limit, after); see "DL/I databases" read
POST /mcp MCP over HTTP (Streamable HTTP, revision 2026-07-28; docs/mcp.md) as the tool called
GET /v1/admin/stats, /v1/admin/check operator reports: the server's own storage (each tree of memory, agent state and native aggregates: counters, last version, write freeze; the storage check of oliviadb check, same JSON shape, code storage; src/reports.rs), or the provider's when it has them (oliviadb-agent-server: the replica's statistics and integrity check) admin
GET /console the read-only web console's page and script (no data; docs/docker.md) unauthenticated
GET /healthz, /readyz, /metrics, /v1/openapi.json unauthenticated –

Integers above 2^53 - 1 (transaction times such as wts, fact ids, cursors) are sent as decimal strings in results: a client whose numbers are doubles (JavaScript) would round them, and a rounded min_ts names another time. Arguments that take such a value (min_ts, known_at, valid_at, fact_id, expected_version) accept a number or the string; the schema types them ["integer", "string"]. The clients pass them through: the TypeScript client's U64 (number, string or bigint, a bigint sent as a string; u64() gives the exact bigint), Python's int(x), Java's JsonNode.asLong().

High availability (docs/ha.md, "Network API on the nodes"): each node of an HA pair listens; only the primary serves, the other answers 503 (retryable, naming the primary). The clients take every node's URL (OliviaDbClient(["https://a:8443", "https://b:8443"], ...), baseUrl: [..], OliviaDbClient.builder(List.of(..))) and follow the primary by themselves.

Errors: application/problem+json (RFC 9457) with retryable; 401 unauthenticated, 403 tool not granted or confirmation missing, 404 not found or not visible (the same), 409 version conflict, 412 not yet visible, 413 body over 1 MiB, 422 invalid, 429 over the quota, 503 unavailable, 504 outcome unknown. Data responses carry Cache-Control: private, no-store.

retryable: true (with Retry-After) means sending the same request again, here after Retry-After or to the node the answer names, cannot apply it twice: on 429 and 503 the request was not done. Every other answer is not retryable, except the one below for REMEMBER. In particular a write the node has committed but could not confirm (its standby did not acknowledge it within t_sync, the node lost the primary role before the standby did, or its own log sync failed after the commit) is answered 504 with type .../problems/outcome-unknown, retryable: false and version, the version the write is in on that node (a number, or a decimal string above 2^53 - 1). Whether the write survives a failover is not known yet: the client reads before it decides (the write is visible once the standby holds it; after a failover it is there or not). Sending it again blindly can apply it twice: an insert sent again conflicts (409), an increment would count twice. The clients (below) retry only what is retryable, so they do not resend a 504 by themselves. The exception is REMEMBER (/v1/memory/remember), idempotent per step_id: its 504 is retryable: true, since the same step sent again replays the first call's result (once its writes are confirmed) instead of writing the episode twice.

Authentication

  • OAuth 2.1 bearer JWTs: RS256, PS256, ES256, EdDSA against the issuer's JWKS; iss, aud (this server's resource indicator, RFC 8707), exp, nbf (60 s leeway); alg: none and critical headers refused. Token exchange (RFC 8693): act.sub is the agent (principal), sub the user; configured claims become user attributes for row predicates; scopes oliviadb.read, oliviadb.memory, oliviadb.admin become profiles; tenant from a configured claim.
  • API keys (development, Mem0-style clients): Authorization: Bearer <key> or Token <key>, configured as SHA-256 digests (oliviadb-server --hash-key) with a fixed identity, compared in constant time.
  • TLS 1.3 only (rustls); plain HTTP is refused unless the listener is on loopback.
  • A credential that does not authenticate is answered (401) after a back-off per client address: 100 ms, doubling per further failure up to 5 s, forgotten after 10 minutes without one (shared with the native protocol's listener).
  • Audit: one JSON line per request (identity, user, method, route, status, traceparent, which is echoed).

Change stream (CDC)

GET /v1/changes streams the changes of operational data (layer 1) under one or more paths (path= repeated; paths of the path language, as for watches), after from (start, now (the default), or a record's position). Each record is one change the source applied, as the caller sees it:

{"key": "5da67ffa22c5b6d5771cbcc2b3bbca59", "position": "cdc_...", "collection": "CUSTDB",
 "path": "CUSTDB/CUST=C001", "type": "CUST", "op": "replace", "version": 4711,
 "source_time": 13, "before": {"CNO": "C001", "BAL": "12550"},
 "after": {"CNO": "C001", "BAL": "12345"}, "layout": "sha256:..."}
  • Decoded by the writer's layout. before and after are the node's versions before and after the change, each decoded by the layout its writer recorded (or the default valid when it was written); layout is the registry id of the version shown last (spec/schema.md 4.3).
  • Masked per consumer. The fields are rendered under the caller's agent policy (rows, masks, personal-data class) and, with access profiles, under its profile: every path needs a watch grant, and except takes fields out. A change the caller cannot see (another branch's record, only a masked or hidden field changed) is not reported. A twin without a unique key is reported at its listing path with "occurrence_unknown": true and no fields.
  • At least once, with an idempotency key. key is the same for the same change on every copy of the source; a consumer stores position after it has processed a record and drops a record whose key it has seen. position is a source time and an ordinal among the changes of that source time, sealed with the installation's key: it means the same on the primary and on the standby (each applies the same IMS change stream), so a consumer resumes on the standby after a failover (SSE: reconnect with Last-Event-ID).
  • File sink. "cdc_sinks" in the configuration ({"tenant", "principal", "paths", "file", "from", "interval_ms"}) appends records as JSON lines to file and keeps the position in file.position, written (synced, renamed) only after the lines are synced: after a crash the sink repeats at most the records it had not made durable, with the same keys.

  • Native aggregates. Paths of /v1/aggregates (* for any key: Customer/*/Account) stream the changes of native aggregates (alone, not with layer-1 paths): {"key", "position", "collection", "path", "type", "node_key", "op", "version", "before", "after", "layout"}, the fields typed as reads show them, each side decoded by its writer's layout, the change under the path and what is under it, under the caller's profile (a watch grant on every path; fields, rows and masks as for reads; a change only hidden fields made is not reported). Positions are agg_<version>[_<ordinal>] (after a whole commit, or after one of its records), the same on both copies of an HA pair (the journal record ships with the commit), and key is the same for the same change on both.

  • Agent memory. path=MEMORY (alone) streams agent memory instead (Memory::changes_as): the claims and episodes each commit of the durable tree wrote, changed or deleted, as the caller's viewer and policy see them now: {"key", "position", "kind": "claim"|"episode", "op": "insert"|"replace"|"delete", "id", "version", "attr", "text", "status", "valid_from", "valid_to"}. A consumer keeps the latest record per id; a delete (an erasure: the subject's key is destroyed, nothing of the record can be shown) carries only the id. Positions are mem_<version>, the same on both HA copies (the journal record ships with the commit). Session and scratch records are not streamed; positions older than the kept history (history_ms, CONSOLIDATE) are refused. Memory is outside access profiles.

Tests: open/crates/oliviadb-memory/tests/operational.rs (change_stream), open/crates/oliviadb-memory/tests/changes.rs, open/crates/oliviadb-server/tests/native.rs (change_stream_decoded_by_layout_and_masked), open/crates/oliviadb-server/tests/http.rs (memory_change_stream_over_http), oliviadb-enterprise/crates/oliviadb-agent/tests/cdc.rs, oliviadb-enterprise/crates/oliviadb-agent-server/tests/cdc_http.rs (SSE and the file sink failing over to the standby).

Native aggregates

With a schema ("schema" in the configuration), oliviadb-server and the nodes of a high-availability pair (oliviadb-ha-node --memory --serve) serve the schema's aggregates natively: the data lives in the server, written and read over this API, under the callers' access profiles (spec/schema.md 6). Code: open/crates/oliviadb-server/src/native.rs.

  • Paths alternate keys and types after the aggregate, as grants are written: /v1/aggregates/Customer/C1/Account/A1. A key of several parts is its parts separated by commas, each percent-encoded (Txn/2026-01-02T03:04:05Z,1); a path that ends with a key names one node, one that ends with the aggregate or a type lists nodes.
  • Twins. A node type with duplicate keys or without a key (ordered) orders its twins by an ordinal (spec/path-keys.md): a path names a twin by <key>~<ordinal in hexadecimal> (its identity, as reads return it) or <key>@<n> (the n-th twin with that key now, from 0); an unkeyed type's level is ~<ordinal> or @<n> alone. An insert of a path without ~ (or of a path ending with an unkeyed type) adds a twin: at the end ("position": "last", the default), at the start ("first"), or {"before": <level>} / {"after": <level>} a named twin of the same key. A listing gives twins in key order, equal keys in ordinal order.
  • Reads. GET a node: {"path", "type", "key", "fields", "layout", "version"}; ?tree=true adds its subtree (children by type, each listing the profile must grant; at most 1000 nodes); &each=N (1 to 1000) keeps the first N children of every listing in the subtree, in key order (a customer with its accounts and each account's newest 100 transactions is one request: ?tree=true&each=100). GET a listing: {"nodes", "next", "version"} in key order (descending key parts reversed), limit (1 to 1000, default 100, within the grant's limit), after (the next of the previous page), prefix (the first key parts), to (through these first key parts: the listing ends before the first node whose first key parts sort after them in listing order, so after and to together read a key range, a week of transactions for instance). ?as_of=<version> reads as of a version when the profile says as_of allowed.
  • Values are shown as oliviadb_schema::codec decodes them: strings without their padding, decimals as strings at their scale ("100.50"), dates YYYY-MM-DD, timestamps YYYY-MM-DDTHH:MM:SS.ffffffZ, bytes in hexadecimal, enum members by name, integers as numbers (beyond 2^53 - 1 as strings), versions likewise. Writes take the same forms (decimals also as JSON numbers, read without rounding; timestamps with an offset).
  • References. A ref field holds its target's levels below where the reference starts (ref Merchant: the merchant's key; ref ../Account: the account's key under the same customer; levels separated by /, a twin by ~<ordinal>), or "" for none. A write checks that the target exists (422 otherwise) and stores the value in its canonical form. When a node goes (with its subtree), every node that refers to it is found through a reference index in the same transaction and its field's on delete rule applies: restrict (the default) refuses the delete (409, naming the referrer), cascade deletes the referrer with its subtree, keep leaves it (the reference then names nothing). A cascade into another aggregate record counts for the transaction scope (403 under txn scope aggregate).
  • Indexes. A declared index on a type of a native aggregate has an entry per node (its parts, typed and ordered as declared, a reference by its text). A synchronous one is written in the writing transaction, and a unique one refuses a second node with the same parts (409). An async one is written by the server's maintenance pass (every second) from the change journal. GET /v1/lookup/<index>?key=<parts> (a lookup <index> -> <aggregate> grant; key the first parts, separated by commas) gives the nodes, each with its record and the record's root as the caller's get grant shows it (records rows hide are left out); for an asynchronous index also applied_through (the version applied) and pending (newer changes not applied yet).
  • Listing indexes. listing index [include (fields)] on a type (spec/schema.md 4.8) keeps an entry per node of the type, its key the node's path, in the children's key order, so a listing reads one range instead of seeking past each child's subtree. With include the entry holds the node's value with the other fields cleared. It is written in the node's transaction on insert and delete, and on update only when an included field changes. A listing of the type is answered from the index when every field the caller's profile shows of the type, and every field its rows rules test, is included; otherwise from the nodes. Both answers are the same (open/crates/oliviadb-server/tests/listing_index.rs: random histories, profiles with masks and row rules, the index built while writers write). A declaration added to a store with nodes is built by the maintenance pass from a snapshot and the change journal since it, and read only once marked complete. Cost: one more key per node of the type, with the included fields' bytes; updates of other fields write nothing more.
  • Search. POST /v1/search/<aggregate> with {"query", "budget", "limit"} (a search <aggregate> grant, within its token budget) ranks, by BM25, the nodes the caller may get, each by the text its profile shows (masked values are searched masked, fields taken out are not searched), and returns the best within the budget (about four characters a token). It reads the tenant's nodes of the aggregate at each call (at most 100 000; beyond that 501: a text index is not built yet).
  • Writes. POST inserts the node the path names ({"fields": {...}}: every field of the type and of the variant case its discriminator selects; 409 when it exists, 404 without its parent); PATCH changes the fields given (a new discriminator value drops the old case's fields and needs the new case's) and adds the numbers of "add": {"balance": "-12.50"} to the current values of integer, decimal and float64 fields in the same transaction (a relative update: no read and conditional write needed; integers and decimals exactly, a decimal with more fraction digits than the field's scale and a sum beyond its precision refused with 400); DELETE deletes the node and its subtree. POST /v1/txn with {"ops": [{"op", "path", "fields"}...]} runs several as one transaction, all or none. Besides insert, update and delete it takes put (an update when the node exists, an insert when not, each under its own grant), delete with "if_exists": true (a missing node deletes nothing) and unchanged with "since": <version> (a precondition needing get: 412 precondition-failed when the node's stored value differs from its value at that version, 410 when the version is older than the history kept). Every write is an optimistic transaction (oliviadb_core::otx): serializable, retried on a conflict, pessimistic after three; a lock not granted in 5 s is 503 (retryable). Under txn scope aggregate (the default) a transaction writes one aggregate record (the aggregate and its root key), otherwise 403.
  • Layouts. Each node type's layout (spec/schema.md 4.1, "Layouts of the schema language") is registered in the server's layout registry by the first write that uses it, in the same transaction; every version records its writer's layout number, and every read and change record decodes a version by it, so data written under an earlier schema version reads as it was written (layout names it). A read shows the fields the current layout adds with their defaults (empty string, zero, false, the first enum member, 1970-01-01, an empty reference: oliviadb_schema::codec::default_value), and a change of such a node keeps them unless it gives them; the change stream shows each version as written.
  • Profiles. A read needs get (a node, or get .../** for anything under one), list or range (a listing); a write insert (a grant ending with the type covers any key), update (its fields(...) bound the fields changed; except fields cannot be changed) or delete; propose grants are not writes. fields(...) and except bound the fields shown; rows <type> where <field> <op> <values> hides nodes (and what is under them) whose field does not match, with $user.<attribute> from the caller's credentials (a write that would leave such a node is refused); mask and pii masked mask values as agent policies do. Consistency, as-of reads, quota and observe mode as for the other data calls.
  • Data subjects. An aggregate with subject <root key> seals every node's data (XChaCha20-Poly1305, the node's key as associated data) under a key of its record's subject, held in the key store as agent memory's subject keys are (replicated with the key material on an HA pair). POST /v1/admin/aggregates/erase with {"aggregate", "subject"} (admin) deletes the record, its index and reference entries in one transaction (no reference stops an erasure; referrers keep a reference to nothing), then destroys the key: every copy of the record's data, in history, logs and backups, is unreadable from then on. Reads as of an earlier version find nothing; the change stream reports the record's nodes as deleted with "erased": true and no fields. Index entries hold their parts in clear: the erasure deletes them, their earlier versions go with the history window.
  • History. Versions are kept for the longest history of the served aggregates, at least a day (change-stream consumers resume within it); the maintenance pass gives older ones up to garbage collection and trims the change journal. Reads as of an earlier version and change-stream positions before it answer 410.
  • Physical declarations. placement and partition are accepted and, on one node (or an HA pair), a record's nodes are in key order; residency and tier are recorded in the schema and not acted on yet.
  • Storage and high availability. A tenant's nodes are path keys (spec/path-keys.md, format 2, ordinals for twins) under a <tenant> 0x00 <aggregate> 0x00 in the agent-state tree, index and reference entries under x <tenant> 0x00, so they are synced, replicated and admitted like agent state: on an HA pair writes go to the primary, the other node answers 503 (retryable, naming the primary), and a write is acknowledged once the standby holds it (semi-synchronous).
  • Not served natively (501, the detail says why): types with format-1 keys (the DL/I format: imported databases, served by the DL/I layer), ref statements (relationships without a field), references into aggregates not served natively, a subject that is not the root's one-part unique key.

Tests: open/crates/oliviadb-schema/tests/codec.rs (bytes written out by hand), open/crates/oliviadb-server/tests/native.rs (reads, writes, profiles, transactions, the change stream, decoding by the writer's layout after a schema change), open/crates/oliviadb-server/tests/native_more.rs (twins, references and their rules, history), open/crates/oliviadb-server/tests/bank.rs (spec/schema/examples/bank.olv under its teller and kyc_agent profiles: everything above at once), oliviadb-enterprise/crates/oliviadb-ha/tests/e2e_native.rs (a pair: the standby refuses, failover, the same change stream on the other node).

DL/I databases

With a dli section in the configuration, oliviadb-server serves DL/I databases read only: GET /v1/dli/<path> over HTTP and route 0x07 DLI of the native protocol, answered as spec/native-protocol.md 6.4 describes.

"dli": {"store": "dli/system", "library": "dli/library", "runtime": "ascii-le",
        "databases": {"PARTDB": "dli/PARTDB"},
        "views": {"parts-agent": "dli/PARTVIEW.psb"}}
  • store: the DL/I system's directory (the one oliviadb_open takes); library: the DBD and PSB sources (*.dbd, *.psb); databases (optional): databases kept in stores of their own, as oliviadb_map_database maps them; runtime: the data's representation, ebcdic (default), ascii-be or ascii-le, as the programs that wrote it scheduled their PSBs.
  • views: for each principal, the file of its view PSB: PSBGEN source (PCB, SENSEG, SENFLD, PROCOPT G, O, P or K) with OliviaDB's ROWS and MASK statements (agent data, "Agent PSBs"). A principal without a view gets 403; a database no PCB names, a segment type no SENSEG names, and a segment outside the ROWS predicates are not found (404). Fields outside SENFLD are left out; MASK fields show their mask. PDATA is refused at start.

The server holds these stores. At start the server opens the DL/I system and every store of the databases the views name, and holds each exclusively until it ends (the store lock, spec/storage-format.md, "Store lock"). While it runs, DL/I programs in other processes cannot open those stores: oliviadb_open returns no system, or the schedule of a PSB that uses one returns no program, and oliviadb_last_error() says the store is in use by the server's process id. Run the batch programs that write the databases, then start the server on their stores; stop the server before the next batch run. A server does not start on a store a program holds (it names the holder and exits). A path through the server for programs that write while it serves is not built yet.

Paths. PARTDB/PART/P00011 is the PART segment whose sequence field is P00011; with ?tree=true the answer has its children by type ("children": {"STOCK": [...]}) in hierarchic sequence; PARTDB/PART/P00011/STOCK lists its STOCK segments (limit, at most 1000, default 100; after the next of the previous page). A segment type without a sequence field, or with one that is not unique, gives its segments an ordinal: NOTE/~01, NOTE/~02 (also NOTE/[2] for the second). A sequence field whose bytes do not decode is written x: and its hexadecimal.

Answers have the form of native aggregate answers (path, type, key, fields, layout, version; listings nodes, next, version), so the clients read them as they read aggregates. Fields are the segment's FIELD statements typed by TYPE=: C text without trailing blanks, P a decimal string, H (2 bytes) and F (4 bytes) integers, X and every other type lower-case hexadecimal. A field whose bytes are not a value of its type (a packed field with a bad sign, an unprintable character) shows x: and its bytes. All of one answer is read at one committed version. Examples: HTTP API by example, "DL/I databases".

Tests: oliviadb-server/tests/dli.rs (a database written by a DL/I program, typed answers, views with SENFLD, ROWS and MASK, rows equal to JSON under every view with small frames and an evicting descriptor cap, never-leak over a randomized database, route 0x07 over a socket, the store held by the server).

Native protocol

With "native_listen" (default port 7655) or "native_socket" in the configuration, oliviadb-server also speaks the native protocol (spec/native-protocol.md, version 1): length-prefixed frames with a stream id, many requests in flight on one connection, TLS from the first byte with the HTTP listener's certificate (ALPN oliviadb/1), plain text only on loopback unless native_plaintext_remote (which logs a warning). HELLO, READY, AUTH with the credentials the Authorization header takes, then REQUEST frames, each one of the HTTP routes above (GET, LOOKUP, SEARCH, TXN, WRITE, DLI) answered through the same handler: the JSON text of the HTTP answer, or its status and problem document. Limits (native_limits): frame size, streams in flight, connections, handshake and idle timeouts; a failed authentication is answered after a back-off per address (100 ms doubling up to 5 s; the connection closes at the third), which the HTTP listener applies too.

Reads (GET, DLI) answer in row form: each node's stored key component and value bytes, described by type descriptors that a connection receives once (DESCRIBE; at most max_descriptors, least recently used ones evicted with UNDESCRIBE). A profile's hidden and masked fields are zeroed in a copy of the value, and the masked text is sent beside it, so their stored bytes never leave the server. Results larger than a frame span several. LOOKUP answers the records' root nodes with the indexed node's path (or the two paths, when the profile does not show the root), SEARCH the ranked nodes with their parent path and score, and CHANGES (CHANGE frames until CANCEL) each change record in binary form with its before and after nodes: there is no JSON on the native path but the answers to writes. Not yet: lz4 (compression is answered none). The reference decoder of the row form is oliviadb_server::native::rows::decode. Its tests compare every read under three profiles with the HTTP answer (GET, LOOKUP, SEARCH, the change stream) under four profiles and check that nothing hidden leaks. Tests: oliviadb-server/src/wire.rs (each rule, and a mutated corpus of frames run by the test suite; fuzz/ is the cargo-fuzz target of the same entry point) and tests/wire.rs (real sockets: answers byte for byte as over HTTP, thirty streams in flight, errors and closing, the timeouts, the back-off, the connection limit).

Redis-protocol facade

With "resp_listen" in the configuration, oliviadb-server also speaks the Redis protocol (RESP2 and RESP3) over the native aggregates, on the same TLS certificate and credentials (AUTH with an API key or token): a key is a node's path, a node a hash of its fields, MULTI/EXEC one transaction, WATCH an unchanged precondition in it; every command goes through the calls above under the caller's profile. Commands, the differences from Redis and the tests: docs/facades.md.

Generated clients

oliviadb schema client FILE --lang rust|ts --profile NAME --out DIR [--sdk ...] writes a typed client of one access profile (code: open/crates/oliviadb-schema/src/codegen/). The profile is the contract: every grant becomes one method, every node type it reaches a typed structure of the fields it shows, and nothing the profile does not grant has a method or a field.

  • Methods. get A/{id} -> get_a(id) (a node); get A/{id}/** -> get_a_tree(id) (the node and the subtree it may list, typed per child type); list/range -> a page (limit, by default the grant's limit; after the previous page's next; prefix the first key parts); insert -> the new node's key and all its fields (position for twins: last, first, before or after a twin's ordinal); update ... fields(...) -> a patch with those fields alone (minus except); delete; lookup <index> -> the index's parts (the first required) and the record roots as the profile's get shows them; search <aggregate> -> ranked hits within the grant's budget, typed by node type; watch <path> -> a batch of change records under the path (from: start, now or a position), typed by node type. A level of a path is its key parts as parameters, and for twin types a Twin (the ordinal a read returned, or a position); * in a read grant is a parameter too, in a watch the literal *. propose grants have no method (a person confirms them); the generated file lists them. as_of is a parameter of the reads when the profile says as_of allowed.
  • Types. Fields as the native API shows them: strings, text, decimals at their scale, dates, timestamps, bytes in hexadecimal and references are strings; integers up to 32 bits numbers; 64-bit integers and versions numbers or decimal strings beyond 2^53
  • 1 (Rust Int64/Uint64/Version, TypeScript number | string); enums their member names (a Rust enum, a TypeScript union of names). A field the profile masks (mask, or personal data under pii masked) is a string; a variant's fields are optional; a field some read of the type does not show (another grant's fields(...)) is optional; a field taken out by except is absent. Search hits and change records of several node types are a union by type (a Rust enum tagged by type, a TypeScript discriminated union).
  • Paths are encoded as the server reads them (native/keys.rs): each key part percent-encoded except letters, digits and -._:, the parts of a key joined by ,, a twin's ordinal after ~; query values (after, prefix, key, path) encoded once more.
  • Rust: a crate on the Rust SDK (crate oliviadb, repository oliviadb-rust, Apache-2.0), its runtime: pub use oliviadb::typed::* gives the Transport trait requests go through (send(method, path, body) -> (status, body), so any HTTP stack fits), Node, Page, Change, Twin, Position, the 64-bit types and path encoding; with the feature http (default) the client sends through oliviadb::Client (a list of nodes, failover to the primary, retries only of answers marked retryable): Client::connect(url, token), or Client::new(oliviadb_client) for several nodes and a CA file. --sdk version:REQ (default 0.1), path:DIR or git:URL[#REV] says where the crate takes the SDK from. Errors: Error::Api(Problem) with the status, retryable and an outcome-unknown write's version; Connect (not sent), Io (lost after sending), Decode.
  • TypeScript: one module, client.ts, on fetch (or a Transport function), no dependencies, erasable syntax only (Node.js runs it as it is). Errors: OliviaDbError with status and problem.

The server enforces the profile whatever the client; the types only say what it will answer. Tests: open/crates/oliviadb-schema/tests/codegen.rs (the model of teller and kyc_agent, worked out by hand), open/crates/oliviadb-server/tests/generated_clients.rs (both profiles generated in both languages, the Rust crates built clippy-clean with their dependencies through tools/licenses.py --manifest-path, the TypeScript type-checked with tsc --strict (TypeScript 5.9.3 through npx), and the programs in tests/generated/ run against a live server; a patch with an ungranted field and a call of a proposal do not compile; the Rust part needs the SDK: OLIVIADB_RUST_SDK, or oliviadb-rust under OLIVIADB_REPOS, default ..; skipped without it, a failure under OLIVIADB_REQUIRE_CLIENTS=1), open/crates/oliviadb-ops/tests/schema.rs (client_generation, --sdk); in oliviadb-rust, oliviadb/tests/generated.rs (a client of its test schema on the SDK against a live server).

Access profiles

With "schema": "FILE" in the configuration (a schema in the .olv language or its JSON form, spec/schema.md), every operational-data call is checked against the access profile declared for the caller's principal: an undeclared path is refused (403 forbidden, detail refused by access profile: ...), a read the node cannot give at the profile's consistency answers 503 (retryable), a call over the profile's quota 429 (retryable). "environment": "staging" honours profiles in observe mode (the call goes through, and a record with "observe": true goes to the audit log) and lets callers without a profile through the same way; production (the default) refuses to start with an observe-mode profile and gives callers without a profile no data. Memory calls are outside profiles. Native aggregates are under the same profiles (above). Tests: open/crates/oliviadb-server/tests/profiles.rs, open/crates/oliviadb-server/tests/native.rs.

Tests

oliviadb-server/tests/http.rs over real sockets: refusals (no credentials, unknown key, expired, wrong audience or issuer, no tenant, tampered, alg: none, read scope writing), recall over HTTP equal to the tool called directly, packs and watches bound to their principal, SSE events after a write, the erasure confirmation, TLS 1.3 and a refused TLS 1.2 client, plain HTTP refused off loopback. oliviadb-agent-server/tests/layer1_http.rs: branch row predicates from the caller's credentials, masked values absent, hidden and absent records both 404, search limited to the view, results equal to the agent view read directly.

Mem0-compatible API

On the same listener: the routes of Mem0's platform API that its clients call (POST /v3/memories/add/, /v3/memories/search/, /v3/memories/, GET|PUT|DELETE /v1/memories/{id}/, /v1/memories/{id}/history/, DELETE /v1/memories/, /v1/ping/, /v1/entities/, DELETE /v2/entities/{type}/{name}/, /v1/batch/, /v1/feedback/, /v1/event/{id}/), with Mem0's payloads and response shapes (docs.mem0.ai API reference; requests as the mem0ai 2.2.1 client sends them), authenticated with OliviaDB API keys (Token) or tokens. An application changes only host=. Memories are agent-state documents of the caller (oliviadb-server/src/mem0.rs). Differences: Mem0's LLM extraction (infer) is not run, each user or assistant message is one memory as written; search ranks by the server's embedder (cosine, threshold applies); filters AND/OR/NOT, in, gte, lte, gt, lt, ne, contains, icontains, * on entity ids, dates, categories and metadata, other fields refused (400); exports, summaries, profiles, projects and webhooks answer 501. Evidence: adapters/mem0-compat of the oliviadb-python repository runs Mem0's own client against OliviaDB (add, search with filters and thresholds, pagination, get, update, history, delete, delete all, entities, batch, feedback, expiry, the async client, a wrong key refused).

Clients (repositories of their own, Apache-2.0)

package runtime
Python oliviadb-python: oliviadb (from oliviadb import OliviaDbClient) 3.9+, standard library only
TypeScript oliviadb-js: oliviadb-client (@olivia-db/client) fetch (Node 18+, Deno, Bun, browsers, edge)
Java oliviadb-java: oliviadb-client (com.olivia-db:oliviadb-client) JDK 17+, java.net.http, Jackson
Rust oliviadb-rust: crate oliviadb (also the runtime of generated Rust clients) blocking, ureq with rustls, serde_json

Each has the routes above as methods, problem documents as an exception type with retryable (retried with Retry-After), and watch events as an iterator or callback. Their tests are contract tests in their repositories: each repository's check.sh runs them against a server built from this repository (or its Docker image); COMPATIBILITY.md of oliviadb-spec lists which versions work together.

Not built yet

JWKS fetched from the issuer's URL (the file is read at start), MCP Streamable HTTP on the same listener, rate limits, mTLS client identities, gRPC.