Chelabase
Data API

Data API

Read and write a branch's tables over one HTTP endpoint with per-branch keys.

Apps read and write a branch's tables over POST /data/v1/query with per-branch keys. The gateway checks the key; the rest service (services/rest) turns the request into SQL and runs it.

Endpoints

EndpointDoes
POST /data/v1/queryRuns one operation (or a batch) from a JSON tree. See Query language.
GET /data/v1/schemaDescribes what the key's role can reach. ?database=<name> picks another served database; the response's databases lists the served databases the key reaches.
GET /data/v1/typesThe generated db.ts (or JSON with format=json) for the key's schema. See Generated types.

All three take the key in the Authorization: Bearer <key> header. GET /data/v1/schema and GET /data/v1/types need a secret key: a public key gets 401 unauthorized. Requests go to the gateway (http://api.chelabase.localhost:8000 in development).

curl -s http://api.chelabase.localhost:8000/data/v1/query \
  -H "Authorization: Bearer $CHELABASE_DATA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "v": 1, "op": "select", "from": "orders", "limit": 10 }'

The body is limited to 1 MiB. A failed request answers {"error": {"code", "message", "detail"?, "hint"?, "sqlstate"?}}; every status and code is listed once, on Error codes.

Where to go next

On this page