Data API
The data API runs SQL against a Quotura database over HTTPS, so Vercel Edge, Cloudflare Workers, Deno and serverless functions can query without TCP connections. Send POST requests with a project API key as a bearer token. It supports parameterized queries, scripts and interactive transactions, and the Facet http adapter wraps it.
Last reviewed
Endpoints
All endpoints are POST https://console.quotura.com/v1/databases/:name/... with Authorization: Bearer fct_live_... (an API key from the database's project) and a JSON body. :name is the database's name.
| Endpoint | Body | Result |
|---|---|---|
/query | { sql, params? } | { rows, rowCount, fields } |
/exec | { sql } | Runs a script of several statements, without params |
/transactions | { timeoutMs? } | { id, expiresAt }: opens a transaction |
/transactions/:id/query, /exec | as above | Runs inside the transaction |
/transactions/:id/commit, /rollback | {} | Ends the transaction |
curl https://console.quotura.com/v1/databases/main/query \
-H "Authorization: Bearer $QUOTURA_API_KEY" -H "content-type: application/json" \
-d '{"sql":"SELECT id, email FROM users WHERE id = $1","params":[42]}'With the Facet ORM
import { FacetClient, http } from './generated/index.js';
const db = new FacetClient({ adapter: http({ url: 'https://console.quotura.com', apiKey: process.env.QUOTURA_API_KEY, database: 'main' }) });
const users = await db.user.findMany({ take: 10 });The generated Postgres client imports only an edge-safe entry point. Migrations can run over the data API too.
Limits and errors
| Rule | Response |
|---|---|
| Statements time out after 30 seconds | 408 STATEMENT_TIMEOUT |
| Results over 10 MB | 413 RESULT_TOO_LARGE: use LIMIT or paginate |
| Requests per second per key | 429 RATE_LIMITED with retry-after |
| Daily queries per org: Starter 500,000, Pro 5,000,000 (each statement of a script counts) | 429 QUOTA_EXCEEDED until midnight UTC |
| Query results per day: Starter 1 GB, Pro 5 GB | 429 TRANSFER_QUOTA_EXCEEDED until midnight UTC |
| A transaction ends after its idle timeout (15 s by default), 60 s in total, or a failed statement | Rolled back; then 404 TRANSACTION_NOT_FOUND |
| At most 5 open transactions per key | 429 TOO_MANY_TRANSACTIONS |
| Postgres errors | 400 QUERY_FAILED with the SQLSTATE in pgCode |
| No plan, or a failed payment | 402 PLAN_REQUIRED or 402 PAYMENT_REQUIRED |