Skip to content
Hoody.com

The batch endpoints read, write, and delete up to 100 keys in a single request. Use them to amortize round-trip costs, apply atomic updates across many keys, or run per-item compare-and-swap conditions. The write endpoints (/batch/set and /batch/delete) accept an Idempotency-Key header that replays the stored response for a repeat of the same key (24 hours).

Retrieve values for multiple keys in a single request (max 100 keys). Each requested key appears in the response: keys that exist return their parsed value (or base64 if not JSON) and ETag; missing or expired keys return null.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
timeoutqueryintegerNoServer-side deadline in whole seconds, clamped to [1, 300]. Default: 30
FieldTypeRequiredDescription
keysarray of stringsYesKeys to retrieve. 1-100 entries; no entry may be empty or whitespace-only.
Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/batch/get?db=app.db' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"keys": ["user:1", "user:2", "user:3"]}'

Values retrieved successfully.

{
"success": true,
"results": {
"user:1": {
"content_type": "application/json",
"etag": "a1b2c3d4e5f6",
"value": {"name": "Alice", "age": 30}
},
"user:2": {
"content_type": "text/plain",
"etag": "f6e5d4c3b2a1",
"value_base64": "SGVsbG8gV29ybGQ="
},
"user:3": null
}
}
FieldTypeRequiredDescription
resultsobjectYesOne entry per requested key, keyed by the key. Each value is a KVBatchGetResult object or null when the key does not exist or has expired.
successbooleanYesAlways true on a 200.

Store values for multiple keys in a single transaction (max 100 items). Each item can carry an if_match or if_none_match condition for compare-and-swap semantics. A 412 response rolls back the entire batch and lists every key whose condition failed.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
historyquerybooleanNoStore this write’s value in history; false records only that the write happened, not what it wrote. Default: true
Idempotency-KeyheaderstringNoReplays the stored response for a repeat of the same key (24 h).
create_db_if_missingquerybooleanNoCreate database file if it is missing. The legacy alias auto_create is still accepted and means the same thing; the two must agree when both are sent. Default: false
timeoutqueryintegerNoServer-side deadline in whole seconds, clamped to [1, 300]. Default: 30
FieldTypeRequiredDescription
itemsarray of objectsYesItems to write in a single transaction. 1-100 entries. Each item has the fields below.

Each item in items has the following fields:

FieldTypeRequiredDescription
keystringYesKey to write. Must not be empty or whitespace-only.
valuestringNoValue to store.
content_typestringNoContent type recorded alongside the value. Defaults to application/octet-stream.
if_matchstringNoWrite this item only if the key exists and its current ETag is one of these (a comma-separated list of strong entity-tags, as in the If-Match header), or * for “the key exists”. Checked for every item before any is written; one failure fails the whole batch with 412.
if_none_matchstringNo* to write this item only if the key does not exist (or has expired). Any other value is rejected with 400. Checked for every item before any is written; one failure fails the whole batch with 412.
ttlintegerNoLifetime in seconds from now. 0 or omitted stores without expiry; negative is rejected.
Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/batch/set?db=app.db' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"items": [{"key": "user:1", "value": "{\"name\":\"Alice\",\"age\":30}", "content_type": "application/json"}, {"key": "user:2", "value": "SGVsbG8gV29ybGQ=", "content_type": "text/plain"}]}'

Values stored successfully.

The response includes an Idempotent-Replayed header that is true when this is the stored response of an earlier request with the same Idempotency-Key.

{
"success": true,
"count": 2,
"items": [
{"key": "user:1", "etag": "a1b2c3d4e5f6"},
{"key": "user:2", "etag": "f6e5d4c3b2a1"}
]
}
FieldTypeRequiredDescription
countintegerYesNumber of items stored.
itemsarray of objectsYesOne entry per item, in request order, with the key’s ETag after the batch (for a key written twice, both entries carry the final ETag).
items[].keystringYesThe key.
items[].etagstringYesThe key’s ETag after the batch.
successbooleanYesAlways true on a 200.

Delete multiple keys in a single transaction (max 100 keys). Each item can carry an if_match condition for compare-and-swap semantics. A 412 response rolls back the entire batch.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
tablequerystringNoCustom table name. Default: kv_store
historyquerybooleanNoStore this write’s value in history; false records only that the write happened, not what it wrote. Default: true
Idempotency-KeyheaderstringNoReplays the stored response for a repeat of the same key (24 h).
create_db_if_missingquerybooleanNoCreate database file if it is missing. The legacy alias auto_create is still accepted and means the same thing; the two must agree when both are sent. Default: false
timeoutqueryintegerNoServer-side deadline in whole seconds, clamped to [1, 300]. Default: 30

Send one of items or keys, not both.

FieldTypeRequiredDescription
itemsarray of objectsNoKeys to delete, each with an optional if_match condition. 1-100 entries.
keysarray of stringsNoKeys to delete. 1-100 entries; no entry may be empty or whitespace-only.

Each item in items has the following fields:

FieldTypeRequiredDescription
keystringYesKey to delete. Must not be empty or whitespace-only.
if_matchstringNoDelete this key only if its current ETag is one of these (a comma-separated list of strong entity-tags, as in the If-Match header), or * for “the key exists”. Checked for every item before any key is deleted; one failure fails the whole batch with 412.
Terminal window
curl -X POST 'https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/kv/batch/delete?db=app.db' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"keys": ["user:1", "user:2"]}'

Keys deleted successfully.

The response includes an Idempotent-Replayed header that is true when this is the stored response of an earlier request with the same Idempotency-Key.

{
"success": true,
"deleted": 2
}
FieldTypeRequiredDescription
deletedintegerYesNumber of keys that existed and were deleted.
successbooleanYesAlways true on a 200.