One API call. A live PostgreSQL database in ~30 seconds. Auto-deleted after your TTL. No keys, no signup, no cleanup.
Works with LangChain, LlamaIndex, AutoGPT, CrewAI — and any HTTP client. Use as a temporary PostgreSQL sandbox, AI agent memory store, or testing database.
Need longer-lived or higher-performance databases? Create a free account for persistent databases with no TTL.
/v1/ephemeral/createNo auth{
"ttl": 60 // minutes (1–60)
}{
"status": "success",
"data": {
"id": "a1b2c3d4...",
"status": "provisioning",
"ttlMinutes": 2,
"username": "myuser",
"password": "mypass", // shown once — save it
"database": "mydb",
"pollUrl": "/v1/ephemeral/a1b2c3d4"
}
}Host and connection string are not available yet — the database is still starting. Retrieve them from GET /v1/ephemeral/:id once status=running.
/v1/ephemeral/:idNo authRetrieves the current status of the database, the time remaining before auto-deletion, and — once the database is ready — the full connection details.
status=running. The TTL countdown starts at that moment. Use secondsRemaining to know how much time is left.{
"status": "success",
"data": {
"id": "a1b2c3d4...",
"status": "running",
"ttlMinutes": 2,
"secondsRemaining": 87,
"expiresAt": "2025-01-01T12:02:00Z",
"host": "a1b2c3d4.db.dbaas.dev",
"port": 31042,
"username": "myuser",
"password": "mypass",
"database": "mydb",
"connectionString": "postgresql://myuser:mypass@
a1b2c3d4.db.dbaas.dev:31042/mydb"
}
}/v1/ephemeral/:id/sqlNo auth · No driver needed{
"sql": "SELECT * FROM memory"
}Full DDL and DML supported. COPY ... FROM PROGRAM is blocked. Results capped at 500 rows.
{
"status": "success",
"data": {
"command": "SELECT 2",
"rowsAffected": 2,
"columns": ["id","role","content"],
"rows": [
{"id":1,"role":"user","content":"..."},
{"id":2,"role":"assistant","content":"..."}
],
"rowCount": 2
}
}requests, fetch, curl, or any HTTP client. Ideal for LangChain agents and sandboxed testing.import requests, time
API = "https://api.dbaas.dev/v1"
# Step 1 — Request a new ephemeral database
# Returns your credentials immediately (id, username, password, database name).
db = requests.post(f"{API}/ephemeral/create", json={"ttl": 3}).json()["data"]
db_id = db["id"]
print(f"Created: {db_id} user={db['username']} db={db['database']}")
# Step 2 — Wait for the database to be ready (~15–30s)
# Poll GET /:id — status goes provisioning → starting → running.
# Once running, secondsRemaining shows how long until auto-deletion.
for _ in range(30):
status = requests.get(f"{API}/ephemeral/{db_id}").json()["data"]["status"]
print(f" status: {status}")
if status == "running":
break
time.sleep(3)
# Step 3 — Run SQL over HTTP — no database driver or pg client needed
# Works from Python, Node, curl, or any tool that can send HTTP requests.
def sql(query):
return requests.post(
f"{API}/ephemeral/{db_id}/sql",
json={"sql": query}
).json()["data"]
sql("CREATE TABLE memory (id SERIAL, role TEXT, content TEXT)")
sql("INSERT INTO memory (role, content) VALUES ('user', 'What is 2+2?')")
sql("INSERT INTO memory (role, content) VALUES ('assistant', '4')")
result = sql("SELECT * FROM memory ORDER BY id")
for row in result["rows"]:
print(f"[{row['role']}] {row['content']}")
# → {"command":"SELECT 2","columns":["id","role","content"],"rows":[...],"rowCount":2}
# Step 4 — Auto-deleted at TTL expiry. No cleanup. No lingering resources.| HTTP Status | Reason |
|---|---|
| 400 | Invalid TTL (must be 1–60) or malformed JSON body — does not count against your rate limit |
| 404 | Database ID not found or already expired / deleted |
| 410 Gone | Database TTL has elapsed (expired) |
| 422 | SQL syntax error — response body contains the PostgreSQL error message |
| 429 (concurrent) | Already have 2 active ephemeral databases from this IP |
| 429 (rate limit) | Exceeded 5 successful creates per 10 minutes from this IP |
| 503 | Database not yet running — keep polling GET /:id until status=running |