Documentation Index
Fetch the complete documentation index at: https://docs.ub.bitbros.in/llms.txt
Use this file to discover all available pages before exploring further.
The two keys
Every project gets exactly two API keys when it is created.| Key | Prefix | Where to use | Default write access |
|---|---|---|---|
| Publishable key | pk_live_... | Frontend, browser, mobile app | Read-only — writes blocked unless RLS is enabled |
| Secret key | sk_live_... | Server-side only (Node.js, serverless functions, etc.) | Full read and write access |
How to pass the key
Include the key in thex-api-key request header on every API call:
Using the publishable key
Usepk_live for all read operations from client-side code. It is safe to bundle in browser JavaScript, React Native apps, or any publicly visible context.
pk_live is blocked from all write operations (POST, PUT, PATCH, DELETE). Attempting a write with only pk_live returns:
Enabling writes with pk_live
You can allow authenticated frontend users to write their own data by enabling Row-Level Security (RLS) on a collection. When RLS is on,pk_live writes are accepted — but only when the request also includes a valid user JWT in the Authorization header, and only for documents the user owns.
Using the secret key
Usesk_live for all server-side operations: seeding data, admin scripts, serverless API routes, and any write that happens outside a user’s own browser session.
sk_live bypasses RLS entirely and always has full read and write access on all collections (except /api/data/users*, which is always blocked — use /api/userAuth/* instead).
Environment variable pattern
Store your keys in environment variables and never commit them to source control:Key behavior summary
| Scenario | Key | Token | Result |
|---|---|---|---|
| Read any collection | pk_live | Not required | Allowed |
| Write, RLS disabled | pk_live | Any | 403 blocked |
| Write, RLS enabled, no token | pk_live | Missing | 401 unauthorized |
| Write, RLS enabled, correct owner | pk_live | Matching userId | Allowed |
| Write, RLS enabled, wrong owner | pk_live | Different userId | 403 owner mismatch |
| Any write | sk_live | Not required | Allowed |
Access /api/data/users* | Any | Any | 403 blocked — use /api/userAuth/* |
