Skip to content
Hoody.com

These three endpoints mutate array values stored in the KV store in a single round trip, removing the race conditions of a read-modify-write cycle. Use push to append a value to an array, pop to remove and return the last element, and remove to drop an element either by index or by matching a value. All three endpoints accept a path query parameter that targets nested arrays by JSON path, so the same call works on top-level and nested arrays alike.

Append a value to the array stored at key. The first time the key is written with this call, the resulting array contains only the appended value.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to a nested array
historyquerybooleanNoStore this write’s value in history (false records only that the write happened, not what it wrote). Default: true
create_db_if_missingquerybooleanNoCreate the database file if it is missing. The legacy alias auto_create is still accepted. Default: false
timeoutqueryintegerNoRequest deadline in seconds, clamped to [1, 300]. Default: 30
If-MatchheaderstringNoApplies the write only if the key’s current ETag matches.
Idempotency-KeyheaderstringNoReplays the stored response for a repeat of the same key (24 h).

The JSON body holds the value to append. Any JSON-serialisable value (object, array, string, number, boolean, or null) is accepted; an array is appended as a single element, not spread. A body that is not valid JSON is refused with a 400.

{
"id": 1,
"task": "process",
"created_at": "2026-01-15T10:30:00Z"
}
Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/tasks/push?db=mydb.db' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{ "id": 1, "task": "process", "created_at": "2026-01-15T10:30:00Z" }'

Value appended successfully. The response includes an ETag header carrying the key’s new ETag, and an Idempotent-Replayed header set to true when this response was replayed from a stored Idempotency-Key match.

{
"etag": "9f1c2d83b7e54a08a0c1e7f3b9a2d4e1",
"key": "tasks",
"length": 5,
"success": true
}

Remove and return the last element of the array stored at key. Supports JSON paths for nested arrays.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to a nested array
historyquerybooleanNoStore this write’s value in history (false records only that the write happened, not what it wrote). Default: true
create_db_if_missingquerybooleanNoCreate the database file if it is missing. The legacy alias auto_create is still accepted. Default: false
timeoutqueryintegerNoRequest deadline in seconds, clamped to [1, 300]. Default: 30
If-MatchheaderstringNoApplies the write only if the key’s current ETag matches.
Idempotency-KeyheaderstringNoReplays the stored response for a repeat of the same key (24 h).

This endpoint accepts no request body.

Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/tasks/pop?db=mydb.db' \
-H 'Authorization: Bearer <token>'

Value popped successfully. The popped element is returned in value along with the new array length. The response includes an ETag header carrying the key’s new ETag, and an Idempotent-Replayed header set to true when this response was replayed from a stored Idempotency-Key match.

{
"etag": "9f1c2d83b7e54a08a0c1e7f3b9a2d4e1",
"key": "tasks",
"length": 4,
"value": {
"id": 1,
"task": "process",
"created_at": "2026-01-15T10:30:00Z"
},
"success": true
}

Remove one element from the array stored at key, either by zero-based index (via the index query parameter) or by matching a value (via the request body). When index is set, it is used and any body value is ignored for the match decision. Supports JSON paths for nested arrays.

NameInTypeRequiredDescription
keypathstringYesKey name
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
pathquerystringNoJSON path to a nested array
indexqueryintegerNoArray index to remove. Send this or a body value; with neither the request is a 400
historyquerybooleanNoStore this write’s value in history (false records only that the write happened, not what it wrote). Default: true
create_db_if_missingquerybooleanNoCreate the database file if it is missing. The legacy alias auto_create is still accepted. Default: false
timeoutqueryintegerNoRequest deadline in seconds, clamped to [1, 300]. Default: 30
If-MatchheaderstringNoApplies the write only if the key’s current ETag matches.
Idempotency-KeyheaderstringNoReplays the stored response for a repeat of the same key (24 h).

Optional. When index is not supplied, the body holds a single value field and the first array element equal to that value is removed. value accepts any JSON-serialisable value (object, array, string, number, boolean, or null); an explicit null removes the first null element, which is not the same as leaving the field out.

FieldTypeRequiredDescription
valueany JSON valueNoThe value to match and remove; required unless index is set
{
"value": {
"id": 1,
"task": "process"
}
}
Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/tasks/remove?db=mydb.db&index=0' \
-H 'Authorization: Bearer <token>'

Element removed successfully. The response includes an ETag header carrying the key’s new ETag, and an Idempotent-Replayed header set to true when this response was replayed from a stored Idempotency-Key match.

{
"etag": "9f1c2d83b7e54a08a0c1e7f3b9a2d4e1",
"key": "tasks",
"length": 3,
"removed": {
"id": 1,
"task": "process"
},
"success": true
}