REST API
Full OpenAPI 3.1 spec. Use from curl, Node.js, Python, Go, or any HTTP client. Ephemeral endpoints require no authentication.
OpenAPI 3.1 spec
Import into ChatGPT, Postman, Insomnia, or generate a typed client.
Authentication
Ephemeral endpoints
No auth required. Open to all. Rate limited by IP.
POST /v1/ephemeral/create
GET /v1/ephemeral/:id
POST /v1/ephemeral/:id/sqlPersistent endpoints
Requires API key in Authorization header.
Authorization: Bearer dbaas_live_โฆEndpoint reference
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /v1/ephemeral/create | none | Create ephemeral database |
| GET | /v1/ephemeral/:id | none | Get status + connection info |
| POST | /v1/ephemeral/:id/sql | none | Execute SQL (ephemeral) |
| GET | /v1/resources/list | API key | List all your databases |
| POST | /v1/services/create | API key | Provision persistent database |
| GET | /v1/resources/:id/address | API key | Get host / port / credentials |
| POST | /v1/resources/:id/sql | API key | Execute SQL (persistent) |
| POST | /v1/resources/:id/stop | API key | Stop database |
| POST | /v1/resources/:id/start | API key | Start database |
| DELETE | /v1/resources/:id | API key | Delete database |
| GET | /v1/resources/:id/backups | API key | List backups |
| POST | /v1/resources/:id/backups/trigger | API key | Trigger manual backup |
| POST | /v1/resources/:id/backups/:bid/restore | API key | Restore from backup |
| GET | /v1/resources/:id/metrics | API key | CPU / memory / storage metrics |
Code examples
๐
curl โ ephemeral (no auth)
# 1. Create an ephemeral database (auto-deletes after TTL minutes)
curl -s -X POST https://api.dbaas.dev/v1/ephemeral/create \
-H "Content-Type: application/json" \
-d '{"ttl":10}' | jq .
# 2. Poll until status == "running" (~30s)
curl -s https://api.dbaas.dev/v1/ephemeral/<id> | jq .data.status
# 3. Run SQL
curl -s -X POST https://api.dbaas.dev/v1/ephemeral/<id>/sql \
-H "Content-Type: application/json" \
-d '{"sql":"SELECT version()"}' | jq .data.rows๐
curl โ persistent (API key)
# List your databases
curl -s https://api.dbaas.dev/v1/resources/list \
-H "Authorization: Bearer dbaas_live_your_key_here" | jq .
# Run SQL on a persistent database
curl -s -X POST https://api.dbaas.dev/v1/resources/<id>/sql \
-H "Authorization: Bearer dbaas_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"sql":"SELECT count(*) FROM users"}' | jq .data.rows๐จ
Node.js / TypeScript
import fetch from "node-fetch"; // or global fetch in Node 18+
const API = "https://api.dbaas.dev/v1";
const KEY = process.env.DBAAS_API_KEY;
// List databases
const res = await fetch(`${API}/resources/list`, {
headers: { Authorization: `Bearer ${KEY}` },
});
const { data } = await res.json();
console.log(data); // array of database objects
// Run SQL
const sql = await fetch(`${API}/resources/${data[0].id}/sql`, {
method: "POST",
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ sql: "SELECT NOW()" }),
});
const result = await sql.json();
console.log(result.data.rows);๐
Python
import os, requests
API = "https://api.dbaas.dev/v1"
KEY = os.environ["DBAAS_API_KEY"]
HEADERS = {"Authorization": f"Bearer {KEY}"}
# List databases
dbs = requests.get(f"{API}/resources/list", headers=HEADERS).json()
db_id = dbs["data"][0]["id"]
# Run SQL
result = requests.post(
f"{API}/resources/{db_id}/sql",
headers={**HEADERS, "Content-Type": "application/json"},
json={"sql": "SELECT NOW()"},
).json()
print(result["data"]["rows"])Rate limits
| Client type | Global limit | SQL / mutation limit |
|---|---|---|
| Anonymous (no key) | 60 req / min per IP | 10 mutations / min per IP |
| API key | Bypasses IP limit | 60 mutations / min per key ยท 60 SQL / min per DB |