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
| Host | Purpose |
|---|---|
db.deltex.dev | Data plane — queries and transactions. This is the endpoint returned at signup and used by every SDK. |
api.deltex.dev | Compatibility alias for the data plane (routes to the engine via an extra hop — prefer db.deltex.dev). |
ctrl.deltex.dev | Control plane — auth, sessions, databases, API keys |
Authentication
Pass your API key as a Bearer token. Keys start with dtx_k_.
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.
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:
{
"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:
{ "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.
| Route | Description |
|---|---|
POST /v1/session | Exchange API key for a session token |
POST /v1/session/refresh | Extend expiry by another 24h |
DELETE /v1/session | Destroy 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
| Status | Meaning |
|---|---|
200 | Success (check success field for SQL-level errors) |
400 | Parse error / malformed request |
401 | Missing or invalid API key |
429 | Rate limit exceeded (free tier: 200 req/min per org) |