Skip to content
Hoody.com

The SQLite service exposes HTTP endpoints for executing transactional SQL, creating databases, running shareable queries, and performing maintenance operations such as checkpoint, vacuum, and integrity check. Use these endpoints when you need programmatic access to a SQLite container outside of the WebSocket interface — for example, embedding a query in a URL, automating migrations, or running long-running VACUUMs that need a custom timeout.

All endpoints below run on the SQLite container host:

https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com

The SQLite service publishes its own OpenAPI document. The JSON endpoint redirects to the YAML form so the YAML is always the canonical source.

Redirects to the YAML specification endpoint.

This endpoint takes no parameters.

Terminal window
curl -L "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/openapi.json"

Retrieve the complete OpenAPI specification in YAML format.

This endpoint takes no parameters.

Terminal window
curl "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/openapi.yaml"

Execute a SQL query using base64-encoded SQL for easy sharing via URL. The sql parameter accepts a base64-encoded SQL string; the result is returned in the body.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path
sqlquerystringYesBase64-encoded SQL query
Terminal window
curl -G "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/query" \
--data-urlencode "db=app.db" \
--data-urlencode "sql=U0VMRUNUICogRlJPTSB1c2Vycw=="

Create a new empty SQLite database. The database file is initialized at the given path; if init_kv=true, the schema for a KV store is also created so the database can be used with directory-style KV operations.

NameInTypeRequiredDescription
pathquerystringYesDatabase path (absolute path, bare name, or ./name shorthand resolved to /hoody/databases/*.db)
init_kvquerybooleanNoInitialize KV store tables. Default: false
kv_tablequerystringNoCustom KV table name. Default: "kv_store"
Terminal window
curl -X POST "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/db/create?path=app.db&init_kv=true&kv_table=kv_store"

Run a maintenance operation that cannot execute inside the transactional POST /db endpoint. Supported operations are:

  • wal_checkpoint_truncate — runs PRAGMA wal_checkpoint(TRUNCATE).
  • vacuum_into — runs VACUUM INTO dest_path; the destination is jailed like the db parameter and must not already exist.
  • quick_check — runs PRAGMA quick_check; result carries the first result row, which is "ok" on a healthy database.

The operation runs directly on the database connection, fenced from concurrent query handlers. The database is never created — a missing file returns 404. Long VACUUMs can extend the request deadline via the ?timeout= query parameter (clamped to 5m).

NameInTypeRequiredDescription
dbquerystringYesDatabase path (absolute path, bare name, or ./name shorthand resolved to /hoody/databases/*.db)
timeoutqueryintegerNoRequest deadline in seconds (clamped to [1, 300])

The body is an open JSON object describing the maintenance operation. It carries the op selector (wal_checkpoint_truncate, vacuum_into, or quick_check) and, for vacuum_into, the required dest_path.

Terminal window
curl -X POST "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/maintenance?db=app.db&timeout=300" \
-H "Content-Type: application/json" \
-d '{ "op": "wal_checkpoint_truncate" }'

Execute multiple SQL queries or statements in a single transaction with full ACID guarantees. Each entry in the transaction array runs in order; if any statement fails (and noFail is not set), the whole transaction rolls back.

NameInTypeRequiredDescription
dbquerystringYesDatabase path (absolute path, bare name, or ./name shorthand resolved to /hoody/databases/*.db)
create_db_if_missingquerybooleanNoCreate database file if it is missing. Default: false

The body is a sqlite_main.request object:

FieldTypeRequiredDescription
resultFormatstringNoControls the response shape; for example "json".
transactionarrayNoOrdered list of statements to run inside the transaction.

Each item in transaction is a sqlite_main.requestItem with the following fields:

FieldTypeRequiredDescription
statementstringNoSQL statement to execute. Preferred field.
sqlstringNoAlias for statement.
querystringNoAlias for statement.
noFailbooleanNoWhen true, the transaction continues past a failure on this item.
valuesarray of integerNoPositional bind values for the statement.
valuesBatcharray of array of integerNoMultiple parameter sets; each inner array is one row for the same statement.
Terminal window
curl -X POST "https://{projectId}-{containerId}-sqlite-1.{server}.containers.hoody.com/api/v1/sqlite/db?db=app.db&create_db_if_missing=true" \
-H "Content-Type: application/json" \
-d '{
"resultFormat": "json",
"transaction": [
{
"statement": "CREATE TABLE IF NOT EXISTS counters (id INTEGER PRIMARY KEY, hits INTEGER, visits INTEGER)",
"noFail": true
},
{
"statement": "INSERT INTO counters (id, hits, visits) VALUES (?, ?, ?)",
"values": [1, 42, 7]
},
{
"statement": "SELECT id, hits, visits FROM counters ORDER BY id DESC LIMIT 1"
}
]
}'