API Reference

Administration

Manage health monitoring, database schemas, tables, API keys, logs, and analytics.

Administration API Reference

All administrative endpoints require the gateway administrator password sent via the x-admin header.


Health & Monitoring

Public Liveness Probe

GET /health or HEAD /health

  • Authentication: None (Public)
  • Response: {"status":"ok"}
  • Use case: Load balancer liveness probes and container orchestrators.

Authenticated Deep Health Check

GET /admin/health

  • Header: x-admin: <admin-password>
  • Response:
{ "status": "healthy", "services": { "postgres": {"status": "ok"}, "keyValue": {"status": "ok"}, "jsonDb": {"status": "ok"}, "queryConnections": { "reserved": 2, "idle": 5, "available": 33, "pendingCheckouts": 0, "checkoutTimeouts": 0, "oldestUnverifiedMs": 0, "rejectionsAtLimit": 0, "rejectionsAtPoolLimit": 0, "monitoring": "ok" } } }

Alert when status becomes degraded, pendingCheckouts grows, or oldestUnverifiedMs climbs.


API Key Management

List API Keys

GET /admin/keys Returns an array of key metadata records (passwords are omitted).

Get Key Details

GET /admin/keys/:id Returns scope and metadata for a specific key record ID.

Create Scoped Key

POST /admin/keys

{ "database": ["sales"], "scope-database": ["r"], "tables": ["public.orders"], "scope-table": ["c", "r"], "environment": "LIVE" }
  • database: Array of database names.
  • scope-database: Operations allowed across the entire database (r, c, u, d).
  • tables: Array of specific tables (e.g., ["public.orders"]).
  • scope-table: Operations allowed on the specified tables (c, r, u, d).
  • environment: "LIVE" (default) or "TEST".
The raw API key (data.apiKey) is returned only once upon creation. Save it immediately.

Update Key Scope

PATCH /admin/keys/:id or PUT /admin/keys/:id Replaces the complete scope of an existing active key.

Revoke API Key

DELETE /admin/keys/:id Revokes the key. Add query parameter ?hard=true to permanently delete the metadata record and drop the provisioned PostgreSQL role.


Database & Table Administration

List Databases

GET /admin/database Returns an array of all connectable databases in the PostgreSQL cluster.

Get Database Metadata

GET /admin/database/:id Accepts a database name or PostgreSQL OID. Returns ownership, encoding, server version, collation version, and size.

Create Database

POST /admin/database

{ "database": "analytics", "owner": "postgres", "encoding": "UTF8", "connectionLimit": 50 }

Update Database Properties

PATCH /admin/database Update newName, owner, allowConnections, connectionLimit, or settings.

Refresh Collation Version (PostgreSQL 15+)

PUT /admin/database Refreshes recorded collation version after system upgrades:

{"database": "sales", "version": "collation"}

Drop Database

DELETE /admin/databases/:name Drops a database. Add ?force=true to terminate existing connections before dropping.

List Tables

GET /admin/table

  • Headers: x-admin: <admin-password>, x-database: <db-name> Returns all user tables, schemas, and OIDs in the selected database.

Logs & Observability

Read Logs

GET /admin/logs

  • Query Parameters:
    • type: "audit" (default) or "system".
    • limit: Number of lines to return (default: 100, max: 500).

Clear Logs

DELETE /admin/logs

  • Query Parameters:
    • type: "all" (default), "audit", or "system".
    • analytics: Set true to also clear SQLite query analytics.

Query Analytics

Get Analytics Metrics

GET /admin/analytics?limit=50

{ "success": true, "enabled": true, "totalQueries": 2541, "failedQueries": 8, "keys": [ { "keyId": "key_01jh9x8...", "totalQueries": 2541, "failedQueries": 8, "lastUsedAt": "2026-11-23T06:15:00.000Z" } ], "recentFailures": [ { "keyId": "key_01jh9x8...", "database": "sales", "query": "SELECT * FROM orders WHERE id = ?", "truncated": false, "status": 400, "code": "QUERY_EXECUTION_ERROR", "pgCode": "42P01", "occurredAt": "2026-11-23T06:14:32.000Z" } ] }

Notice that literal parameters in failed queries are automatically redacted to ? by the analytics worker.

Clear Analytics

DELETE /admin/analytics Resets query counters and clears recent failure records.

Copyright © 2026