reference
RPC API
Call PostgreSQL functions in your project schema directly via the Postbase RPC API.
Published: March 22, 2026Updated: March 22, 2026
RPC API
The RPC API lets you call any PostgreSQL function defined in your project's schema.
Endpoint
POST /api/rpc/:function_name
Authorization: Bearer pb_anon_<key>
Content-Type: application/json
{ "arg1": "value1", "arg2": 42 }This executes: SELECT * FROM proj_<id>.function_name(arg1 => $1, arg2 => $2)
Count-Only Request
Add "count": "exact" to the body, or send a HEAD request, to get only the row count.
SDK Example
const { data, error } = await postbase.rpc('calculate_stats', {
user_id: 'uuid-here',
period: 'monthly',
})Notes
The function must exist in the project schema (
proj_<projectId>).RLS context is set the same way as the Database API — pass
X-Postbase-Tokenfor user identity.Arguments are passed as named parameters, so order does not matter.