title: Quickstart
This guide gets you from a fresh account to a working query in about five minutes. It assumes you've signed up at app.database.pizza.
We'll use a fictional organization acme and a database production. Replace both with your own names throughout.
Organizations group your databases, members, and API keys. When you create one, its name becomes a slug — the URL-safe identifier used in every connection path.
acme.acme (lowercased, spaces turned into -).Your connection path always starts with the organization slug, then the database slug: acme/production.
Inside the acme organization, create a database named production.
production.Every programmatic connection authenticates with an API key, which doubles as your PostgreSQL password.
production database and go to API keys.local dev.A live key looks like pz_live_…. The docs use the placeholder pz_live_REPLACE_ME; substitute your real key.
Security: Treat the key like a password. Don't commit it to source control, and prefer environment variables. See API keys & permissions.
You have two equivalent options. Pick whichever fits your workflow.
curl -s https://db.database.pizza/acme/production/query \
-H "Authorization: Bearer pz_live_REPLACE_ME" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT 1 + 1 AS answer"}'
{
"columns": [{ "name": "answer", "type": "INTEGER" }],
"rows": [[2]],
"rowsReturned": 1,
"executionTimeMicro": 108,
"bytesRead": 4
}
The HTTP query API is documented in full at HTTP query API.
PGPASSWORD='pz_live_REPLACE_ME' psql \
"postgresql://u@db.database.pizza:5432/acme%2Fproduction?sslmode=disable" \
-c "SELECT 1 + 1 AS answer;"
Three details matter here:
acme/production — the slash is part of the name. In a connection URI it must be percent-encoded as acme%2Fproduction.sslmode=disable; your key and queries travel in cleartext over the wire.psql works, but the SQL you send is SQLite-style, not PostgreSQL. See PostgreSQL clients and Compatibility.Full details are in Connect and PostgreSQL clients.
Now create a table and read it back:
curl -s https://db.database.pizza/acme/production/query \
-H "Authorization: Bearer pz_live_REPLACE_ME" \
-H "Content-Type: application/json" \
-d '{"sql": "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT NOT NULL)"}'
Then insert and select:
curl -s https://db.database.pizza/acme/production/query \
-H "Authorization: Bearer pz_live_REPLACE_ME" \
-H "Content-Type: application/json" \
-d '{"sql": "INSERT INTO users (name, email) VALUES (?, ?)", "params": ["Ada", "ada@acme.example"]}'
curl -s https://db.database.pizza/acme/production/query \
-H "Authorization: Bearer pz_live_REPLACE_ME" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM users"}'
Note the ? placeholders with a params array — always pass values this way rather than concatenating them into the SQL string.
INTEGER PRIMARY KEY values are assigned automatically when omitted. PizzaSQL accepts UNIQUE, but does not currently enforce it; enforce email uniqueness in your application. See Constraints before relying on schema-level validation.