Skip to content
VaultDBDocs

REST API

Read and write a table's rows at /api/databases/{dbid}/tables/{table}/data.

Reading needs the Databases permission. Inserting, updating and deleting need Databases.edit. If the table has row-level policies, every operation on this page obeys them.

Read rows

curl "https://api.vaultdb.io/api/databases/shop/tables/orders/data?customer=ada&orderBy=total&orderDirection=DESC&limit=20" \
  -H "Authorization: Bearer $VAULTDB_API_KEY"
Query parameter Description
limit The most rows to return, from 1 to 1,000. Default 100. A larger or negative value means 1,000, and 0 means 1.
offset Rows to skip. Default 0.
orderBy A column to sort by.
orderDirection DESC sorts descending. Any other value sorts ascending.
any other name An equality filter: customer=ada returns rows where customer equals ada. Several filters must all match.

Filters only test equality. For ranges, LIKE, OR or joins, use raw SQL.

Response:

{
  "table": "orders",
  "data": [{ "id": 7, "customer": "ada", "total": 120.5, "created_at": "2026-10-01 09:30:00" }],
  "pagination": { "page": 1, "limit": 20, "total": 1, "pages": 1, "nextOffset": null }
}

total counts every row that matches the filters, not only the rows returned.

A page holds at most 16 MB of row data. When the rows are large, a page can hold fewer rows than limit, and pagination then also has "truncated": true. A single row larger than 16 MB is still returned, on a page of its own.

pages counts pages of limit rows, so when pages are cut there are more than it says.

To read the next page, send offset set to pagination.nextOffset. It is null after the last row. Do not add limit to the previous offset: when a page was cut short, that skips rows.

Insert rows

The body is { "data": ... }, where data is one row object or an array of row objects.

curl -X POST https://api.vaultdb.io/api/databases/shop/tables/orders/data \
  -H "Authorization: Bearer $VAULTDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": { "customer": "ada", "total": 120.5 } }'
curl -X POST https://api.vaultdb.io/api/databases/shop/tables/orders/data \
  -H "Authorization: Bearer $VAULTDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": [ { "customer": "ada", "total": 10 }, { "customer": "grace", "total": 20 } ] }'

Returns 201 with { "message", "lastRowId", "changes" }. For a bulk insert, lastRowId is the id of the last row inserted.

A bulk insert runs in one transaction: either every row is inserted or none is.

An insert is refused with 403 when:

  • it has more rows than your plan's rows per bulk insert,
  • the rows would take your account past its storage limit,
  • the table would pass your plan's rows per table,
  • a row-level insert policy does not allow one of the rows.

Update rows

The body is { "data": {...}, "where": {...} }. data holds the columns to set. where holds equality filters, which must all match. where must not be empty.

curl -X PUT https://api.vaultdb.io/api/databases/shop/tables/orders/data \
  -H "Authorization: Bearer $VAULTDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": { "total": 99 }, "where": { "id": 7 } }'

Returns { "message", "changes" }, where changes is the number of rows updated.

An update is refused with 403 when the new values, times the number of rows it changes, would take your account past its storage limit. The check counts the old values as kept, so it can refuse an update that would in fact have fit; update fewer rows at a time.

Delete rows

The body is { "where": {...} }, with the same equality filters as an update. where must not be empty.

curl -X DELETE https://api.vaultdb.io/api/databases/shop/tables/orders/data \
  -H "Authorization: Bearer $VAULTDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "where": { "id": 7 } }'

Returns { "message", "changes" }.

An update or delete with an empty where is refused with 400, so a missing filter cannot change or remove every row. To empty a table, drop it and create it again.

Change events

Inserts, updates and deletes made through this API, through GraphQL and through CSV import send webhooks and realtime events. Writes made with raw SQL or a scheduled query do not.