Quickstart
1. Sign up
Section titled “1. Sign up”curl -X POST https://postdb.dev/api/auth/signup \ -H "Content-Type: application/json" \ -d '{"orgName": "acme", "email": "you@acme.com"}'Save your apiKey.
2. Run a query
Section titled “2. Run a query”curl -X POST https://postdb.dev/api/query \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT NOW() AS current_time" }'3. Run a transaction
Section titled “3. Run a transaction”curl -X POST https://postdb.dev/api/transaction \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "statements": [ {"sql": "INSERT INTO orders (user_id, total) VALUES ($1, $2)", "params": ["user-123", 99.99]}, {"sql": "UPDATE balances SET amount = amount - $1 WHERE user_id = $2", "params": [99.99, "user-123"]} ] }'Both statements commit atomically or both roll back.
4. Run a migration
Section titled “4. Run a migration”curl -X POST https://postdb.dev/api/migrations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "create_orders", "sql": "CREATE TABLE orders (id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id TEXT NOT NULL, total NUMERIC NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW())" }'