Skip to content
Hoody.com

The KV Store provides a simple key-value persistence layer backed by SQLite, with support for hierarchical keys, JSON path extraction, TTL, atomic counters, and optional history tracking. Use these endpoints to read, write, delete, and atomically mutate values stored either in a dedicated .db file or in directory mode under a custom table.

GET /api/v1/sqlite/kv/{key}

Retrieve a value from the KV store. Supports JSON path extraction for nested values and time-travel queries that return the value as of a specific Unix timestamp.

NameInTypeRequiredDescription
keypathstringYesKey name (supports / for hierarchical keys)
dbquerystringYesDatabase file path or directory
tablequerystringNoCustom table name (default: kv_store)
pathquerystringNoJSON path for nested value extraction
at_timestampqueryintegerNoUnix timestamp for time-travel query (selects handleKVAtTimestamp)
rebuildquerybooleanNoRebuild cache (directory mode only)

This endpoint accepts no request body.

The raw stored value is returned in the response body. Useful metadata is provided via response headers.

The stored value is returned as the response body. The Content-Type reflects the MIME type used at write time.

"{\"name\":\"hoody\",\"version\":\"1.0\"}"
HeaderTypeDescription
Content-TypestringMIME type of the stored value
X-Created-AtstringUnix timestamp when created
X-Expire-AtstringUnix timestamp when expires (if TTL set)
X-KV-ReferencestringSet to true if value is a KV store reference
X-Updated-AtstringUnix timestamp when last updated
Terminal window
curl -X GET "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/app/config?db=/hoody/databases/app.db&path=$.theme"
await client.sqlite.kvStore.get("app/config", { db: "/hoody/databases/app.db", path: "$.theme" });

PUT /api/v1/sqlite/kv/{key}

Store or update a value in the KV store. Supports time-to-live, JSON path updates, and compare-and-swap via the if_match parameter.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name (default: kv_store)
pathquerystringNoJSON path for nested value update
ttlqueryintegerNoTime-to-live in seconds
if_matchquerystringNoCurrent value for compare-and-swap
historyquerybooleanNoEnable history tracking (default: true)
create_db_if_missingquerybooleanNoCreate database file if it is missing (default: false)

The request body is a raw string value to store. It can be sent as application/octet-stream for arbitrary text or binary data, or as application/json when storing a JSON-encoded string. If you want to store a structured value, encode it yourself (e.g. via JSON.stringify) before sending.

"{\"theme\":\"dark\",\"version\":3}"

The value was stored successfully.

{}
Terminal window
curl -X PUT "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/app/config?db=/hoody/databases/app.db&ttl=3600" \
-H "Content-Type: application/json" \
-d '"{\"theme\":\"dark\",\"version\":3}"'
await client.sqlite.kvStore.set(
"app/config",
"{\"theme\":\"dark\",\"version\":3}",
{ db: "/hoody/databases/app.db", ttl: 3600 }
);

DELETE /api/v1/sqlite/kv/{key}

Remove a key-value pair from the store. Returns KEY_NOT_FOUND if the key does not exist or has expired.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path or directory
tablequerystringNoCustom table name (default: kv_store)
historyquerybooleanNoEnable history tracking (default: true)

This endpoint accepts no request body.

The key was deleted successfully.

{}
Terminal window
curl -X DELETE "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/app/config?db=/hoody/databases/app.db"
await client.sqlite.kvStore.delete("app/config", { db: "/hoody/databases/app.db" });

HEAD /api/v1/sqlite/kv/{key}

Check whether a key exists in the KV store without retrieving its value. Returns 200 if present, 404 if missing or expired.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path or directory
tablequerystringNoCustom table name (default: kv_store)

This endpoint accepts no request body and returns no response body.

The key exists. No response body is returned.

Terminal window
curl -I "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/app/config?db=/hoody/databases/app.db"
await client.sqlite.kvStore.exists("app/config", { db: "/hoody/databases/app.db" });

POST /api/v1/sqlite/kv/{key}/incr

Atomically increment a numeric value, returning the new value. Supports JSON paths for incrementing a nested numeric field inside a stored object.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name (default: kv_store)
deltaqueryintegerNoAmount to increment (default: 1)
pathquerystringNoJSON path to nested numeric value
historyquerybooleanNoEnable history tracking (default: true)

This endpoint accepts no request body.

The value was incremented successfully.

{}
Terminal window
curl -X POST "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/counters/views/incr?db=/hoody/databases/app.db&delta=1"
await client.sqlite.kvStore.incr("counters/views", { db: "/hoody/databases/app.db", delta: 1 });

POST /api/v1/sqlite/kv/{key}/decr

Atomically decrement a numeric value, returning the new value. Supports JSON paths for decrementing a nested numeric field inside a stored object.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name (default: kv_store)
deltaqueryintegerNoAmount to decrement (default: 1)
pathquerystringNoJSON path to nested numeric value
historyquerybooleanNoEnable history tracking (default: true)

This endpoint accepts no request body.

The value was decremented successfully.

{}
Terminal window
curl -X POST "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.icu/api/v1/sqlite/kv/counters/views/decr?db=/hoody/databases/app.db&delta=1"
await client.sqlite.kvStore.decr("counters/views", { db: "/hoody/databases/app.db", delta: 1 });