API & Connection

Connection credentials and usage examples for your project.

Connection Details

https://xyz9876543.xbase.io
••••••••••••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••••••••••
⚠ Never expose the Service Role Key on the client side. Use it only in server-side code.

REST API

xBase auto-generates a REST API via PostgREST for every table in your database.

typescript
import { createClient } from '@xbase/client'

const xbase = createClient('https://xyz9876543.xbase.io', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjo…')

// SELECT
const { data, error } = await xbase
  .from('users')
  .select('id, name, email')
  .eq('active', true)
  .order('created_at', { ascending: false })
  .limit(10)

// INSERT
await xbase.from('posts').insert({ title: 'Hello', body: '…' })

// Realtime subscription
xbase.from('orders').on('INSERT', (event) => {
  console.log('New order:', event.new)
}).subscribe()

Realtime

WebSocket endpoint for real-time subscriptions via WAL replication.

wss://xyz9876543.xbase.io/realtime/v1/websocket

REST Endpoints

GET/rest/v1/{table}Query rows with filters, order and pagination
POST/rest/v1/{table}Insert one or multiple rows
PATCH/rest/v1/{table}Update rows matching filters
DELETE/rest/v1/{table}Delete rows matching filters
POST/rest/v1/rpc/{fn}Call a stored procedure / RPC function
POST/auth/v1/tokenIssue a JWT token (user login)