The KV Store basic operations let you read, write, increment, decrement, delete, and check the existence of key-value pairs stored in SQLite. Use these endpoints for counters, configuration values, session data, and any workload that needs simple key-based storage with optional TTL and JSON path support.
Retrieve a value from the KV store. Supports hierarchical keys (using / as a separator), JSON path extraction for nested values, and time-travel queries via a Unix timestamp.
Name In Type Required Description keypath string Yes Key name (supports / for hierarchical keys) dbquery string Yes Database file path or directory tablequery string No Custom table name (default: kv_store) pathquery string No JSON path for nested value extraction at_timestampquery integer No Unix timestamp for time-travel query (selects handleKVAtTimestamp) rebuildquery boolean No Rebuild cache (directory mode only)
The response body contains the raw stored value. Metadata is returned in response headers:
Content-Type — MIME type of the stored value
X-Created-At — Unix timestamp when created
X-Updated-At — Unix timestamp when last updated
X-Expire-At — Unix timestamp when the value expires (if TTL set)
X-KV-Reference — Set to true if the value is a KV store reference
" { \" user \" : \" alice \" , \" score \" :42} "
"message" : " Invalid database path "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"message" : " Key not found "
Error Code Title Description Resolution KEY_NOT_FOUNDKey not found The requested key does not exist in the KV store Verify the key name and database/table parameters DATABASE_NOT_FOUNDDatabase file does not exist The specified database file was not found Check the file path or use create_db_if_missing=true to create it KEY_EXPIREDKey expired The key existed but has expired due to TTL The key was automatically deleted. Store a new value if needed.
"message" : " Time-travel chain gap detected for the requested timestamp "
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
const value = await client . sqlite . kvStore . get ( {
db: " /hoody/databases/app.db "
Store or update a value in the KV store. Supports TTL (time-to-live), JSON path updates for nested values, and compare-and-swap (CAS) writes via the if_match parameter.
Name In Type Required Description keypath string Yes Key name dbquery string Yes Database file path tablequery string No Custom table name (default: kv_store) pathquery string No JSON path for nested value update ttlquery integer No Time-to-live in seconds if_matchquery string No Current value for compare-and-swap historyquery boolean No Enable history tracking (default: true) create_db_if_missingquery boolean No Create database file if it is missing (default: false)
The raw value to store. Send JSON for structured data or application/octet-stream for binary payloads.
"tags" : [ " admin " , " beta " ]
"message" : " Invalid database path "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"error" : " Precondition Failed " ,
"message" : " Compare-and-swap failed: current value does not match if_match "
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
await client . sqlite . kvStore . set ({
db: " /hoody/databases/app.db " ,
data: { user: " alice " , score: 42 }
Remove a key-value pair from the store.
Name In Type Required Description keypath string Yes Key name dbquery string Yes Database file path or directory tablequery string No Custom table name (default: kv_store) historyquery boolean No Enable history tracking (default: true)
"message" : " Invalid database path "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"message" : " Key not found "
Error Code Title Description Resolution KEY_NOT_FOUNDKey not found The requested key does not exist in the KV store Verify the key name and database/table parameters DATABASE_NOT_FOUNDDatabase file does not exist The specified database file was not found Check the file path or use create_db_if_missing=true to create it KEY_EXPIREDKey expired The key existed but has expired due to TTL The key was automatically deleted. Store a new value if needed.
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
await client . sqlite . kvStore . delete ({
db: " /hoody/databases/app.db "
Check if a key exists in the KV store without retrieving its value. Returns 200 if the key is present, 404 if it is missing or expired.
Name In Type Required Description keypath string Yes Key name dbquery string Yes Database file path or directory tablequery string No Custom table name (default: kv_store)
"message" : " Invalid database path "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"message" : " Key not found or expired "
Error Code Title Description Resolution KEY_NOT_FOUNDKey not found The requested key does not exist in the KV store Verify the key name and database/table parameters DATABASE_NOT_FOUNDDatabase file does not exist The specified database file was not found Check the file path or use create_db_if_missing=true to create it KEY_EXPIREDKey expired The key existed but has expired due to TTL The key was automatically deleted. Store a new value if needed.
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
const present = await client . sqlite . kvStore . exists ( {
db: " /hoody/databases/app.db "
Atomically increment a numeric value. Supports a custom delta, JSON path targeting for nested numeric values, and optional history tracking. The key must already hold a numeric (or null/initialized) value; non-numeric values result in a 400.
Name In Type Required Description keypath string Yes Key name dbquery string Yes Database file path tablequery string No Custom table name (default: kv_store) deltaquery integer No Amount to increment (default: 1) pathquery string No JSON path to nested numeric value historyquery boolean No Enable history tracking (default: true)
"key" : " counters/page_views " ,
"message" : " Value at path is not numeric "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
const result = await client . sqlite . kvStore . incr ( {
key: " counters/page_views " ,
db: " /hoody/databases/app.db " ,
Atomically decrement a numeric value. Supports a custom delta, JSON path targeting for nested numeric values, and optional history tracking.
Name In Type Required Description keypath string Yes Key name dbquery string Yes Database file path tablequery string No Custom table name (default: kv_store) deltaquery integer No Amount to decrement (default: 1) pathquery string No JSON path to nested numeric value historyquery boolean No Enable history tracking (default: true)
"key" : " counters/inventory " ,
"message" : " Value at path is not numeric "
Error Code Title Description Resolution INVALID_DB_PATHInvalid database path The provided database path is invalid or inaccessible Provide a valid absolute path, or use bare name / ./name shorthand (resolved to /hoody/databases/*.db) INVALID_PARAMETERSInvalid request parameters One or more request parameters are invalid or malformed Check parameter types and values against the API specification INVALID_SQLITE_HEADERNot a valid SQLite database The file exists but is not a valid SQLite database Ensure the file is a valid SQLite database with proper header PATH_IS_DIRECTORYPath is a directory Expected a .db file but got a directory (use table parameter for directory mode) Use a .db file path or add table parameter for directory mode KV store
"error" : " Internal Server Error " ,
"message" : " Database operation failed "
Error Code Title Description Resolution DATABASE_ERRORDatabase operation failed An internal database error occurred Check server logs for details. Database may be corrupted or locked. FILE_SYSTEM_ERRORFile system error Failed to read or write filesystem in directory mode Check file permissions and disk space
const result = await client . sqlite . kvStore . decr ( {
key: " counters/inventory " ,
db: " /hoody/databases/app.db " ,