Skip to content
Hoody.com

The SQLite service publishes its own OpenAPI document. Use these endpoints to fetch the specification in either format.

Redirects to the YAML specification endpoint at /api/v1/sqlite/openapi.yaml.

This endpoint takes no parameters.

Terminal window
curl -L https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/openapi.json
{
"description": "Redirects to YAML specification"
}

Retrieve the complete OpenAPI specification in YAML format.

This endpoint takes no parameters.

Terminal window
curl https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/openapi.yaml
openapi: 3.0.0
info:
title: SQLite API
version: "1.0.0"
paths:
/api/v1/sqlite/db:
post:
summary: Execute SQL transaction

Create a new empty SQLite database file. Optionally initialize the KV-store tables used by the key-value endpoints.

NameInTypeRequiredDescription
pathquerystringYesDatabase path. Accepts an absolute path, a bare name, or a ./name shorthand that resolves to /hoody/databases/*.db.
init_kvquerybooleanNoInitialize KV store tables. Default: false.
kv_tablequerystringNoCustom KV table name. Default: kv_store.

This endpoint accepts no request body.

Terminal window
curl -X POST "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/db/create?path=my-database.db&init_kv=true&kv_table=kv_store"
{
"path": "/hoody/databases/my-database.db",
"created": true,
"kvInitialized": true
}

Execute multiple SQL statements in a single transaction with full ACID guarantees. All statements in the transaction array run atomically; a failure rolls the entire transaction back.

NameInTypeRequiredDescription
dbquerystringYesDatabase path. Accepts an absolute path, a bare name, or a ./name shorthand that resolves to /hoody/databases/*.db.
create_db_if_missingquerybooleanNoCreate the database file if it does not exist. Default: false.

The body is a JSON object that follows the sqlite_main.request schema. Top-level fields:

FieldTypeRequiredDescription
resultFormatstringNoControls the result serialization format. Use "json" for typed JSON output.
transactionarrayNoOrdered list of statements to execute atomically. Practically required: the endpoint is a no-op when this field is empty or omitted.

Each item in transaction follows the sqlite_main.requestItem schema:

FieldTypeRequiredDescription
statementstringNoSQL statement to execute. Preferred field.
sqlstringNoAlias for statement, kept for backward compatibility.
querystringNoAlternate statement field name.
valuesarray of integerNoParameter values bound to the prepared statement placeholders.
valuesBatcharray of array of integerNoMultiple parameter sets; each inner array is applied as a separate row.
noFailbooleanNoWhen true, row-level parse failures are reported in rowErrors instead of aborting the statement.
Terminal window
curl -X POST "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/db?db=my-database.db&create_db_if_missing=true" \
-H "Content-Type: application/json" \
-d '{
"resultFormat": "json",
"transaction": [
{
"statement": "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)",
"noFail": true
},
{
"statement": "INSERT INTO users (name, email) VALUES (?, ?)",
"values": ["Ada", "ada@example.com"]
}
]
}'
{
"results": [
{
"success": true,
"rowsUpdated": 0
},
{
"success": true,
"rowsUpdated": 1
}
]
}

Execute a SQL query using a base64-encoded SQL string. Useful for shareable URLs that embed the query inline.

NameInTypeRequiredDescription
dbquerystringYesDatabase file path.
sqlquerystringYesBase64-encoded SQL query.

This endpoint accepts no request body.

Terminal window
SQL_B64=$(printf "SELECT id, name FROM users LIMIT 10" | base64)
curl "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/query?db=my-database.db&sql=${SQL_B64}"
{
"resultSet": [
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Grace" }
],
"rowsAffected": 0
}

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

  • wal_checkpoint_truncate — runs PRAGMA wal_checkpoint(TRUNCATE).
  • vacuum_into — runs VACUUM INTO dest_path. The dest_path is jailed like the db parameter and must not already exist.
  • quick_check — runs PRAGMA quick_check. The result field in the response 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 VACUUM operations can extend the request deadline via ?timeout=, clamped to 5 minutes (300 seconds).

NameInTypeRequiredDescription
dbquerystringYesDatabase path. Accepts an absolute path, a bare name, or a ./name shorthand that resolves to /hoody/databases/*.db.
timeoutqueryintegerNoRequest deadline in seconds, clamped to [1, 300].

The body is a JSON object describing the maintenance operation.

FieldTypeRequiredDescription
opstringYesOne of wal_checkpoint_truncate, vacuum_into, or quick_check.
dest_pathstringNoDestination path for vacuum_into. Jailed like the db parameter and must not already exist.
Terminal window
# Truncate the WAL
curl -X POST "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/maintenance?db=my-database.db" \
-H "Content-Type: application/json" \
-d '{"op": "wal_checkpoint_truncate"}'
# Quick integrity check with extended deadline
curl -X POST "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/maintenance?db=my-database.db&timeout=120" \
-H "Content-Type: application/json" \
-d '{"op": "quick_check"}'
# VACUUM INTO a new file
curl -X POST "https://myproj-mycont-sqlite-1.eu-west-1.containers.hoody.icu/api/v1/sqlite/maintenance?db=my-database.db" \
-H "Content-Type: application/json" \
-d '{"op": "vacuum_into", "dest_path": "/hoody/databases/my-database-backup.db"}'
{
"op": "wal_checkpoint_truncate",
"result": "ok"
}