Docs Ordnary Web Services Ordnary Serverlite
Quickstart
Create a database, add a table in the SQL console, create an API token and query it from your app with curl, JavaScript or Python.
1. Create a database
- 1
Open Ordnary Serverlite
In the console's drawer choose Ordnary Serverlite, then Create database.
- 2
Name it
For example
production. Lowercase letters, digits,-and_. - 3
Keep Automatic placement
Or pick a location hint or the EU jurisdiction. Placement cannot be changed later.
- 4
Create
The database opens in the SQL console, ready to use.
2. Create a table
Paste this into the SQL console and press Run, or ⌘ Enter (on Windows and Linux Ctrl Enter):
CREATE TABLE users (
id INTEGER PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
name TEXT,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (email, name) VALUES
('ada@example.com', 'Ada'),
('linus@example.com', 'Linus');
SELECT * FROM users;Every statement gets its own result, with the rows and how many rows it read and wrote. The table now shows under the Tables tab.
3. Create an API token
Under Ordnary Serverlite, open API tokens. Give the token a name, choose Read and write, limit it to the production database and create it. Copy the secret: it is shown once. Put it in your app's environment:
ORDNARY_SQLITE_TOKEN=osq_<your-token>
4. Query from your app
curl https://serverlite.ordnary.com/v1/databases/production/query \
-H "Authorization: Bearer $ORDNARY_SQLITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM users WHERE email = ?", "params": ["ada@example.com"]}'async function query(sql: string, params: unknown[] = []) {
const res = await fetch("https://serverlite.ordnary.com/v1/databases/production/query", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ORDNARY_SQLITE_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ sql, params }),
});
const body = await res.json();
if (!res.ok) throw new Error(body.error.message);
return body.results[0].rows;
}
const users = await query("SELECT * FROM users WHERE email = ?", ["ada@example.com"]);
console.log(users);import os
import requests
def query(sql, params=()):
res = requests.post(
"https://serverlite.ordnary.com/v1/databases/production/query",
headers={"Authorization": f"Bearer {os.environ['ORDNARY_SQLITE_TOKEN']}"},
json={"sql": sql, "params": list(params)},
timeout=30,
)
body = res.json()
if not res.ok:
raise RuntimeError(body["error"]["message"])
return body["results"][0]["rows"]
print(query("SELECT * FROM users WHERE email = ?", ["ada@example.com"]))5. Check
{
"results": [
{
"rows": [
{ "id": 1, "email": "ada@example.com", "name": "Ada", "created_at": "2026-11-02 09:14:07" }
],
"meta": { "duration": 0.21, "changes": 0, "lastRowId": 0, "rowsRead": 1, "rowsWritten": 0, "sizeAfter": 16384 }
}
]
}