The KV Store provides atomic array operations for appending, removing, and popping values without read-modify-write races. All three endpoints support optional JSON paths for targeting nested arrays, and each operates on a value stored under a key in a SQLite-backed KV table.
Append a value to an array. If the key does not exist, it is created as a new array containing the appended value. When path is supplied, the value is appended to the nested array at that JSON path.
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 to nested array historyquery boolean No Enable history tracking (default: true)
This endpoint accepts a JSON body containing the value to append.
{ "user" : " alice " , "action" : " login " , "timestamp" : 1700000000 },
{ "user" : " bob " , "action" : " view " , "timestamp" : 1700000123 }
"message" : " Existing value is not an array " ,
"code" : " INVALID_PARAMETERS "
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" : " Failed to append to array " ,
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 . push ({
Pop the last element from an array. When path is supplied, the last element of the nested array at that JSON path is removed and returned. The remaining array is persisted atomically.
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 to nested array historyquery boolean No Enable history tracking (default: true)
This endpoint takes no request body.
"popped" : { "id" : 42 , "payload" : " process_me " },
{ "id" : 41 , "payload" : " older " }
"message" : " Existing value is not an array " ,
"code" : " INVALID_PARAMETERS "
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" : " Failed to pop from array " ,
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 . pop ( {
// result.popped — the removed element
// result.array — remaining elements
Remove an element from an array. When index is supplied, the element at that position is removed. Otherwise, the request body value is matched against array elements and the first match is removed. Optional path targets a nested array.
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 to nested array indexquery integer No Array index to remove historyquery boolean No Enable history tracking (default: true)
When removing by value, the request body carries the value to match and remove.
"removed" : { "id" : 42 , "payload" : " process_me " },
{ "id" : 41 , "payload" : " older " },
{ "id" : 40 , "payload" : " oldest " }
"message" : " Existing value is not an array " ,
"code" : " INVALID_PARAMETERS "
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" : " Matching element 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" : " Failed to remove array element " ,
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 . removeElement ({
data: { id: 42 , payload: " process_me " }
await client . sqlite . kvStore . removeElement ({
// Remove from a nested array
await client . sqlite . kvStore . removeElement ({