API & Connection
Connection credentials and usage examples for your project.
Connection Details
⚠ 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.
REST Endpoints
GET
/rest/v1/{table}Query rows with filters, order and paginationPOST
/rest/v1/{table}Insert one or multiple rowsPATCH
/rest/v1/{table}Update rows matching filtersDELETE
/rest/v1/{table}Delete rows matching filtersPOST
/rest/v1/rpc/{fn}Call a stored procedure / RPC functionPOST
/auth/v1/tokenIssue a JWT token (user login)