Docs / Developer tools
Throwaway databases API
A private SQLite database for a day, over HTTP.
For tests, demos, teaching SQL and agents that need somewhere to put rows. Up to 10 MB, one statement at a time, three seconds each. No database port: SQL goes over HTTPS. The database demo (secret demo) is read-only and holds the states of India. Each caller may hold 5 bins and databases at a time; each lasts a day, in memory or a temporary file, and is gone after a restart.
https://api.dharun.devNo key needed for most600 units a minute, 3000 with a free keyThis page as MarkdownMake a database
POST/v1/db
Answers with its query address and secret (shown once). Needs a free API key once keys are required (see /keys).
Send: Nothing, or {} .
Model endpoint: it will need a free API key, sent as Authorization: Bearer <key> or X-API-Key. Until the date on API keys it answers without one and says so in the X-Key-Notice header. With a key: 500 model requests a day.
What you send here is never written to the log, and the answer is not cached.
curl
curl -H "Content-Type: application/json" --data '{}' "https://api.dharun.dev/v1/db?utm_medium=docs"JavaScript
const response = await fetch("https://api.dharun.dev/v1/db?utm_medium=docs", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.post("https://api.dharun.dev/v1/db?utm_medium=docs", data="{}", headers={"Content-Type": "application/json"}, timeout=60)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])invoice.json
{}Try it here
Change the values and send the request from your browser. Needs JavaScript.
Run SQL
POST/v1/db/{id}/query
SQLite SQL, with ? parameters. Answers columns, rows (up to 1,000) and the rows changed. ATTACH, VACUUM and most PRAGMAs are refused. Send the secret as an X-Secret header.
Send: The SQL as text, or JSON {"sql": "...", "params": [...]}.
What you send here is never written to the log, and the answer is not cached.
curl
curl -H "Content-Type: application/json" --data '{"sql": "SELECT code, name FROM states WHERE name LIKE ? ORDER BY name", "params": ["T%"]}' "https://api.dharun.dev/v1/db/demo/query?secret=demo&utm_medium=docs"JavaScript
const response = await fetch("https://api.dharun.dev/v1/db/demo/query?secret=demo&utm_medium=docs", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({"sql": "SELECT code, name FROM states WHERE name LIKE ? ORDER BY name", "params": ["T%"]}),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.post("https://api.dharun.dev/v1/db/demo/query?secret=demo&utm_medium=docs", data="{\"sql\": \"SELECT code, name FROM states WHERE name LIKE ? ORDER BY name\", \"params\": [\"T%\"]}", headers={"Content-Type": "application/json"}, timeout=60)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])invoice.json
{"sql": "SELECT code, name FROM states WHERE name LIKE ? ORDER BY name", "params": ["T%"]}Try it here
Change the values and send the request from your browser. Needs JavaScript.
Response
{
"data": {
"changes": 1,
"columns": [
"code",
"name"
],
"ms": 0,
"rows": [
[
"TN",
"Tamil Nadu"
],
[
"TS",
"Telangana"
],
[
"TR",
"Tripura"
]
]
},
"meta": {
"note": "One statement at a time, three seconds each, at most 1,000 rows back. ATTACH, VACUUM and most PRAGMAs are refused."
}
}Delete a database
POST/v1/db/{id}/delete
Deletes the database at once. Send the secret as an X-Secret header.
Send: Nothing, or {} .
What you send here is never written to the log, and the answer is not cached.
curl
curl -H "Content-Type: application/json" --data '{}' "https://api.dharun.dev/v1/db/demo/delete?secret=demo&utm_medium=docs"JavaScript
const response = await fetch("https://api.dharun.dev/v1/db/demo/delete?secret=demo&utm_medium=docs", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.post("https://api.dharun.dev/v1/db/demo/delete?secret=demo&utm_medium=docs", data="{}", headers={"Content-Type": "application/json"}, timeout=60)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])invoice.json
{}Try it here
Change the values and send the request from your browser. Needs JavaScript.
Response
{
"data": {
"deleted": false,
"id": "demo"
},
"meta": {
"note": "The demo database is never deleted."
}
}Using an AI assistant? Connect the MCP server and it can call this API by itself. Want every endpoint on one bench? Open the playground.