Confluye
Endpoints

Databases

Manage tables and rows, import data, and run SQL queries via the API.

Endpoints for databases under /api/v1/databases.

Endpoints

MethodPathDescription
GET/api/v1/databasesList tables
POST/api/v1/databasesCreate a table
PATCH/api/v1/databases/{tableId}Update a table
GET/api/v1/databases/{tableId}/rowsList rows
POST/api/v1/databases/{tableId}/rowsInsert rows
PATCH/api/v1/databases/{tableId}/rowsUpdate rows
DELETE/api/v1/databases/{tableId}/rowsDelete rows
GET/api/v1/databases/{tableId}/exportExport a table
POST/api/v1/databases/importImport data (CSV)
POST/api/v1/databases/queryRun a SQL query

Tables and rows

GET /api/v1/databases returns { databases[], tables[] } for the workspace.

POST /api/v1/databases creates a database (when only databaseName is given) or a table:

FieldTypeNotes
databaseNamestringTarget database (required)
tableNamestringIf present, creates a table in that database
columnsarrayColumn definitions; type ∈ text | number | status | date | json
rowsarrayOptional initial rows; scalar columns keep their documented scalar values, while a json column accepts any JSON value, including arrays, objects, booleans, and null

GET /api/v1/databases/{tableId}/rows supports limit and offset and returns { table, rows[], pagination: { limit, offset, returned, total } }. POST inserts one row ({ values }), PATCH updates by { rowIndex, values }, and DELETE removes by { rowIndex }. PATCH /api/v1/databases/{tableId} trashes a table ({ trashed }) or adds a column ({ column, defaultValue }).

Each row's values object must name only declared columns. Scalar columns accept strings or finite numbers; values supplied as JavaScript numbers (not strings) must be finite. A partial PATCH updates only the supplied keys and leaves every other cell untouched, including cells stored as absent or JSON null. Structured values are valid only in columns declared as json. Invalid table creation, inserts, or updates return 400 (BAD_REQUEST in tRPC); they are never surfaced as an internal-server error. JSON exports preserve the original structure, while CSV exports serialize each JSON cell as compact JSON text.

Import CSV

POST /api/v1/databases/import is multipart/form-data only:

FieldNotes
fileRequired, .csv / CSV mime; max 5 MB (413), non-CSV → 415
databaseId / databaseNameTarget database
tableNameDefaults to a cleaned-up filename
hasHeadertrue/1/yes, default true
delimiterOptional delimiter override (auto-detected otherwise)
columnsJSON array of { name, type } type overrides

Returns 201 with { table, stats, rowsUrl }. Malformed CSV returns 422 { error, code }.

Run a SQL query

POST /api/v1/databases/query runs a read-only query against one database's tables:

{ "databaseId": "db_...", "sql": "SELECT * FROM \"orders\" WHERE total > 100 LIMIT 100" }

Both fields are required. Queries are SELECT-only and run in a sandbox over the database's tables (never against Postgres). Success returns { columns, rows, truncated, durationMs }. A missing database returns 404; a slow query returns 408 { error, code, availableTables }; other SQL errors return 400. See Databases & SQL for the constraints.

Export

GET /api/v1/databases/{tableId}/export?format=csv|json (default json) returns the table as a downloadable file with a Content-Disposition: attachment header.

Next steps