Skip to content

API Reference

Zatabase exposes a RESTful HTTP API at your project endpoint. All endpoints accept and return JSON unless otherwise noted. Authentication is required for all endpoints except health checks.

https://your-project.zatabase.io

All paths below are relative to this base.

Include the JWT access token in the Authorization header:

Authorization: Bearer <access_token>

See the Authentication guide for signup, login, and token refresh flows.

MethodPathDescription
GET/healthLiveness check
GET/health/readyReadiness check (verifies subsystems)
GET/healthzKubernetes-compatible liveness alias
GET/metricsPrometheus metrics endpoint
MethodPathDescription
POST/v1/auth/signupCreate a new account
POST/v1/auth/loginExchange credentials for tokens
POST/v1/auth/refreshRefresh an expired access token
POST/v1/auth/logoutRevoke the current session
POST/v1/auth/switchSwitch environment (live/sandbox)
GET/v1/whoamiGet current session details
GET/v1/environmentsList available environments
MethodPathDescription
POST/v1/sqlExecute a SQL statement

Request body:

{
"query": "SELECT * FROM products WHERE price > 10.0 LIMIT 20"
}

Response:

{
"rows": [
{"name": "Widget", "price": "29.99"}
],
"affected_rows": 0
}

For INSERT, UPDATE, and DELETE, rows is empty and affected_rows contains the count.

MethodPathDescription
GET/v1/collectionsList all collections
POST/v1/collectionsCreate a collection with optional projection
GET/v1/collections/:nameGet collection metadata
DELETE/v1/collections/:nameDelete a collection
GET/v1/collections/:name/projectionGet projection definition
PUT/v1/collections/:name/projectionUpdate projection
POST/v1/collections/:name/ingestIngest documents (NDJSON or JSON array)
MethodPathDescription
POST/v1/knnExact K-nearest neighbor search
POST/v1/indexes/hnsw/buildBuild an HNSW index
POST/v1/indexes/hnsw/searchApproximate nearest neighbor search
GET/v1/indexes/hnswList HNSW indexes
GET/v1/indexes/hnsw/:table/:column/statsIndex statistics
MethodPathDescription
POST/api/zql/queryExecute arbitrary ZQL
POST/api/zql/insertInsert a record
POST/api/zql/searchSimilarity search
GET/api/zql/record/:idGet record by ID
DELETE/api/zql/record/:idDelete record by ID
POST/api/zql/flushFlush writes to disk
GET/api/zql/infoEngine statistics
MethodPathDescription
POST/v1/jobsSubmit a new job
GET/v1/jobsList all jobs
GET/v1/jobs/:idGet job status
POST/v1/jobs/:id/cancelCancel a running job
POST/v1/jobs/:id/artifactsUpload an artifact
GET/v1/jobs/:id/artifactsList job artifacts
GET/v1/jobs/:id/artifacts/:aidDownload an artifact
WS/v1/jobs/:id/logsStream job logs (WebSocket)
MethodPathDescription
GET/v1/credits/balanceGet ZATA balance
POST/v1/credits/purchasePurchase ZATA (Stripe checkout)
GET/v1/credits/transactionsList transaction history
GET/v1/credits/transactions/:tx_idGet a single transaction
POST/v1/credits/escrow/lockLock ZATA in escrow
POST/v1/credits/escrow/:id/releaseRelease escrowed ZATA
POST/v1/credits/escrow/:id/refundRefund escrowed ZATA
GET/v1/credits/escrowList active escrows
MethodPathDescription
GET/v1/permissionsList all permission grants
PUT/v1/permissionsCreate or update a permission grant
GET/v1/permissions/effectiveGet effective permissions for session

Requires the organizations feature flag.

MethodPathDescription
POST/v1/organizationsCreate a new organization
GET/v1/organizationsList organizations
GET/v1/organizations/:org_idGet organization details
PUT/v1/organizations/:org_idUpdate organization
DELETE/v1/organizations/:org_idDelete organization

