Documentation

SQL & Database

Every project gets a dedicated PostgreSQL 17 database. Run SQL over HTTP — parameterized queries, returned rows as JSON, no driver to install.

Pre-installed extensions

Run a query

# Create a table
curl -X POST $API/{slug}/sql \
  -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{
    "query": "CREATE TABLE users (id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), email TEXT UNIQUE, name TEXT, created_at TIMESTAMPTZ DEFAULT NOW())"
  }'

# Insert with parameterized values
curl -X POST $API/{slug}/sql \
  -H "X-API-Key: $KEY" \
  -d '{
    "query": "INSERT INTO users (email, name) VALUES ($1, $2) RETURNING *",
    "params": ["alice@example.com", "Alice"]
  }'

# Select
curl -X POST $API/{slug}/sql \
  -H "X-API-Key: $KEY" \
  -d '{
    "query": "SELECT * FROM users WHERE email = $1",
    "params": ["alice@example.com"]
  }'
SecurityNever concatenate user input into SQL strings. Always use $1, $2 parameters. SQL injection on the platform's response surface is the same risk it always was — the API will run whatever you send.

Best practices

pgvector — AI embeddings

# Schema
CREATE TABLE documents (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  content TEXT,
  embedding vector(1536)        -- OpenAI ada-002 size; adjust to your model
);

# Index for fast similarity search
CREATE INDEX ON documents USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);

# Cosine-similarity query (lower distance = more similar)
SELECT content, 1 - (embedding <=> $1) AS similarity
FROM documents
ORDER BY embedding <=> $1
LIMIT 10;

Database usage

curl $API/{slug}/database/usage -H "X-API-Key: $KEY"
Blocked queriesSystem catalog queries (pg_database, pg_roles, etc.) are blocked for security. Use /database/usage for size and limits.

Endpoints

EndpointMethodBody
/{slug}/sqlPOST{"query": "...", "params": [...]}
/{slug}/database/usageGET—