Docs / HTTP API

HTTP API

Everything in Deltex is an HTTPS request. There is no persistent connection, no wire protocol to implement — just JSON over HTTP, which means it works from any language and any runtime, including edge functions.

Endpoints

HostPurpose
db.deltex.devData plane — queries and transactions. This is the endpoint returned at signup and used by every SDK.
api.deltex.devCompatibility alias for the data plane (routes to the engine via an extra hop — prefer db.deltex.dev).
ctrl.deltex.devControl plane — auth, sessions, databases, API keys

Authentication

Pass your API key as a Bearer token. Keys start with dtx_k_.

http
Authorization: Bearer dtx_k_your_key

Browser clients must call ctrl.deltex.dev directly for control-plane routes (sessions, databases, keys). Calling them via api.deltex.dev returns a redirect that browsers CORS-taint.

POST /v1/query

Run a single SQL statement. Body is JSON with a sql field.

bash
curl -X POST https://db.deltex.dev/v1/query \
  -H 'Authorization: Bearer dtx_k_...' \
  -H 'Content-Type: application/json' \
  -d '{"sql":"SELECT * FROM users WHERE id = 1"}'

Response shape:

json
{
  "success": true,
  "columns": ["id", "name"],
  "rows": [{ "id": 1, "name": "Alice" }],
  "affected_rows": 1,
  "timings": { "total_us": 1840, "exec_us": 120 }
}

POST /query

The same as /v1/query but takes the raw SQL string as a text/plain body instead of JSON. Handy for quick scripts.

POST /v1/transaction

Run multiple statements atomically (serializable, optimistic two-phase commit). Send an array of SQL strings:

json
{ "statements": [
  "UPDATE accounts SET bal = bal - 100 WHERE id = 1",
  "UPDATE accounts SET bal = bal + 100 WHERE id = 2"
] }

Sessions

Exchange an API key for a short-lived session token (24h TTL) — used by the console so the raw key never lives in browser storage.

RouteDescription
POST /v1/sessionExchange API key for a session token
POST /v1/session/refreshExtend expiry by another 24h
DELETE /v1/sessionDestroy the session (logout)

Streaming

Prefix a query with the /*+ STREAM */ hint to receive results as Server-Sent Events (text/event-stream) with columns, row, and done events — rows are streamed individually with zero buffering.

Errors & limits

StatusMeaning
200Success (check success field for SQL-level errors)
400Parse error / malformed request
401Missing or invalid API key
429Rate limit exceeded (free tier: 200 req/min per org)