The KV (key-value) store provides a simple, high-level interface over SQLite for storing and retrieving values by key. Use these endpoints for caching, counters, configuration, and lightweight session state. All operations support optional time-to-live (TTL), JSON path access, and history tracking.
All endpoints share the same container-scoped base URL and respond with the stored value or a structured error object.
GET /api/v1/sqlite/kv/{key}
Retrieve a value from the KV store. The response body contains the raw stored value. JSON-path extraction and time-travel queries are supported via query parameters.
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)
curl -X GET " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/user:42?db=app.db&path=profile.email "
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 . get ( ' user:42 ' , { db : ' app.db ' , path : ' profile.email ' });
The response headers expose metadata:
Header Description Content-TypeMIME type of the stored value X-Created-AtUnix timestamp when created X-Expire-AtUnix timestamp when expires (if TTL set) X-KV-ReferenceSet to true if value is a KV store reference X-Updated-AtUnix timestamp when last updated
" message " : " Invalid db parameter "
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 at timestamp 1735689600 "
" error " : " Internal Server Error " ,
" message " : " Database read 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
PUT /api/v1/sqlite/kv/{key}
Store or update a value in the KV store. The body carries the value to store. Supports an optional path for partial JSON updates, an optional ttl for time-to-live, and an optional if_match value for compare-and-swap semantics.
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 request body carries the raw value to store. It accepts either application/octet-stream or application/json.
" { \" name \" : \" Ada \" , \" score \" :42} "
curl -X PUT " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/user:42?db=app.db&ttl=3600 " \
-H " Content-Type: application/json " \
-d ' {"name":"Ada","score":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 . kvStore . set ( ' user:42 ' , ' {"name":"Ada","score":42} ' , { db : ' app.db ' , ttl : 3600 });
" message " : " Invalid db parameter "
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 " : " if_match did not match current value "
" error " : " Internal Server Error " ,
" message " : " Database write 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
DELETE /api/v1/sqlite/kv/{key}
Remove a key-value pair from the store. Returns 200 on success even if the key did not exist, unless the underlying database or directory is missing.
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)
curl -X DELETE " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/user:42?db=app.db "
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 . delete ( ' user:42 ' , { db : ' app.db ' });
" message " : " Invalid db parameter "
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 delete 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
HEAD /api/v1/sqlite/kv/{key}
Check whether a key exists without retrieving its value. A 200 OK response indicates the key exists; a 404 indicates it does not (or has 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)
curl -I " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/user:42?db=app.db "
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 . exists ( ' user:42 ' , { db : ' app.db ' });
" message " : " Invalid db parameter "
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 query 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
POST /api/v1/sqlite/kv/{key}/incr
Atomically increment a numeric value stored under the key. If the key does not exist, it is created with value delta. Use the optional path parameter to increment a nested numeric field inside a JSON document.
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)
curl -X POST " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/counter:visits/incr?db=app.db&delta=1 "
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 . incr ( ' counter:visits ' , { db : ' app.db ' , delta : 1 });
" message " : " Stored value 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 " : " Atomic increment 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
POST /api/v1/sqlite/kv/{key}/decr
Atomically decrement a numeric value stored under the key. If the key does not exist, it is created with value -delta. Use the optional path parameter to decrement a nested numeric field inside a JSON document.
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)
curl -X POST " https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/counter:visits/decr?db=app.db&delta=1 "
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 . decr ( ' counter:visits ' , { db : ' app.db ' , delta : 1 });
" message " : " Stored value 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 " : " Atomic decrement 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