v0.7.0

Wire Protocol

Last updated


This page specifies the frame format, request ops, and error kinds that ToriiDB daemon clients and the server exchange over the unix socket.

Wire Protocol


Both directions use the same frame:
  1. [4-byte big-endian payload length][JSON payload]

Frames larger than 8 MiB are refused by readFrame. A payload that is not valid JSON gets a bad_request response on the same connection.
oprequest fieldssuccess response
getdb key{"record":{db,key,type,content,created_at,updated_at?,expire_at?}}
entriesdb pattern contains? after? limit?{"entries":[<record>,...]}
setdb key content expire_at? vector?{}
deldb keys{"count":<removed>}
ttldb key{"ttl":<seconds>}
expiredb keys ttl{"count":<applied>}
keysdb pattern limit? page?{"list":{db,page,limit,total,keys}}
vsearchdb text pattern limit?{"keys":[...]}
embeddernone{"embedder":<bool>}

Failures return {"error":"...","kind":"..."}:
kindClient errorTypical cause
not_foundErrNotFoundget/ttl on a missing key
bad_requestErrBadRequestinvalid db index, missing pattern/keys/text, ttl <= 0, invalid content, unknown op
no_embedderErrNoEmbedderset with vector or vsearch without an API key
internalplain errorstore or embedding failure


中文