Skip to content
PraxivaraPraxivaraDocs
Websites Reference SDK reference

SDK reference

Everything a website can call: entity, auth, users, forms, optin, notifyOwner, email, files, ai, pdf, fn, prefs and asset, with signatures and return values.

Updated Dec 2, 2026 ET 3 min read
On this page

Every website imports the SDK from @praxivara/sdk. It is managed by the platform and updated for you; the file is read-only in the Code tab.

JavaScript
import { entity, auth, users, forms, optin, notifyOwner, email, files, ai, pdf, fn, prefs, asset, assetSrcSet } from "@praxivara/sdk";

entity(name)

CallReturns
list({ limit, offset, sort, mine })Array of rows, newest first
filter(conditions, options)Array of rows. Conditions: { field: value } or { field: { op, value } } with op eq, ne, lt, lte, gt, gte, contains
get(id)One row
create(data)The created row
bulkCreate(rows)The created rows, in one request
update(id, data)The updated row (merge)
delete(id), remove(id), archive(id)Soft delete
bulkUpdate([{ id, ...fields }])The updated rows, changed one by one
updateMany(ids, data)The same change to each row; the updated rows
deleteMany(ids)Soft deletes each row
subscribe(callback, options)Re-reads the list every few seconds and calls back when it changes; returns a stop function
schema()The table's fields and permissions

Rows carry id, created_date, mine and, for signed-in readers, created_by.

auth

CallNotes
isSignedIn()Synchronous boolean
methods(){ email, google }: which sign-in methods are on
register(email, password, displayName)Creates the account and signs in. When the website asks new people to confirm their email or waits for your approval, it throws instead, with err.code verification_required or approval_pending and a message to show
verifyEmail(token), resendVerification(email)Confirm an address with the token from the emailed link; send the link again
login(email, password)Throws with err.code email_unverified or approval_pending when the account is not let in yet
loginWithGoogle({ returnTo })Leaves for Google; returns signed in
googleSignInResult()null, or { ok, user } / { ok: false, error, message } after a Google round-trip
logout()
me()null when signed out; else { id, email, display_name, role, status, data, created_date }
updateMyUserData({ display_name, data })The signed-in user edits their own profile
forgotPassword(email)Always returns the same message
resetPassword(token, newPassword)Token from the reset link; signs in
listUsers(), inviteUser({ email, role }), setUserRole(id, role), setUserStatus(id, status)Admin only. Also available as users.list(), users.inviteUser(), users.setRole() and users.setStatus()

forms and optin

forms.submit(name, values) sends an intake form. Works signed out. Throws with err.fields (a field-to-message map) on validation failure.

optin holds the calls behind the website's sign-up and waitlist forms, such as optin.subscribe({ form, email, name, fields, consent }), optin.confirm(token), optin.status(ticket) and optin.waitlist(form). The builder writes these for you.

notifyOwner and email

CallNotes
notifyOwner(subject, message)Emails the website owner. Works signed out
email.send({ to, subject, body, replyTo })Sends from the website to a recipient and returns { status: "sent", id }. Caller must be signed in. Pass template and data instead of a body to send one of the website's email templates

files

CallReturns
files.upload({ file, onProgress }){ file_url, name, size, content_type }. onProgress gets a number from 0 to 1
files.createSignedUrl({ file_url, expires_in }){ signed_url, expires_at }

ai

CallReturns
ai.invokeLLM({ prompt, response_json_schema, add_context_from_internet, file_urls })A string, or parsed JSON when a schema is given
ai.generateImage({ prompt, size }){ url } (wrap with asset())
ai.extractDataFromUploadedFile({ file_url, json_schema }){ output }
ai.readVideoOrRecording({ file_url, onReading })What was said in an uploaded video or recording, as text with rough time marks. onReading is called while it is still reading

pdf

pdf.render(html, name) returns { url, name, size }. The caller must be signed in. Make a signed link with files.createSignedUrl before sharing it.

fn

fn.invoke(name, payload) runs a backend function and returns whatever it returned. Throws on failure.

prefs and asset

CallNotes
prefs.get(key), prefs.set(key, value), prefs.remove(key), prefs.all()Remember something on the device: a theme, a filter, a draft
asset(path)The full address of a file the website ships with, such as a generated image
assetSrcSet(path, widths, width)A srcset for one of those images, in the widths given

Sessions in pages

From @/lib/session.jsx: useSession() gives { status, user, isSignedIn, isAdmin, refresh, signOut }; <RequireAuth roles="admin"> guards a page; <RedirectIfSignedIn to="/dashboard"> wraps login and register.

Errors

Every call throws on failure. err.status is the HTTP status, err.message is the reason the server gave (often a code such as sign_in_required), err.code is set when there is one to branch on, and err.data holds the full answer. 401 means sign in first; 403 means not allowed; 402 means the website cannot pay for more AI right now, so show a message rather than retrying.

Was this page helpful?

Related articles