Additional sub-routes for hierarchy, members, settings, quotas, branding, and collaboration are available under /v1/organizations/:org_id/*.

Requires the organizations feature flag.

MethodPathDescription
POST/v1/teamsCreate a new team
GET/v1/teamsList teams
GET/v1/teams/:team_idGet team details
PUT/v1/teams/:team_idUpdate team
DELETE/v1/teams/:team_idDelete team

Additional sub-routes for hierarchy, members, invitations, and analytics are available under /v1/teams/:team_id/*.

Requires the cypher feature flag.

MethodPathDescription
POST/v1/cypherExecute a Cypher graph query

Request body:

{
"query": "MATCH (n:User)-[:KNOWS]->(m) RETURN n, m LIMIT 10"
}

Requires the events feature flag.

MethodPathDescription
POST/v1/eventsPublish a new event
GET/v1/eventsQuery events
POST/v1/events/replayReplay events
GET/v1/events/statsGet event statistics
POST/v1/webhooksCreate a webhook
GET/v1/webhooksList webhooks
GET/v1/webhooks/:idGet a specific webhook
DELETE/v1/webhooks/:idDelete a webhook
POST/v1/triggersCreate an event trigger
GET/v1/triggersList event triggers
POST/v1/tasksCreate a task
GET/v1/tasksList tasks
MethodPathDescription
GET/wsWebSocket upgrade (topic subscriptions, real-time updates)

With the websocket feature flag:

MethodPathDescription
GET/ws/exactly-onceEnhanced WebSocket with exactly-once delivery

WebSocket messages support subscribe/unsubscribe to topics (e.g., jobs/{id} for real-time job logs).

Requires the webrtc feature flag. All WebRTC routes use the /v2 prefix.

Room management:

MethodPathDescription
POST/v2/rtc/roomsCreate a new RTC room
GET/v2/rtc/roomsList all RTC rooms
GET/v2/rtc/rooms/:room_idGet room details
DELETE/v2/rtc/rooms/:room_idDelete a room
POST/v2/rtc/rooms/:room_id/joinJoin a room
POST/v2/rtc/rooms/:room_id/leaveLeave a room
GET/v2/rtc/rooms/:room_id/participantsList room participants
GET/v2/rtc/rooms/:room_id/participants/:session_idGet participant details
PUT/v2/rtc/rooms/:room_id/participants/:session_idUpdate participant

Session management:

MethodPathDescription
GET/v2/rtc/sessionsList all sessions
GET/v2/rtc/sessions/:session_idGet session details
PUT/v2/rtc/sessions/:session_idUpdate session
GET/v2/rtc/sessions/:session_id/transactionsGet session transaction status
POST/v2/rtc/sessions/:session_id/transactions/:tx_id/rollbackForce rollback

Signaling:

MethodPathDescription
POST/v2/rtc/offerWebRTC offer/answer exchange
POST/v2/rtc/ice-candidateAdd ICE candidate
POST/v2/rtc/sessions/:session_id/offerCreate session offer
POST/v2/rtc/sessions/:session_id/answerSet session answer
POST/v2/rtc/sessions/:session_id/handle-offerHandle incoming offer
POST/v2/rtc/sessions/:session_id/ice-candidateAdd session ICE candidate
GET/v2/rtc/sessions/:session_id/connection-statsConnection statistics
GET/v2/rtc/sessions/:session_id/statusSession status
POST/v2/rtc/sessions/:session_id/closeClose session

Subscriptions and triggers:

MethodPathDescription
POST/v2/rtc/subscriptionsCreate a subscription
GET/v2/rtc/subscriptionsList subscriptions
GET/v2/rtc/subscriptions/:idGet subscription details
PUT/v2/rtc/subscriptions/:idUpdate subscription
DELETE/v2/rtc/subscriptions/:idDelete subscription
POST/v2/rtc/triggersCreate a trigger
GET/v2/rtc/triggersList triggers
GET/v2/rtc/triggers/:idGet trigger details
PUT/v2/rtc/triggers/:idUpdate trigger
DELETE/v2/rtc/triggers/:idDelete trigger
POST/v2/rtc/triggers/:id/executeExecute trigger manually
GET/v2/rtc/triggers/:id/historyTrigger execution history

Requires the transactions feature flag.

Basic transactions:

MethodPathDescription
POST/v1/transactions/beginBegin a transaction
POST/v1/transactions/:id/executeExecute within a transaction
POST/v1/transactions/:id/commitCommit a transaction
POST/v1/transactions/:id/rollbackRollback a transaction
GET/v1/transactions/:id/statusGet transaction status

Distributed transactions:

MethodPathDescription
POST/v1/distributed-transactions/beginBegin distributed transaction
GET/v1/distributed-transactions/:id/statusGet distributed transaction status
POST/v1/distributed-transactions/:id/abortAbort distributed transaction
GET/v1/distributed-transactionsList distributed transactions
GET/v1/distributed-transactions/metricsDistributed transaction metrics

Sagas:

MethodPathDescription
POST/v1/sagas/startStart a saga
GET/v1/sagas/:id/statusGet saga status
POST/v1/sagas/:id/abortAbort a saga
GET/v1/sagasList sagas

ACH, ZATA, and Plaid (mounted at /v1/payments):

MethodPathDescription
POST/v1/payments/payouts/achCreate ACH payout
POST/v1/payments/payouts/zrtCreate ZATA payout
GET/v1/payments/payouts/:payout_idGet payout status
POST/v1/payments/payouts/:payout_id/cancelCancel payout
POST/v1/payments/banking/validateValidate bank account
GET/v1/payments/banking/routing/:routing_numberLook up bank by routing number
GET/v1/payments/zrt/exchange-rateGet current ZATA exchange rate
POST/v1/payments/zrt/convertPreview ZATA conversion
GET/v1/payments/analyticsPayment analytics
POST/v1/payments/plaid/link-tokenCreate Plaid link token
POST/v1/payments/plaid/exchangeExchange Plaid token
GET/v1/payments/healthPayment subsystem health

Requires the functions feature flag. See Serverless Functions for detailed documentation.

MethodPathDescription
POST/v1/functionsCreate a new function
GET/v1/functionsList functions
GET/v1/functions/:idGet function details
PUT/v1/functions/:idUpdate function
DELETE/v1/functions/:idDelete function

Additional endpoints for deployments, execution, metrics, triggers, and the template marketplace are nested under /v1/functions/*.

HTTP function invocation is available at /fn/:function_name/*path (all HTTP methods).

Requires the projects feature flag.

MethodPathDescription
POST/v1/projectsCreate a new project
GET/v1/projectsList projects
GET/v1/projects/:project_idGet project details
PUT/v1/projects/:project_idUpdate project
DELETE/v1/projects/:project_idDelete project
GET/v1/projects/:project_id/statsProject statistics
PUT/v1/projects/:project_id/configUpdate project configuration

Additional endpoints for environments, deployments, and deployment operations (deploy, promote, rollback) are available.

MethodPathDescription
POST/v1/analytics/insightsGet analytics insights
GET/v1/analytics/resourcesGet resource metrics (CPU, memory, disk)
POST/v1/analytics/costsCost analysis for a time period
GET/v1/analytics/anomaliesDetect anomalies
MethodPathDescription
GET/v1/openapi.jsonOpenAPI 3.0.3 specification (JSON)
GET/v1/docsInteractive Swagger UI documentation
MethodPathDescription
GET/metricsPrometheus-format metrics (no auth required)

These routes are available when the corresponding feature flags are enabled:

FeaturePath PrefixDescription
identity/v1/identity/*Verifiable credential management
mesh/v1/mesh/*Mesh network peer management and economics
domains/v1/domains/*Custom domain management and SSL certificates
notifications/v1/notifications/*Email/SMS notification delivery and templates
sdk-generator/v1/sdk/*SDK generation and publishing
cloud/v1/cloud/*Multi-cloud deployment management
security-hardening/v1/security/healthSecurity hardening health check
integrations/v1/integrations/*Cross-service integration orchestration

All errors follow a consistent format:

{
"error": "Forbidden",
"message": "Insufficient permissions: requires Read on Tables",
"status": 403
}

Common status codes:

CodeMeaning
400Bad request (malformed JSON, invalid SQL)
401Unauthorized (missing or expired token)
403Forbidden (insufficient permissions)
404Resource not found
409Conflict (duplicate resource)
422Unprocessable entity (valid JSON but invalid semantics)
429Rate limited
500Internal server error

Zatabase applies per-organization rate limits. Default limits are generous for development. Production deployments should configure limits based on the organization tier. Responses include standard rate limit headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 997
X-RateLimit-Reset: 1709300060