Skip to content
Hoody.com

The KV Store keeps a complete operation log for every key and table, enabling point-in-time reconstruction, change inspection, and rollback. Use these endpoints to audit query and key history, take snapshots at specific operation numbers or Unix timestamps, diff states across windows, and restore previous values. All endpoints require a database path via the db query parameter; custom tables are selected with table (default kv_store).

Retrieve query execution history for a database with an optional entry limit.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
limitqueryintegerNoMaximum number of entries to return. Default: 100
{
"history": [
{
"id": 42,
"db": "app.db",
"query": "SELECT id, name FROM users WHERE active = 1",
"timestamp": 1700000000,
"duration_ms": 12,
"rows_affected": 17,
"status": "ok"
},
{
"id": 41,
"db": "app.db",
"query": "UPDATE users SET last_seen = 1700000000",
"timestamp": 1699999990,
"duration_ms": 8,
"rows_affected": 1024,
"status": "ok"
}
],
"count": 2,
"has_more": true
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.history.list({ db: 'app.db', limit: 100 });

Retrieve aggregated statistics about query execution history for a database.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
{
"db": "app.db",
"total_queries": 1542,
"total_duration_ms": 84320,
"avg_duration_ms": 54.7,
"errors": 23,
"first_query_at": 1699000000,
"last_query_at": 1700000500
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.history.getStats({ db: 'app.db' });

Delete all query history entries for a database.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
{
"db": "app.db",
"cleared": true,
"deleted_count": 1542
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.history.clear({ db: 'app.db' });

Delete a specific query history entry by its numeric ID.

NameInTypeRequiredDescription
indexpathintegerYesHistory entry ID
dbquerystringYesDatabase file path
{
"db": "app.db",
"deleted": true,
"index": 42
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.history.deleteEntry(42, { db: 'app.db' });

Retrieve the operation history for a specific key, showing every change over time.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
limitqueryintegerNoMaximum number of operations to return (0 → default 50, clamped to maximum 1000). Default: 50
{
"key": "user:42",
"table": "kv_store",
"operations": [
{
"op_number": 7,
"op_type": "SET",
"value": "alice",
"timestamp": 1700000120,
"ttl": null
},
{
"op_number": 4,
"op_type": "SET",
"value": "{\"name\":\"alice\"}",
"timestamp": 1699999000,
"ttl": null
},
{
"op_number": 1,
"op_type": "SET",
"value": "{\"name\":\"bob\"}",
"timestamp": 1699995000,
"ttl": null
}
],
"count": 3,
"has_more": false
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.getHistory('user:42', { db: 'app.db', limit: 50 });

Reconstruct the value of a key as it existed at a specific operation number.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
op_numberqueryintegerYesOperation number to reconstruct from
{
"key": "user:42",
"table": "kv_store",
"op_number": 4,
"value": "{\"name\":\"alice\"}",
"reconstructed_at": 1700000500
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.getSnapshot('user:42', { db: 'app.db', op_number: 4 });

Reconstruct the entire KV table state as it was at a specific Unix timestamp.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
timestampqueryintegerYesUnix timestamp to reconstruct from
limitqueryintegerNoMaximum number of keys to return. Default: 100
prefixquerystringNoFilter keys by prefix
{
"table": "kv_store",
"timestamp": 1700000000,
"keys": {
"user:42": "alice",
"user:43": "carol",
"session:abc": "{\"token\":\"xyz\"}"
},
"count": 3,
"has_gaps": false,
"gap_keys": [],
"candidate_truncated": false
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.getTableSnapshot({ db: 'app.db', timestamp: 1700000000, limit: 100, prefix: 'user:' });

Compare the KV table state between two Unix timestamps, surfacing created, modified, and deleted keys.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
fromqueryintegerYesStarting timestamp (Unix)
toqueryintegerYesEnding timestamp (Unix)
keysquerystringNoComma-separated list of keys to compare (optional)
{
"table": "kv_store",
"from": 1699999000,
"to": 1700000000,
"created": ["user:43"],
"modified": ["user:42"],
"deleted": ["session:old"],
"has_gaps": false,
"gap_keys": [],
"candidate_truncated": false
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.compareSnapshots({ db: 'app.db', from: 1699999000, to: 1700000000, keys: 'user:42,user:43' });

Roll a key back to a previous state by undoing the last N operations.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
stepsqueryintegerNoNumber of operations to rollback. Default: 1
{
"key": "user:42",
"table": "kv_store",
"rolled_back_steps": 1,
"current_value": "alice",
"current_op_number": 4
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.rollback('user:42', { db: 'app.db', steps: 1 });

Roll the entire KV table back to a specific Unix timestamp. The endpoint requires confirm=yes and an explicit to_timestamp to execute; use dry_run=true to preview the affected keys without applying changes.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
to_timestampqueryintegerYesTarget timestamp to rollback to (Unix)
dry_runquerybooleanNoPreview changes without applying. Default: false
confirmquerystringNoMust be yes to execute actual rollback

Optional filters that limit the rollback to a subset of keys. The body schema is empty; no body fields are required.

{}
{
"table": "kv_store",
"to_timestamp": 1700000000,
"dry_run": false,
"rolled_back": true,
"affected_keys": ["user:42", "user:43"]
}
import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.sqlite.kvStore.rollbackTable(
{},
{ db: 'app.db', to_timestamp: 1700000000, dry_run: false, confirm: 'yes' }
);