Quick Navigation
API Reference
Complete reference for the SoliDB HTTP API. All endpoints are prefixed with /_api unless otherwise noted.
Databases
/_api/database
Create a new database.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | The name of the database. | Yes |
Response
/_api/databases
List all existing databases.
Response
/_api/database/:name
Drop a database and all its collections.
Response
Collections
/_api/database/:db/collection
Create a new collection.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | The name of the collection. | Yes |
| type | string | Collection type: document (default), edge, or blob. |
No |
| numShards | integer | Number of shards. Default: 1. | No |
| shardKey | string | Field to shard by. Default: _key. |
No |
| replicationFactor | integer | Number of replicas. Default: 1. | No |
Response
/_api/database/:db/collection
List all collections in a database.
Response
/_api/database/:db/collection/:name/stats
Get collection statistics (count, size).
Response
/_api/database/:db/collection/:name/properties
Update collection properties (e.g. sharding).
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| numShards | integer | New number of shards (triggers rebalance). | No |
| replicationFactor | integer | New replication factor. | No |
/_api/database/:db/collection/:name/truncate
Remove all documents from a collection.
Response
/_api/database/:db/collection/:name/compact
Trigger compaction for a collection to reclaim space.
Response
/_api/database/:db/collection/:name
Drop a collection.
Response
/_api/database/:db/collection/:name/export
Export collection data.
Response
/_api/database/:db/collection/:name/import
Import data into collection.
Supported Formats
Send raw data in the request body. Format is auto-detected:
- JSON Array:
[{"name": "a"}, {"name": "b"}] - JSONL: Newline-delimited JSON objects.
- CSV: Comma-separated values (first row as headers).
Documents
/_api/database/:db/document/:collection
Create a new document.
Request Body Options
Send a JSON object representing the document. The _key field is optional; if omitted, one will be auto-generated.
Response
/_api/database/:db/document/:collection/:key
Retrieve a document by key.
Response
/_api/database/:db/document/:collection/:key
Replace/Update a document.
Response
/_api/database/:db/document/:collection/:key
Remove a document.
Response
SDBQL Queries
/_api/database/:db/cursor
Execute an SDBQL query.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| query | string | The SDBQL query string. | Yes |
| bindVars | object | Key-value pairs for bind parameters. | No |
| batchSize | integer | Max documents per batch. Default: 100. | No |
Response
/_api/database/:db/explain
Explain query execution plan.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| query | string | The SDBQL query to explain. | Yes |
| bindVars | object | Key-value pairs for bind parameters. | No |
/_api/cursor/:id
Fetch next batch of results for a cursor.
Response
/_api/cursor/:id
Close a cursor and free resources.
Response
Indexes
/_api/database/:db/index/:collection
Create a new index for a collection.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | The name of the index. | Yes |
| field | string | The document field to index (e.g., "email"). | Yes |
| type | string |
Index type. Options: persistent (default), hash, fulltext.
|
No |
| unique | boolean | If true, enforces uniqueness on the indexed field. Default: false. |
No |
Response
/_api/database/:db/index/:collection
List all indexes for a collection.
Response
/_api/database/:db/index/:collection/rebuild
Rebuild all indexes for a collection.
Response
/_api/database/:db/index/:collection/:name
Drop an index.
Response
/_api/database/:db/geo/:collection
Create a geo-spatial index.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | Index name. | Yes |
| field | string | Field to index (must contain [lat, lon] array or object). | Yes |
Response
/_api/database/:db/geo/:collection/:field/near
Find documents near a coordinate.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| lat | float | Latitude. | Yes |
| lon | float | Longitude. | Yes |
| limit | integer | Max results. Default: 10. | No |
Response
/_api/database/:db/geo/:collection/:field/within
Find documents within a radius.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| lat | float | Latitude. | Yes |
| lon | float | Longitude. | Yes |
| radius | float | Radius in meters (approx). | Yes |
Response
Lua Scripts Management
/_api/database/:db/scripts
Register a new Lua script.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | Friendly name of the script. | Yes |
| path | string | URL path segment (e.g. "greet"). | Yes |
| methods | array | Allowed HTTP methods (["GET", "POST"]). | Yes |
| code | string | The Lua source code. | Yes |
Response
/_api/database/:db/scripts
List all registered scripts.
Response
/_api/database/:db/scripts/:id
Update an existing script.
/_api/database/:db/scripts/:id
Delete a script.
Binary Data (Blobs)
/_api/blob/:db/:collection
Upload a blob.
Request Body Options
Requires multipart/form-data with a single field named file containing the binary data.
Response
/_api/blob/:db/:collection/:key
Download a blob.
Response
/_api/database/:db/document/:collection/:key
Delete a blob.
Uses the standard document deletion endpoint. This removes the metadata document and cleans up the associated binary data from storage.
Response
Transactions
/_api/database/:db/transaction/begin
Begin a new transaction.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| isolationLevel | string | Isolation level: read_committed (default), read_uncommitted, repeatable_read, serializable. |
No |
Response
/_api/database/:db/transaction/:tx_id/commit
Commit a transaction.
Response
/_api/database/:db/transaction/:tx_id/rollback
Rollback a transaction.
Response
Cluster
/_api/cluster/status
Get cluster node status and peers.
Response
/_api/cluster/info
Get general cluster information.
Response
/_api/cluster/remove-node
Remove a node from the cluster.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| node_address | string | Address of the node to remove (e.g. "localhost:6775"). | Yes |
Response
/_api/cluster/rebalance
Trigger manual cluster rebalancing.
/_api/cluster/status/ws
WebSocket endpoint for live cluster status updates.
Authentication
On first startup, an admin user is created with a randomly generated password shown in the server logs. Save this password!
/auth/login
Authenticate and receive a JWT token.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| username | string | Username (e.g., "admin"). | Yes |
| password | string | User's password. | Yes |
Response
/_api/auth/password
Change current user's password.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| current_password | string | Current password. | Yes |
| new_password | string | New password. | Yes |
Response
/_api/auth/api-keys
Create a new API key.
Request Body Options
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | Name/Description for the API key. | Yes |
Response
/_api/auth/api-keys
List active API keys.
Response
/_api/auth/api-keys/:key_id
Revoke an API key.