Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.powabase.ai/llms.txt

Use this file to discover all available pages before exploring further.

The /api/database/* endpoints are a thin auth-required proxy over PostgREST, scoped to your project’s public schema. They use the same operators and conventions as PostgREST under the hood, but every call requires a valid Powabase auth token (no anon-key access). System schemas (ai, auth, storage, pg_catalog, information_schema, etc.) are blocked at this layer — those are managed via dedicated routes (/api/agents, /api/knowledge-bases, …). When you need the full PostgREST query language (filter operators, embedded relations, ordering, RPC calls), use the PostgREST endpoints instead. Use this proxy when you want a single auth model across all platform calls and don’t need the full PostgREST surface.

Common Patterns

Discover tables with GET /tables, then read or mutate rows by primary key. The /openapi endpoint returns the project’s full PostgREST OpenAPI spec — useful for UIs that render an API reference for user-defined tables.

GET /api/database/tables

List tables in the schema (only public is currently allowed). Returns { "tables": ["users", "orders", ...] }.
schema
string
Defaults to public. Any other value returns 400.
requests.get(f"{BASE_URL}/api/database/tables", headers=headers)

GET /api/database/tables/

List rows from a table via PostgREST. Supports limit (default 50) and offset query parameters.
table
string
required
Table name in the public schema. Must match ^[A-Za-z_][A-Za-z0-9_]*$.
limit
integer
Defaults to 50.
offset
integer
Defaults to 0.
schema
string
Defaults to public.
requests.get(f"{BASE_URL}/api/database/tables/users?limit=20", headers=headers)

GET /api/database/tables//

Fetch a single row by id. Returns the row as a JSON object (uses PostgREST’s Accept: application/vnd.pgrst.object+json).
table
string
required
Table name
row_id
string
required
Row primary key
schema
string
Defaults to public.
requests.get(f"{BASE_URL}/api/database/tables/users/{user_id}", headers=headers)

POST /api/database/tables/

Insert a row. The body is forwarded to PostgREST with Prefer: return=representation, so the response contains the inserted row.
table
string
required
Table name
{ "email": "ana@acme.io", "role": "admin" }
requests.post(f"{BASE_URL}/api/database/tables/users", headers=headers, json={"email": "ana@acme.io"})

PATCH /api/database/tables//

Update a row by id. Returns the updated row.
table
string
required
Table name
row_id
string
required
Row primary key
{ "role": "viewer" }
requests.patch(f"{BASE_URL}/api/database/tables/users/{user_id}", headers=headers, json={"role": "viewer"})

DELETE /api/database/tables//

Delete a row by id.
table
string
required
Table name
row_id
string
required
Row primary key
requests.delete(f"{BASE_URL}/api/database/tables/users/{user_id}", headers=headers)

GET /api/database/openapi

Return the project’s full PostgREST OpenAPI/Swagger spec. The frontend uses this to render an API reference for user-defined tables; you can use it to drive a settings UI or to introspect the schema programmatically.
spec = requests.get(f"{BASE_URL}/api/database/openapi", headers=headers).json()

Error Responses

Errors from this proxy return {"error": "<message>"}. Errors from the upstream PostgREST/Postgres are forwarded verbatim with their original status code.
StatusDescription
400Table name failed validation (must match ^[A-Za-z_][A-Za-z0-9_]*$)
400Schema is not public (only public is exposed via this proxy)
401Missing or invalid auth headers
500GET /tables failed against information_schema
502PostgREST connection failed (network error, gateway unreachable)
4xx/5xxForwarded from PostgREST (e.g. constraint violation, RLS denial)